Today we’ll talk about writing java client for exchanging data with web service using SOAP protocol specification. Many of the web services that supports SOAP have java libraries that can make this task pretty simple to implement.
But if there is no such feature, then it becomes a little tricky, but in this article I will show you that it's not so hard as it seems.
At first, you should find out the location of wsdl file, which describes functionality offered by a web service. When it’s done, you can simply get the java code from it that will be able to send any request supported by the web service.
There is a bunch of tools that provide wsdl2java transfer, for example: Apache CXF, JAX-WS WS import, Apache Axis.
For making the code generating more convenient, I used SoapUI application. There you may generate the code through any of these tools by using user friendly interface, furthermore, it supports not only the tools that generate java code, but also tools that generate .NET 2.0 artifacts, XML beans and so on. Just specify the path to the folder with tool you want to use in global preferences, select it in the ‘Tools’ tab, specify path to the wsdl file and output directory and here you go, you have generated your own SOAP library, have fun! Follow the link for more details.
Note: while generating code from wsdl, you may get this kind of error:
‘Rpc/encoded wsdls are not supported with ...’. This means wa has parts with rpc/encoded style model, that is not supported by WS import, CXF, Axis 2. and some other tools, if this error appears, use Apache Axis 1.