spring-guides/gs-consuming-web-service

pom.xml

Closed this issue · 23 comments

I get the following error on line 44 in the pom.xml file:
"Execution default of goal org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.12.3:generate failed: A required class was missing while executing."
screenshot_1

This makes it unable to generate the hello.wsdl file.

Does it work on the command line? Works for me.

Same problem for me. Doesn't work on the command line as well.

What happens on the command line?

I don't know how to build the pom.xml file on the command line in windows to be honest. Can you pleas explain it to me?

> mvn.bat package

Actually I saw that error in Eclipse today as well. It went away when I did the right click->Maven->Update Project... dance.

I tried this and at first it seemed like it was solved but when i rebuild the project it gives the same error.

You have to clarify what you mean by "rebuild the project". Rebuild from the IDE, or with mvn.bat? If it's the IDE, then it sounds more like an IDE-maven integration issue.

Yes i mean rebuild from IDE

I managed to get rid of the error by adding a version to the plugin:

<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.12.3</version>

And i added the following 2 dependencies:

<dependency>
    <groupId>com.sun.xml.bind</groupId>
    <artifactId>jaxb-xjc</artifactId>
    <version>2.2.5</version>
    </dependency>
<dependency>
    <groupId>org.jvnet.jaxb2.maven2</groupId>
    <artifactId>maven-jaxb2-plugin</artifactId>
    <version>0.12.3</version>
</dependency>

but now it still won't generate because of the warning shown in the image:

image

The full warning message is:

