Java Reference
In-Depth Information
In this example, you have specified a few options that go together. In
Creating a Web Service
Client Using Raw XML Source and DOM
, we'll examine how to use different options, such as
PAYLOAD
instead of
MESSAGE
, and
Dispatch<Source>
instead of
Dispatch<SOAPMessage>
.
Here is the program's output (I added line breaks for clarity):
<?xml version='1.0' encoding='utf-8'?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<i:isbn xmlns:i="http://ns.soacookbook.com/catalog">12345</i:isbn>
</soap:Body>
</soap:Envelope>
Invoking...
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Header/>
<S:Body>
<ns2:book xmlns:ns2="http://ns.soacookbook.com/catalog">
<isbn>12345</isbn>
<author>
<firstName>William</firstName><lastName>Shakespeare</lastName>
</author>
<title>King Lear</title>
<category>LITERATURE</category>
</ns2:book>
</S:Body>
</S:Envelope>
The SOAP envelope must specify the namespace for messages that the service annotations in-
dicate.
It is unusual to get a SOAP envelope fully constructed from a physical file. There are a lot of
options for creating your SOAP message, but I chose to illustrate the file version because it
keeps the focus on the invocation mechanism, and it is the most explicit. This is a good start-
ing point for the round-trip that other recipes can refer to.