[Java] A web service client example

Web_Services_for_dummies_creare_un_servizio_web_SOAP_per_Tomcat_–_il_Consumer_CoseNonJaviste_-_2013-12-20_17.14.50
Web Services for dummies: creare un servizio web SOAP per Tomcat – il Consumer

During my autumnal experience working with Spring on a e-commerce service library,
I had to implement a Web Service client to interface a popular italian payment gateway.

I found a useful and clear article (in Italian) that explains how to create
Web Service client directly from an Eclipse* wizard:
Web Services for dummies: creare un servizio web SOAP per Tomcat – il Consumer“;

you need only your service’s WSDL URL and wizard will generate Java classes
that you can use as Web Service client.

While building this solution some errors occurred, so here are the solutions…

1) “IWAB0503E Unable to update Java build path. Please check your system environment”
This was trivial, due to presence of two different versions javax.xml.soap under my STS*;
removing one of two and restarting STS(Eclipse)* that was fixed.
Reference: “Unable to update Java build path. Please check your system environment. | Roberto Oróstica Correa’s Blog
2) “Server did not recognize the value of HTTP Header SOAPAction”
The problem is caused by using the wrong SOAP version.
As shown in service definition (wsdl) SOAP version required is 1.2,
but my request was 1.1 version;
to fix you have to change namespace definition in Spring xml configuration file,
from http://schemas.xmlsoap.org/soap/envelope/ (v1.1 namespace)
to http://www.w3.org/2003/05/soap-envelope (v1.2 namespace)

* Actually I was using Spring Tool Suite, based on Eclipse

wsdl
Service discovered by WSDL