Java Reference
In-Depth Information
2.3 SAAJ Client
A SOAP with Attachment API for Java (SAAJ) is more complex to write. It allows the
developers to gain direct access to methods of creating SOAP messages. You can manipulate
XML directly using Java APIs. Unlike the example in Chapter 1 of writing the client code
that uses JAX-RPC, writing an SAAJ client can be laborious. SAAJ allows a small foot-
print and support for binary data; however, it is difficult to work with in various binary data
formats.
The steps for creating a SOAP client using SAAJ are as follows:
1.
Create a SOAP message that includes a SOAP header and SOAP body.
2.
Add necessary elements to the SOAP header and SOAP body.
3.
Create a SOAP connection (URL).
4.
Send the SOAP message to the SOAP server.
5.
Process the response message.
A SOAP client can be written in Java with a basic understanding of SOAP messages. A
client code of the HelloWorld service is as follows.
Search WWH ::




Custom Search