Java Reference
In-Depth Information
return ((SOAPElement) iter.next()).getValue();
}
}
String toRoman(String input) throws SOAPException
{
// Build a request message. The first step is to cre-
ate an empty message
// via a message factory. The default SOAP 1.1 mes-
sage factory is used.
MessageFactory
mfactory
=
MessageFact-
ory.newInstance();
SOAPMessage request = mfactory.createMessage();
// The request SOAPMessage object contains a SOAPPart
object, which
// contains a SOAPEnvelope object, which contains an
empty SOAPHeader
// object followed by an empty SOAPBody object.
// Detach the header since a header is not required.
This step is
// optional.
SOAPHeader header = request.getSOAPHeader();
header.detachNode();
// Access the body so that content can be added.
SOAPBody body = request.getSOAPBody();
// Add the IntToRoman operation body element to the
body.
QName bodyName = new QName("http://ebob42.org/", "in-
ttoroman", "tns");
SOAPBodyElement
bodyElement
=
body.addBodyElement(bodyName);
// Add the Int child element to the IntToRoman body
element.
QName name = new QName("int");
SOAPElement
element
=
bodyEle-
ment.addChildElement(name);
element.addTextNode(input).setAttribute("xsi:type",
Search WWH ::




Custom Search