[WARNING] The URI [http://wsf.cdyne.com/WeatherWS/Weather.asmx?wsdl] seems to represent an absolute HTTP or HTTPS URL. Getting the last modification timestamp is only possible if the URL is accessible and if the server returns the [Last-Modified] header correctly. This method is not reliable and is likely to fail. In this case the last modification timestamp will be assumed to be unknown.
[ERROR] Could not retrieve the last modification timestamp for the URI [http://wsf.cdyne.com/WeatherWS/Weather.asmx?wsdl] from the HTTP URL connection. The [Last-Modified] header was probably not set correctly.
[WARNING] Last modification of the URI [http://wsf.cdyne.com/WeatherWS/Weather.asmx?wsdl] is not known.

Applied changes at c87941b which should use the latest version of the plugin, and also disabled forcedRegeneration, which according to https://github.com/highsource/maven-jaxb2-plugin/wiki/Do-Not-Use-forceRegenerate has been a major issue for IDEs like m2e.

hai, i got the same error too. I have included dependency like @GlennVanSchil said, but cant get rid off the error in my STS, my error is like in the first image but had different error log http://pastebin.com/74b5pUX5.

and still cant generate wsdl to java class, the error are : "Could not retrieve the last modification timestamp for the URI "

[WARNING] The URI [http://10.10.6.3/WEBSERVICE-CA/services/MobileService?wsdl] seems to represent an absolute HTTP or HTTPS URL. Getting the last modification timestamp is only possible if the URL is accessible and if the server returns the [Last-Modified] header correctly. This method is not reliable and is likely to fail. In this case the last modification timestamp will be assumed to be unknown.
[ERROR] Could not retrieve the last modification timestamp for the URI [http://10.10.6.3/WEBSERVICE-CA/services/MobileService?wsdl] from the HTTP URL connection. The [Last-Modified] header was probably not set correctly.
[WARNING] Last modification of the URI [http://10.10.x.x/WEBSERVICE-xx/services/xxx?wsdl] is not known.
[INFO] Sources are not up-to-date, XJC will be executed.

I`m not using spring boot like in the example, is there any required dependency which not included in my pom.xml ? i also have follow the instruction in maven-jaxb2-plugin, but it not help my problem.
this is my pom.xml http://pastebin.com/AZW7DXKs

waiting for someone who can pointed out what is wrong with my pom/config :D

I'm having this issue still today. I don't understand why this issue is closed because it doesn't seem like anyone found a resolution. Please help..am i missing something here?

The original issue was solved and it works from the command line with Maven. Hence the ticket was closed. A separate issue has arisen where the sample service used by this guide is no longer generating forecasts. I visited the site directly in my browser today and saw this:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

This indicates either a temporary outage, or this test service has been taken down. We may have to look for another sample service to hang this guide on or stand one up ourselves.

@adityasatrio If you're not using Spring Boot as this guide is, then yes, you have to analyze the transient dependencies this guide is pulling in and supply them yourself. You also have to deal with differences in the service you are talking to in your case. If you want to stage a runnable app somewhere on github where we can clone it and run it to reproduce your error, that would go a long way towards providing specific feedback.

@gregturn thanks and agreed. you can build and run from the command line, but the service call times out : /

@wasabi22 @adityasatrio The way I "fixed" it is by just removing the dependency. I gave up on trying to parse the wsdl through maven. Just open your command line and use the wsimport command http://www.mkyong.com/webservices/jax-ws/jax-ws-wsimport-tool-example/
Make sure your cmd is pointing to the right folder though.

Hi all, I'm a beginner to spring boot and am getting the error mentioned above. I'm trying to run this through the command line - not through IDE. Any advice on this error im getting?

[Error] Could not retrieve the last modification timestamp for the URI [http://wsf.cdyne.com/WeatherWS/Weather.asmx?wsdl]

Regards,
Hania

Issue is tracked by #9

Hi, I have this problem when I run using maven

[ERROR] Error while parsing schema(s).Location [].
com.sun.istack.SAXParseException2; IOException thrown when processing "http://www.webservicex.com/stockquote.asmx?WSDL". Exception: java.net.ConnectException: Connection refused (Connection refused).

What's problem? Cant understand
Can anyone help me or suggest something 😭 ?

@abilkaiyr Can you take a look at this. It seems a lot of people have this (or similar) problem(s), but it's hard to find an answer. Good luck!

dsyer commented

The wsdl is on the public internet. It’s nothing to do with the guide if it’s actually available at any particular moment. I guess it was either down or your local network restricts you from accessing it. In neither case can we fix it in this guide.

i found the WSDL file:

<wsdl:definitions xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://www.webserviceX.NET/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://www.webserviceX.NET/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
wsdl:types
<s:schema elementFormDefault="qualified" targetNamespace="http://www.webserviceX.NET/">
<s:element name="GetQuote">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="symbol" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetQuoteResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetQuoteResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="string" nillable="true" type="s:string" />
</s:schema>
</wsdl:types>
<wsdl:message name="GetQuoteSoapIn">
<wsdl:part name="parameters" element="tns:GetQuote" />
</wsdl:message>
<wsdl:message name="GetQuoteSoapOut">
<wsdl:part name="parameters" element="tns:GetQuoteResponse" />
</wsdl:message>
<wsdl:message name="GetQuoteHttpGetIn">
<wsdl:part name="symbol" type="s:string" />
</wsdl:message>
<wsdl:message name="GetQuoteHttpGetOut">
<wsdl:part name="Body" element="tns:string" />
</wsdl:message>
<wsdl:message name="GetQuoteHttpPostIn">
<wsdl:part name="symbol" type="s:string" />
</wsdl:message>
<wsdl:message name="GetQuoteHttpPostOut">
<wsdl:part name="Body" element="tns:string" />
</wsdl:message>
<wsdl:portType name="StockQuoteSoap">
<wsdl:operation name="GetQuote">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Get Stock quote for a company Symbol</wsdl:documentation>
<wsdl:input message="tns:GetQuoteSoapIn" />
<wsdl:output message="tns:GetQuoteSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:portType name="StockQuoteHttpGet">
<wsdl:operation name="GetQuote">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Get Stock quote for a company Symbol</wsdl:documentation>
<wsdl:input message="tns:GetQuoteHttpGetIn" />
<wsdl:output message="tns:GetQuoteHttpGetOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:portType name="StockQuoteHttpPost">
<wsdl:operation name="GetQuote">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Get Stock quote for a company Symbol</wsdl:documentation>
<wsdl:input message="tns:GetQuoteHttpPostIn" />
<wsdl:output message="tns:GetQuoteHttpPostOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="StockQuoteSoap" type="tns:StockQuoteSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="GetQuote">
<soap:operation soapAction="http://www.webserviceX.NET/GetQuote" style="document" />
wsdl:input
<soap:body use="literal" />
</wsdl:input>
wsdl:output
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="StockQuoteSoap12" type="tns:StockQuoteSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="GetQuote">
<soap12:operation soapAction="http://www.webserviceX.NET/GetQuote" style="document" />
wsdl:input
<soap12:body use="literal" />
</wsdl:input>
wsdl:output
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="StockQuoteHttpGet" type="tns:StockQuoteHttpGet">
<http:binding verb="GET" />
<wsdl:operation name="GetQuote">
<http:operation location="/GetQuote" />
wsdl:input
<http:urlEncoded />
</wsdl:input>
wsdl:output
<mime:mimeXml part="Body" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="StockQuoteHttpPost" type="tns:StockQuoteHttpPost">
<http:binding verb="POST" />
<wsdl:operation name="GetQuote">
<http:operation location="/GetQuote" />
wsdl:input
<mime:content type="application/x-www-form-urlencoded" />
</wsdl:input>
wsdl:output
<mime:mimeXml part="Body" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="StockQuote">
<wsdl:port name="StockQuoteSoap" binding="tns:StockQuoteSoap">
<soap:address location="http://www.webservicex.net/stockquote.asmx" />
</wsdl:port>
<wsdl:port name="StockQuoteSoap12" binding="tns:StockQuoteSoap12">
<soap12:address location="http://www.webservicex.net/stockquote.asmx" />
</wsdl:port>
<wsdl:port name="StockQuoteHttpGet" binding="tns:StockQuoteHttpGet">
<http:address location="http://www.webservicex.net/stockquote.asmx" />
</wsdl:port>
<wsdl:port name="StockQuoteHttpPost" binding="tns:StockQuoteHttpPost">
<http:address location="http://www.webservicex.net/stockquote.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

I am on MAC, it works if i use ./mvnw package even with maven-jaxb2-plugin - 0.14.0 or 0.12.3
I checked maven version
./mvnw --version showed 3.3.9
My installed maven is 3.5.0 and mvn package had the issue