My google-fu is not turning up very promising results for a SOAP library in java, mostly they are for setting up SOAP services where as I need to communicate WITH such a service.
I realise that SOAP is just a matter of building and parsing XML but ideally I would like object mapping and handling done transparently.
So far I have looked at Apache Axis and X-Fire (now Apache CXF) and both seem to deal more with serving SOAP services than actually working with SOAP services.
Could anyone guide me to any gems for dealing with SOAP or have personal experience dealing with SOAP services in Java.
There are two common types of encoding used in SOAP messaging: SOAP encoding as described in Section 5 of the SOAP 1.1 specification, and Literal encoding.
REST allows a greater variety of data formats, whereas SOAP only allows XML. Coupled with JSON (which typically works better with data and offers faster parsing), REST is generally considered easier to work with. Thanks to JSON, REST offers better support for browser clients.
The most fundamental difference between RPC and REST is that RPC was designed for actions, while REST is resource-centric. RPC executes procedures and commands with ease. Alternatively, REST is ideal for domain modeling and handling large quantities of data.
In most cases, web services are implemented using SOAP/HTTP as a transport protocol.
The frameworks you mention do produce client code.
E.g. for CXF How-to-create-client
They do not only deploy a web service.They provide client code to consume it as well!
The idea is that you run the corresponding automatic tool (wsdl2java
for CXF or wsimport
shipped with Java for jax-ws) to parse the service's WSDL and the client stubs and required artifacts to communicate with the web service will be created.
Then in your code you use the client stubs to communicate with the web service while the marshall/demarshalling from XML to java types is handled transparently by the framework.
There is also JAX-WS you can look into and if you want something simple you can use SAAJ to send soap messages directly to the web service endpoint.
In the frameworks you mention you should look into the parts that refer to client stub generation and consuming web services
For querying a SOAP service, you can use an implementation of the JAX-WS standard such as Project Kenai or the default version included in JDK 6+.
This article shows a sample of setting up a SOAP client (as opposed to a server) using the standard. Given a WSDL, you should be able to use standard tools for your client. This is another example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With