Closed rohitnandan closed 4 years ago
The sample app works for me (as does the smoke test at test/run.sh
which we use as in CI). Could you describe the issue you are having in a bit more detail?
Do you have a link to a blog post (we probably won't delete it, but we could edit, if there's an issue)?
Firstly following line is unclear to understand that "mvn clean install" or "mvn clean compile" needs to fire or any other command of maven lifecyle. Secondly even after trying multiple commands of maven lifecycle, no files or java classes are generated as mentioned in article. I donot see any error log.
In both cases, the JAXB domain object generation process has been wired into the build tool’s lifecycle, so you need not run any extra steps.
Output after mvn clean install
[INFO] --- maven-jaxb2-plugin:0.13.2:generate (default) @ premiumcalculator --- [INFO] Up-to-date check for source resources [[file:/home/rohit/projects/quoterepo/src/main/resources/testament/idfc/TEBT_QuoteGeneration_QuoteGeneration_ThirdPartyExport.wsdl, file:/home/rohit/projects/quoterepo/pom.xml]] and target resources [[file:/home/rohit/projects/quoterepo/src/main/java/META-INF/MANIFEST.MF,.. all classes in src directory]]. [INFO] Latest timestamp of the source resources is [2019-12-16 12:39:59.000], earliest timestamp of the target resources is [2019-08-20 14:50:55.000]. [INFO] Sources are not up-to-date, XJC will be executed. [INFO] Episode file [/home/rohit/projects/quoterepo/src/main/java/META-INF/sun-jaxb.episode] was augmented with if-exists="true" attributes. [INFO]
is unclear to understand that "mvn clean install" or "mvn clean compile" needs to fire or any other command of maven lifecyle
I thought it was obvious. I guess not, so I made it explicit. Check the guide when the cache refreshes, or look at the source code to see the change.
[INFO] Sources are not up-to-date, XJC will be executed.
That tells me that the plugin ran and the source code was generated. Maybe you just looked in the wrong place for the result?
Tutorials to request SOAP service present on first pages demonstrates mostly this "maven-jaxb2-plugin" but even following 4 articles on this with a slight variation, none worked for me, I created an empty project and no file is generated. The soap service producer I'm using could be different or could it possible my wsdl is incorrect or of different format/schema/version. This is what my wsdl looks like https://ibb.co/PY6Kmwb
There another method which other articles are showing which is to first generate xsd files from wsdl using liquixlm and wsimport, and then use jaxb2-maven-plugin . This method is already been tried my team and it works. Am I missing something in maven-jaxb2-plugin.
Am I missing something in maven-jaxb2-plugin.
I couldn't say for sure. But this guide is complete and it works for you right? The jaxb2 plugin is maintained and documented elsewhere: https://github.com/highsource/maven-jaxb2-plugin.
That says nothing about what might happen with a WSDL generated somewhere else. Pasting a screenshot of your WSDL is not really going to be helpful in deciding where the problem lies. If you can make a copy of it available someone might be able to spot the problem for you.
Nopes, this guide doesn't work for me. I have my WSDL from a bank that I'm afraid cannot be shared. But the structure of my WSDL is different than yours. I followed all steps, even created producer service as mentioned in README, and WSDL was hosted at http://localhost:8080/ws/countries.wsdl and viewable too,
Yet didn't work out of the box.
[INFO] Scanning for projects... [INFO] [INFO] -----------------< com.example:consuming-web-service >------------------ [INFO] Building consuming-web-service 0.0.1-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ consuming-web-service --- [INFO] Deleting /home/rohit/gs-consuming-web-service/complete/target [INFO] [INFO] --- maven-jaxb2-plugin:0.14.0:generate (default) @ consuming-web-service --- [WARNING] The URI [http://localhost:8080/ws/countries.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://localhost:8080/ws/countries.wsdl] from the HTTP URL connection. The [Last-Modified] header was probably not set correctly. [WARNING] Last modification of the URI [http://localhost:8080/ws/countries.wsdl] is not known. [INFO] Sources are not up-to-date, XJC will be executed. [INFO] Episode file [/home/rohit/gs-consuming-web-service/complete/target/generated-sources/xjc/META-INF/sun-jaxb.episode] was augmented with if-exists="true" attributes. [INFO] [INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ consuming-web-service --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 1 resource [INFO] Copying 0 resource [INFO] Copying 1 resource [INFO] [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ consuming-web-service --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 9 source files to /home/rohit/gs-consuming-web-service/complete/target/classes
That looks like it was successful. What makes you think it didn't work?
it shows ERROR for some "could not retrieve the last timestamp" and yet no files are generated. This is not about this tutorial. Every tutorial using "maven-jaxb2-plugin" present on google search after searching term "soap request spring boot" doesn't work and the worst part, the source code-shared there also doesn't work. Is SOAP completely deprecated? If you shed some light why one would create a SOAP service?
[ERROR] Could not retrieve the last modification timestamp for the URI [http://localhost:8080/ws/countries.wsdl] from the HTTP URL connection. The [Last-Modified] header was probably not set correctly.
But then you see
[INFO] BUILD SUCCESS
...
at the end right (the timestamp isn't needed)?
Could this error be for "maven-jaxb2-plugin", saying it could not generate objects necessary for requesting a SOAP webservice and INFO build success means, it built the spring-boot project, as it already had necessary objects for requesting a SOAP webservice. I was running examples from complete folder only.
The ERROR log is definitely from the plugin, but it's not really an error: the build succeeds, and all needed classes are generated. I guess you could say it's a bug in the plugin, but not really relevant to this guide. You could raise it with them (link above).
Yes, this does print as expected response. Yet there is something missing in SOAP version/format/schema. As I don't see any classes generated in my src folder, so how would I be debugging if there's some issue in generation itself, though this is out of scope for this issue .
rohit@rohit-Vostro-15-3568:~/gs-consuming-web-service/complete$ java -jar target/consuming-web-service-0.0.1-SNAPSHOT.jar
. _ _ /\ / '_ () \ \ \ \ ( ( )\ | ' | '| | ' \/ ` | \ \ \ \ \/ _)| |)| | | | | || (| | ) ) ) ) ' |__| .|| ||| |\, | / / / / =========|_|==============|__/=//// :: Spring Boot :: (v2.2.0.RELEASE)
2019-12-16 17:58:48.750 INFO 26548 --- [ main] c.e.c.ConsumingWebServiceApplication : Starting ConsumingWebServiceApplication v0.0.1-SNAPSHOT on rohit-Vostro-15-3568 with PID 26548 (/home/rohit/gs-consuming-web-service/complete/target/consuming-web-service-0.0.1-SNAPSHOT.jar started by rohit in /home/rohit/gs-consuming-web-service/complete) 2019-12-16 17:58:48.759 INFO 26548 --- [ main] c.e.c.ConsumingWebServiceApplication : No active profile set, falling back to default profiles: default 2019-12-16 17:58:49.638 INFO 26548 --- [ main] o.s.ws.soap.saaj.SaajSoapMessageFactory : Creating SAAJ 1.3 MessageFactory with SOAP 1.1 Protocol 2019-12-16 17:58:49.689 DEBUG 26548 --- [ main] o.s.ws.soap.saaj.SaajSoapMessageFactory : Using MessageFactory class [com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl] 2019-12-16 17:58:49.889 INFO 26548 --- [ main] c.e.c.ConsumingWebServiceApplication : Started ConsumingWebServiceApplication in 1.892 seconds (JVM running for 2.99) 2019-12-16 17:58:49.890 INFO 26548 --- [ main] c.e.consumingwebservice.CountryClient : Requesting location for Spain 2019-12-16 17:58:49.920 DEBUG 26548 --- [ main] o.s.ws.client.core.WebServiceTemplate : Opening [org.springframework.ws.transport.http.HttpUrlConnection@17695df3] to [http://localhost:8080/ws/countries] 2019-12-16 17:58:50.088 DEBUG 26548 --- [ main] o.s.ws.client.MessageTracing.sent : Sent request [SaajSoapMessage {http://spring.io/guides/gs-producing-web-service}getCountryRequest] 2019-12-16 17:58:50.978 DEBUG 26548 --- [ main] o.s.ws.client.MessageTracing.received : Received response [SaajSoapMessage {http://spring.io/guides/gs-producing-web-service}getCountryResponse] for request [SaajSoapMessage {http://spring.io/guides/gs-producing-web-service}getCountryRequest] EUR
Please remove the blog post as well. As this example doesn't works. It's outdated and fails.