Java Reference
In-Depth Information
ory.newInstance();
SOAPConnection con = factory.createConnection();
// Identify the message's target.
String endpoint = "http://www.ebob42.com/cgi-bin/ro-
mulan.exe/soap/IRoman";
// Call the Web service at the target using the re-
quest message. Capture
// the response message and send it to standard out-
put.
SOAPMessage response = con.call(request, endpoint);
System.out.println("\nsoap response:\n");
try
{
response.writeTo(System.out);
}
catch (IOException ioe)
{
JOptionPane.showMessageDialog(RomanNumerals.this,
ioe.getMessage());
}
// Close the connection to release resources.
con.close();
// Return a response consisting of the reason for a
SOAP Fault or the
// value of the IntToRomanResponse body element's re-
turn child element.
if (response.getSOAPBody().hasFault())
return
re-
sponse.getSOAPBody().getFault().getFaultString();
else
{
body = response.getSOAPBody();
bodyName = new QName("urn:Roman-IRoman", "inttoro-
manresponse", "ns1");
Iterator iter = body.getChildElements(bodyName);
bodyElement = (SOAPBodyElement) iter.next();
Search WWH ::




Custom Search