Which would be a better approach using JAXM or using the SOAP APIs as shown below ?
 
+ Shashi Anand
( Senior Software Engineer
8 Infogain India
O B 15 Sec 58, NOida, UP 201301, India
-----Original Message-----
From: Ashutosh Arora [mailto:[EMAIL PROTECTED]]
Sent: Saturday, March 09, 2002 1:10 AM
To: '[EMAIL PROTECTED]'; '[EMAIL PROTECTED]'; '[EMAIL PROTECTED]'
Subject: RE: soap messaging XML ???

Shashi,
Apache SOAP message can be built using Apache SOAP API. You need not read them from file. Developers did a great job with Apache SOAP APIs. It provides great support and utilities for that.  Following code snippet will walk u thru:
 
      // Create document
      DocumentBuilder xdb = XMLParserUtils.getXMLDocBuilder();
      Document doc = xdb.newDocument();
 
      // Create SOAP envelope
      Envelope msgEnv = new Envelope();
      Body msgBody = new Body();
      Vector bodyEntries = new Vector();
 
     // In bodyEntries add DOM Element object to your body. Or you can add java objects with pre-registered serializer/deserializer.
     // Following shows how to add DOM element
    Element myEl = doc.createElement("myelement);
    bodyEntries.addElement(myEl);
    msgBody.setBodyEntries(bodyEntries);
 
    // Set body
     msgEnv.setBody(msgBody);
     String strWriter;
     msgEnv.setAttribute(new QName(Constants.NS_URI_SOAP_ENV,  // SOAP encoding
             Constants.ATTR_ENCODING_STYLE), Constants.NS_URI_SOAP_ENC);
     msgEnv.marshall(strWriter, new XMLJavaMappingRegistry(), new SOAPContext());
     String xmlMsg = strWriter.toString();
 
 
Hope this code snippet helps.
Thanks
-Ashutosh.
 
 
-----Original Message-----
From: Shashi Anand [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 08, 2002 2:14 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: soap messaging XML ???

Hi,
 
One strange thing I noticed is that all the tutorials explaining the SOAP messaging assume whole SOAP message to be readilly available in XML file, where as this is not the case. None of tutorials explain how to form this SOAP message given the XML which is only part of message body.
Does somebody have any idea on how to form the SOAP message using API.
 
+ Shashi Anand
( Senior Software Engineer
8 Infogain India
O B 15 Sec 58, NOida, UP 201301, India
 

Reply via email to