Make your own free website on
Web Services : Apache Soap

1. What does SOAP stands for?
Ans: SOAP stands for Simple Object Access Protocol

2. When can I get complete resource on Apache Soap?
Ans: contains documentation, download, API, FAQ etc
Also has useful tutorial on Service side and Client side tutorials.

3.What does  XML utility class in Apache Soap do?
Ans: The utility class org.apache.soap.util.xml.XMLParserUtils helps to create an
XML document as an org.w3c.dom.Element as:
    DocumentBuilder xdb = XMLParserUtils.getXMLDocBuilder();
    Document doc = xdb.newDocument();
    Element root = doc.createElement("AddressBook");

Where "AddressBook" is the root element. To add a child "StreetName" with text value "1900 Exeter Rd" to root element do the following:

    Element streetElement = doc.createElement("StreetName");
    streetElement.appendChild("1900 Exeter Rd");

Another utility class org.apache.soap.util.xml.DOM2Writer helps to get the string representation of an org.w3c.dom.Element as :

4. How to call a function of the web service that accepts a String as argument and that returns an XML document?
Ans: In the following example the function getUsersOfClient of the web service urn:PasswordFetcher is being called. This function
accepts an argument clientCode of type string and will return an XML document as an instance of Element. Setting the encodingStyleURI of call to Constants.NS_URI_LITERAL_XML will help Apache SOAP locate the serializer and deserializer of XML objects while Constants.NS_URI_SOAP_ENC  in the Parameter constructor will ensure the serializer and deserialiser for String.

    Call call = new Call();
    Vector params = new Vector();
    params.addElement(new Parameter("clientCode", String.class, clientCode, Constants.NS_URI_SOAP_ENC ));

5. How to maintain HTTP session support across a series a call from the client to a web service?
Ans: First the web service need to be deployed with the scope as "Session". In the client Call object the following needs to be done:
 Call call = new Call ();
 SOAPHTTPConnection shc = new SOAPHTTPConnection ();
 shc.setMaintainSession (true);
 call.setSOAPTransport (shc);

The above codes make a SOAPHTTPConnection object the transport for the call object after setting its maintainsession flag of true.