Java Reference
In-Depth Information
lns:xsi="http://www.w3.org/2001/XMLSchema-
instance" SOAP-
ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encod-
ing/"><SOAP-
ENV:Body><tns:IntToRoman
xmlns:tns="http://eBob42.org/
"><Int
xsi:type="xs:int">
2011
</Int></tns:IntToRoman></SOAP-
ENV:Body></SOAP-ENV:Envelope>
Soap response:
<?xml version="1.0"?>
<SOAP-ENV:Envelope
xmlns:SOAP-
ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xm-
lns:SOAP-
ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-
ENV:Body SOAP-
ENC:encodingStyle="http://schemas.xmlsoap.org/soap/envel-
ope/"><NS1:IntToRomanResponse
xmlns:NS1="urn:Roman-IRoman"><return
xsi:type="xsd:string">
MMXI
</return></NS1:IntToRomanResponse></SOAP-
ENV:Body></SOAP-
ENV:Envelope>
Although the output is tightly packed together and hard to read, youcan clearly see
the request
2011
and response
MMXI
values.
sponse value by first checking the response message's body to learn if it describes a
fault. This task is accomplished by invoking
SOAPBody
's
boolean hasFault()
method.Ifthismethodreturnstrue,
SOAPBody
's
SOAPFault getFault()
method
iscalled toreturn anobject that describes the fault interms ofthe
SOAPFault
inter-
face'smethods,and
SOAPFault
's
String getFaultString()
methodiscalled
to return the string-based fault message.