You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Marc Boorshtein <ma...@octetstring.com> on 2004/08/02 01:24:01 UTC

SOLVED - Re: Going from Text Based XML to a SOAPBody?

Once I realized how simple this was it took me about five minutes to  
get this to work.  I implemented a SOAPBodyElement implementation that  
takes a Document and overides outputImpl and calls writeDOMElement()  
directly.  I then replaced use of RPCElement with DOMElement:

public class DOMElement extends SOAPBodyElement {

	private Document document;

	public DOMElement(Document doc) {
		this.document = doc;
	}
	
	
	/* (non-Javadoc)
	 * @see  
org.apache.axis.message.MessageElement#outputImpl(org.apache.axis.encodi 
ng.SerializationContext)
	 */
	protected void outputImpl(SerializationContext context) throws  
Exception {
		context.writeDOMElement(document.getDocumentElement());
	}
}

This worked perfectly.

------------------------------------------------------------------------ 
--------------------------
Marc Boorshtein
Sr. Software Engineer, Octet String
marc.boorshtein@octetstring.com
On Aug 1, 2004, at 5:17 PM, Marc Boorshtein wrote:

> I'm not sure I understand what you mean.  do you mean that I should  
> simply generate the SOAP and XML as text or...?
> ----------------------------------------------------------------------- 
> ---------------------------
> Marc Boorshtein
> Sr. Software Engineer, Octet String
> marc.boorshtein@octetstring.com
> On Aug 1, 2004, at 5:08 PM, Jimmy zhang wrote:
>
>> Sure. But it is still be much easier to be able to stick it in  
>> directly ...
>> ----- Original Message -----
>>  From: Marc Boorshtein
>> To: axis-user@ws.apache.org
>> Sent: Sunday, August 01, 2004 2:21 PM
>> Subject: Re: Going from Text Based XML to a SOAPBody?
>>
>> For now I am looking just to proof out the concept, so performance  
>> isn't my biggest concern. The backend that will be generating the XML  
>> will be generating it to text (idrs.sourceforge.net). Eventually  
>> depending on how I see the project going, I will probably adjust the  
>> idrs so that instead of generating text, it generates a DOM model  
>> from the get-go. Your technology looks great, but unfortunately the  
>> GPL isn't compatible with the MPL, which is what I have my own  
>> project under.
>> ---------------------------------------------------------------------- 
>> ----------------------------
>> Marc Boorshtein
>> Sr. Software Engineer, Octet String
>> marc.boorshtein@octetstring.com
>> On Aug 1, 2004, at 4:05 PM, Jimmy zhang wrote:
>>
>>
>> Have you thought of ways to insert the XML message directly into the  
>> SOAP body without parsing XML?
>> Is that what is shown in the code?
>> It seems that if parsing the message is required before the insertion  
>> can be done, it is really inefficient.
>> Check out http://vtd-xml.sf.net
>> it has an XML processing (open sourced) that allows you to stick a  
>> message directly into the other one. 
>> Let me know if you have any questions.
>> ----- Original Message -----
>> From: Marc Boorshtein
>>  To: axis-user@ws.apache.org
>>  Sent: Sunday, August 01, 2004 1:58 PM
>> Subject: Re: Going from Text Based XML to a SOAPBody?
>>
>> I've made some great progress on this. I now have almost what I am  
>> looking for. I have the following code in my invoke method:
>>
>> public void invoke(MessageContext msgContext) throws AxisFault {
>> System.out.println("In INVOKE!!!!!!!!");
>>
>> Message resMsg = msgContext.getResponseMessage();
>> SOAPEnvelope resEnv;
>> // If we didn't have a response message, make sure we set one up
>> // with the appropriate versions of SOAP and Schema
>> if (resMsg == null) {
>> resEnv = new SOAPEnvelope(msgContext.getSOAPConstants(), msgContext
>> .getSchemaVersion());
>>
>> resMsg = new Message(resEnv);
>> msgContext.setResponseMessage(resMsg);
>> } else {
>> resEnv = resMsg.getSOAPEnvelope();
>> }
>>
>> Message reqMsg = msgContext.getRequestMessage();
>> SOAPEnvelope reqEnv = reqMsg.getSOAPEnvelope();
>>
>> DocumentBuilderFactory domFactory = DocumentBuilderFactory
>> .newInstance();
>> DocumentBuilder domBuilder = null;
>> Document doc = null;
>> try {
>> domBuilder = domFactory.newDocumentBuilder();
>>
>> doc = domBuilder.parse("/Users/mlb/test.xml");
>>
>> } catch (Exception e) {
>> e.printStackTrace();
>>
>> }
>>
>> RPCElement body = null;
>> body = new RPCElement("rpc-resp");
>>
>> RPCElement resBody = new RPCElement("Response");
>> resBody.setPrefix(body.getPrefix());
>> resBody.setNamespaceURI(body.getNamespaceURI());
>> try {
>> resBody.setEncodingStyle(msgContext.getEncodingStyle());
>> RPCParam param = new RPCParam(new QName("http://soapinterop.org/",
>> "echoString"), doc);
>> resBody.addParam(param);
>> resEnv.addBodyElement(resBody);
>> } catch (SOAPException e1) {
>> // TODO Auto-generated catch block
>> e1.printStackTrace();
>> }
>>
>> }
>>
>> I took most of the code from the JavaProdiver and the RPCProvider.  
>> This will produce the following SOAP message:
>> <?xml version="1.0" encoding="UTF-8"?>
>> <soapenv:Envelope  
>> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"  
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"  
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>> <soapenv:Body>
>> <echoString xmlns="http://soapinterop.org/">
>> <myxml xmlns="">
>>  <val>test</val>
>> <val>test</val>
>> <val>test</val>
>> </myxml>
>>  </echoString>
>> </soapenv:Body>
>> </soapenv:Envelope>
>>
>> Everything is great except for the "<echoString" tag. The tag is  
>> generated be the RPCParam which deserizlized the Document object. It  
>> looks like that at this point I need to look at the RPCParam class to  
>> see if I can create a version that will not create the wrapper tags  
>> and will just de-serialize the Document into the soap body. Any  
>> thoughts?
>>
>> ---------------------------------------------------------------------- 
>> ----------------------------
>> Marc Boorshtein
>> Sr. Software Engineer, Octet String
>> marc.boorshtein@octetstring.com
>> On Aug 1, 2004, at 1:36 PM, Vijai Mohan wrote:
>>
>>
>> I think that will work.
>>
>>  
>>
>>  
>>
>> Vijai Mohan
>>
>>
>> Software Design Engineer
>>
>>
>> SensorLogic¦M2M made easy.
>>
>>
>> 972-934-7375 x 2111
>>
>>
>> 972-934-7376 (fax)
>>
>>
>> vmohan@sensorlogic.com
>>
>>
>> www.Sensorlogic.com
>>
>>
>>  <image.tiff>
>>
>>  
>>
>> -----Original Message-----
>> From: Marc Boorshtein [mailto:marc.boorshtein@octetstring.com]
>> Sent: Sunday, August 01, 2004 1:33 PM
>> To: axis-user@ws.apache.org
>> Subject: Re: Going from Text Based XML to a SOAPBody?
>>
>>  
>>
>> Thanks for the tip, but this is a bit simple for what I'm looking to  
>> do. I'd like to build a provider that will let me take the XML in the  
>> request's body, perform some tasks to extract the information into an  
>> object model and then pass that information into a dynamic content  
>> generation system to generate some XML and add it to the SOAPBody.  
>> From the looks of it, I can serialize the XML into Document as you  
>> showed below, and then create an RPCElement and add it to the body as  
>> it's done in RPCProvider. Is this correct?
>>
>> ---------------------------------------------------------------------- 
>> ----------------------------
>> Marc Boorshtein
>> Sr. Software Engineer, Octet String
>> marc.boorshtein@octetstring.com
>> On Aug 1, 2004, at 12:41 PM, Vijai Mohan wrote:
>>
>>
>>
>> Create a simple webservice and use this snippet to return a xml  
>> document
>> from an xml file.
>> Axis automatically converts the Document in to the soap body .
>>
>>
>> public static Document getXMLDocument(){
>> DocumentBuilderFactory domFactory = DocumentBuilderFactory
>> .newInstance();
>> DocumentBuilder domBuilder = null;
>> try {
>> domBuilder = domFactory.newDocumentBuilder();
>>
>> Document doc = domBuilder.parse("c:\\XMLFILE.xml");
>>
>> return doc;
>> } catch (Exception e) {
>> e.printStackTrace();
>> return null;
>> }
>> }
>>
>> Vijai Mohan
>> Software Design Engineer
>> SensorLogic¦M2M made easy.
>> 972-934-7375 x 2111
>> 972-934-7376 (fax)
>> vmohan@sensorlogic.com
>> www.Sensorlogic.com
>>
>>
>>
>> -----Original Message-----
>> From: Marc Boorshtein [mailto:marc.boorshtein@octetstring.com]
>> Sent: Sunday, August 01, 2004 12:11 PM
>> To: axis-dev@ws.apache.org; axis-user@ws.apache.org
>> Subject: Going from Text Based XML to a SOAPBody?
>>
>> Hello,
>>
>> I am working on implementing a document service in which I want to  
>> take
>> text representation of XML and add it to a SOAPBody. From the looks of
>> it, it appears that I have to use an XML Parser to go from
>> XML->SOAPElement in a similar way that I would parse XML into a DOM
>> Tree. The only problem is that I can't find this "parsing" class. I
>> found SOAPFactory, but it doesn't seem to be a parser. Am I missing
>> something?
>>
>> Thanks!
>>
>> ---------------------------------------------------------------------- 
>> --
>> --------------------------
>> Marc Boorshtein
>> Sr. Software Engineer, Octet String
>> marc.boorshtein@octetstring.com
>>
>>

Re: SOLVED - Re: Going from Text Based XML to a SOAPBody?

Posted by Marc Boorshtein <ma...@octetstring.com>.
I only have outbound working.  My last message contains my  
SOAPBodyElement implementation.  Below  is my provider's invoke  
implementation.  It's pretty straight forward.  I haven't looked at  
tackling the inbound side of the equation, but    
http://issues.apache.org/jira/browse/AXIS-1484 seems to have a nice  
patch (though I haven't tried it yet).


	public void invoke(MessageContext msgContext) throws AxisFault {
		System.out.println("In INVOKE!!!!!!!!");

		Message resMsg = msgContext.getResponseMessage();
		SOAPEnvelope resEnv;
		// If we didn't have a response message, make sure we set one up
		// with the appropriate versions of SOAP and Schema
		if (resMsg == null) {
			resEnv = new SOAPEnvelope(msgContext.getSOAPConstants(), msgContext
					.getSchemaVersion());

			resMsg = new Message(resEnv);
			msgContext.setResponseMessage(resMsg);
		} else {
			resEnv = resMsg.getSOAPEnvelope();
		}

		Message reqMsg = msgContext.getRequestMessage();
		SOAPEnvelope reqEnv = reqMsg.getSOAPEnvelope();

		DocumentBuilderFactory domFactory = DocumentBuilderFactory
				.newInstance();
		DocumentBuilder domBuilder = null;
		Document doc = null;
		try {
			domBuilder = domFactory.newDocumentBuilder();

			doc = domBuilder.parse("/Users/mlb/test.xml");

		} catch (Exception e) {
			e.printStackTrace();

		}

		DOMElement body = null;
		body = new DOMElement(doc);
		resEnv.addBodyElement(body);
		
			
			/*new RPCElement("rpc-resp");

		RPCElement resBody = new RPCElement("Response");
		resBody.setPrefix(body.getPrefix());
		resBody.setNamespaceURI(body.getNamespaceURI());
		try {
			resBody.setEncodingStyle(msgContext.getEncodingStyle());
			RPCParam param = new RPCParam((QName) null, doc);
			resBody.addParam(param);
			resEnv.addBodyElement(resBody);
		} catch (SOAPException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}*/

	}

------------------------------------------------------------------------ 
--------------------------
Marc Boorshtein
Sr. Software Engineer, Octet String
marc.boorshtein@octetstring.com
On Aug 2, 2004, at 3:24 AM, Rajendra wrote:

> Hi,
>  I have requirements similar to what ur doing.
> I also need to send XMLDoc to my java web service throught the client.
> And service will return back the XMLDoc back to the client.
> If u have samples for this can u forward it to me.
> Or any refernces from where i can get samples to execute.
> Thanks in advance.
> regards,
> Rajendra.
>  
> ----- Original Message -----
>  From: Marc Boorshtein
> To: axis-user@ws.apache.org
> Sent: Monday, August 02, 2004 4:54  AM
> Subject: SOLVED - Re: Going from Text Based XML to a SOAPBody?
>
> Once I realized how simple this was it took me about five minutes to  
> get this to work. I implemented a SOAPBodyElement implementation that  
> takes a Document and overides outputImpl and calls writeDOMElement()  
> directly. I then replaced use of RPCElement with DOMElement:
>
> public class DOMElement extends SOAPBodyElement {
>
> private Document document;
>
> public DOMElement(Document doc) {
> this.document =  doc;
> }
>
>
> /* (non-Javadoc)
> * @see  
> org.apache.axis.message.MessageElement#outputImpl(org.apache.axis.encod 
> ing.SerializationContext)
> */
> protected void outputImpl(SerializationContext context) throws  
> Exception {
> context.writeDOMElement(document.getDocumentElement());
> }
> }
>
> This worked perfectly.
>
> ----------------------------------------------------------------------- 
> ---------------------------
> Marc Boorshtein
> Sr. Software Engineer, Octet String
> marc.boorshtein@octetstring.com
> On Aug 1, 2004, at 5:17 PM, Marc Boorshtein wrote:
>
>
> I'm not sure I understand what you mean. do you mean that I should  
> simply generate the SOAP and XML as text or...?
>   
> ----------------------------------------------------------------------- 
> ---------------------------
> Marc Boorshtein
> Sr. Software Engineer, Octet String
> marc.boorshtein@octetstring.com
> On Aug 1, 2004, at 5:08 PM, Jimmy zhang wrote:
>
>
> Sure. But it is still be much easier to be able to stick it in  
> directly ...
> ----- Original Message -----
> From:Marc Boorshtein
>  To:axis-user@ws.apache.org
> Sent: Sunday, August 01, 2004 2:21 PM
> Subject: Re: Going from Text Based XML to a SOAPBody?
>
> For now I am looking just to proof out the concept, so performance  
> isn't my biggest concern. The backend that will be generating the XML  
> will be generating it to text (idrs.sourceforge.net). Eventually  
> depending on how I see the project going, I will probably adjust the  
> idrs so that instead of generating text, it generates a DOM model from  
> the get-go. Your technology looks great, but unfortunately the GPL  
> isn't compatible with the MPL, which is what I have my own project  
> under.
> ----------------------------------------------------------------------- 
> ---------------------------
> Marc Boorshtein
> Sr. Software Engineer, Octet String
> marc.boorshtein@octetstring.com
> On Aug 1, 2004, at 4:05 PM, Jimmy zhang wrote:
>
>
> Have you thought of ways to insert the XML message directly into the  
> SOAP body without parsing XML?
> Is that what is shown in the code?
> It seems that if parsing the message is required before the insertion  
> can be done, it is really inefficient.
> Check out http://vtd-xml.sf.net
> it has an XML processing (open sourced) that allows you to stick a  
> message directly into the other one. 
> Let me know if you have any questions.
> ----- Original Message -----
> From: Marc Boorshtein
> To: axis-user@ws.apache.org
> Sent: Sunday, August 01, 2004 1:58 PM
> Subject: Re: Going from Text Based XML to a SOAPBody?
>
> I've made some great progress on this. I now have almost what I am  
> looking for. I have the following code in my invoke method:
>
> public void invoke(MessageContext msgContext) throws AxisFault {
> System.out.println("In INVOKE!!!!!!!!");
>
> Message resMsg = msgContext.getResponseMessage();
> SOAPEnvelope resEnv;
> // If we didn't have a response message, make sure we set one up
> // with the appropriate versions of SOAP and Schema
> if (resMsg == null) {
> resEnv = new SOAPEnvelope(msgContext.getSOAPConstants(), msgContext
> .getSchemaVersion());
>
> resMsg = new Message(resEnv);
> msgContext.setResponseMessage(resMsg);
> } else {
> resEnv = resMsg.getSOAPEnvelope();
> }
>
> Message reqMsg = msgContext.getRequestMessage();
> SOAPEnvelope reqEnv = reqMsg.getSOAPEnvelope();
>
> DocumentBuilderFactory domFactory = DocumentBuilderFactory
> .newInstance();
> DocumentBuilder domBuilder = null;
> Document doc = null;
> try {
> domBuilder = domFactory.newDocumentBuilder();
>
> doc = domBuilder.parse("/Users/mlb/test.xml");
>
> } catch (Exception e) {
> e.printStackTrace();
>
> }
>
> RPCElement body = null;
> body = new RPCElement("rpc-resp");
>
> RPCElement resBody = new RPCElement("Response");
> resBody.setPrefix(body.getPrefix());
> resBody.setNamespaceURI(body.getNamespaceURI());
> try {
> resBody.setEncodingStyle(msgContext.getEncodingStyle());
> RPCParam param = new RPCParam(new QName("http://soapinterop.org/",
> "echoString"), doc);
> resBody.addParam(param);
> resEnv.addBodyElement(resBody);
> } catch (SOAPException e1) {
> // TODO Auto-generated catch block
> e1.printStackTrace();
> }
>
> }
>
> I took most of the code from the JavaProdiver and the RPCProvider.  
> This will produce the following SOAP message:
> <?xml version="1.0" encoding="UTF-8"?>
> <soapenv:Envelope  
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"  
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"  
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <soapenv:Body>
> <echoString xmlns="http://soapinterop.org/">
> <myxml xmlns="">
> <val>test</val>
> <val>test</val>
> <val>test</val>
> </myxml>
> </echoString>
> </soapenv:Body>
> </soapenv:Envelope>
>
> Everything is great except for the "<echoString" tag. The tag is  
> generated be the RPCParam which deserizlized the Document object. It  
> looks like that at this point I need to look at the RPCParam class to  
> see if I can create a version that will not create the wrapper tags  
> and will just de-serialize the Document into the soap body. Any  
> thoughts?
>
> ----------------------------------------------------------------------- 
> ---------------------------
> Marc Boorshtein
> Sr. Software Engineer, Octet String
> marc.boorshtein@octetstring.com
> On Aug 1, 2004, at 1:36 PM, Vijai Mohan wrote:
>
>
> I think that will work.
>
>  
>
>  
>
> Vijai Mohan
>
>
> Software Design Engineer
>
>
> SensorLogic¦M2M made easy.
>
>
> 972-934-7375 x 2111
>
>
> 972-934-7376 (fax)
>
>
> vmohan@sensorlogic.com
>
>
> www.Sensorlogic.com
>
>
>  <image.tiff>
>
>  
>
> -----Original Message-----
> From: Marc Boorshtein [mailto:marc.boorshtein@octetstring.com]
> Sent: Sunday, August 01, 2004 1:33 PM
> To: axis-user@ws.apache.org
> Subject: Re: Going from Text Based XML to a SOAPBody?
>
>  
>
> Thanks for the tip, but this is a bit simple for what I'm looking to  
> do. I'd like to build a provider that will let me take the XML in the  
> request's body, perform some tasks to extract the information into an  
> object model and then pass that information into a dynamic content  
> generation system to generate some XML and add it to the SOAPBody.  
> From the looks of it, I can serialize the XML into Document as you  
> showed below, and then create an RPCElement and add it to the body as  
> it's done in RPCProvider. Is this correct?
>
> ----------------------------------------------------------------------- 
> ---------------------------
> Marc Boorshtein
> Sr. Software Engineer, Octet String
> marc.boorshtein@octetstring.com
> On Aug 1, 2004, at 12:41 PM, Vijai Mohan wrote:
>
>
>
> Create a simple webservice and use this snippet to return a xml  
> document
> from an xml file.
> Axis automatically converts the Document in to the soap body .
>
>
> public static Document getXMLDocument(){
> DocumentBuilderFactory domFactory = DocumentBuilderFactory
> .newInstance();
> DocumentBuilder domBuilder = null;
> try {
> domBuilder = domFactory.newDocumentBuilder();
>
> Document doc = domBuilder.parse("c:\\XMLFILE.xml");
>
> return doc;
> } catch (Exception e) {
> e.printStackTrace();
> return null;
> }
> }
>
> Vijai Mohan
> Software Design Engineer
> SensorLogic¦M2M made easy.
> 972-934-7375 x 2111
> 972-934-7376 (fax)
> vmohan@sensorlogic.com
> www.Sensorlogic.com
>
>
>
> -----Original Message-----
> From: Marc Boorshtein [mailto:marc.boorshtein@octetstring.com]
> Sent: Sunday, August 01, 2004 12:11 PM
> To: axis-dev@ws.apache.org; axis-user@ws.apache.org
> Subject: Going from Text Based XML to a SOAPBody?
>
> Hello,
>
> I am working on implementing a document service in which I want to take
> text representation of XML and add it to a SOAPBody. From the looks of
> it, it appears that I have to use an XML Parser to go from
> XML->SOAPElement in a similar way that I would parse XML into a DOM
> Tree. The only problem is that I can't find this "parsing" class. I
> found SOAPFactory, but it doesn't seem to be a parser. Am I missing
> something?
>
> Thanks!
>
> ----------------------------------------------------------------------- 
> -
> --------------------------
> Marc Boorshtein
> Sr. Software Engineer, Octet String
> marc.boorshtein@octetstring.com
>
>
>
> *********************************************************
> Disclaimer:
>
>  This message (including any attachments) contains
> confidential information intended for a specific
> individual and purpose, and is protected by law.
> If you are not the intended recipient, you should
> delete this message and are hereby notified that
> any disclosure, copying, or distribution of this
> message, or the taking of any action based on it,
> is strictly prohibited.
>
> *********************************************************
> Visit us at http://www.mahindrabt.com
>
>
>

Re: SOLVED - Re: Going from Text Based XML to a SOAPBody?

Posted by Rajendra <ra...@mahindrabt.com>.
Hi,
 I have requirements similar to what ur doing.
I also need to send XMLDoc to my java web service throught the client.
And service will return back the XMLDoc back to the client.
If u have samples for this can u forward it to me.
Or any refernces from where i can get samples to execute.
Thanks in advance.
regards,
Rajendra.

  ----- Original Message -----
  From: Marc Boorshtein
  To: axis-user@ws.apache.org
  Sent: Monday, August 02, 2004 4:54 AM
  Subject: SOLVED - Re: Going from Text Based XML to a SOAPBody?


  Once I realized how simple this was it took me about five minutes to get this to work. I implemented a SOAPBodyElement implementation that takes a Document and overides outputImpl and calls writeDOMElement() directly. I then replaced use of RPCElement with DOMElement:

  public class DOMElement extends SOAPBodyElement {

  private Document document;

  public DOMElement(Document doc) {
  this.document = doc;
  }


  /* (non-Javadoc)
  * @see org.apache.axis.message.MessageElement#outputImpl(org.apache.axis.encoding.SerializationContext)
  */
  protected void outputImpl(SerializationContext context) throws Exception {
  context.writeDOMElement(document.getDocumentElement());
  }
  }

  This worked perfectly.

  --------------------------------------------------------------------------------------------------
  Marc Boorshtein
  Sr. Software Engineer, Octet String
  marc.boorshtein@octetstring.com
  On Aug 1, 2004, at 5:17 PM, Marc Boorshtein wrote:


    I'm not sure I understand what you mean. do you mean that I should simply generate the SOAP and XML as text or...?
    --------------------------------------------------------------------------------------------------
    Marc Boorshtein
    Sr. Software Engineer, Octet String
    marc.boorshtein@octetstring.com
    On Aug 1, 2004, at 5:08 PM, Jimmy zhang wrote:


      Sure. But it is still be much easier to be able to stick it in directly ...
      ----- Original Message -----
      From: Marc Boorshtein
      To: axis-user@ws.apache.org
      Sent: Sunday, August 01, 2004 2:21 PM
      Subject: Re: Going from Text Based XML to a SOAPBody?

      For now I am looking just to proof out the concept, so performance isn't my biggest concern. The backend that will be generating the XML will be generating it to text (idrs.sourceforge.net). Eventually depending on how I see the project going, I will probably adjust the idrs so that instead of generating text, it generates a DOM model from the get-go. Your technology looks great, but unfortunately the GPL isn't compatible with the MPL, which is what I have my own project under.
      --------------------------------------------------------------------------------------------------
      Marc Boorshtein
      Sr. Software Engineer, Octet String
      marc.boorshtein@octetstring.com
      On Aug 1, 2004, at 4:05 PM, Jimmy zhang wrote:


      Have you thought of ways to insert the XML message directly into the SOAP body without parsing XML?
      Is that what is shown in the code?
      It seems that if parsing the message is required before the insertion can be done, it is really inefficient.
      Check out http://vtd-xml.sf.net
      it has an XML processing (open sourced) that allows you to stick a message directly into the other one.
      Let me know if you have any questions.
      ----- Original Message -----
      From: Marc Boorshtein
      To: axis-user@ws.apache.org
      Sent: Sunday, August 01, 2004 1:58 PM
      Subject: Re: Going from Text Based XML to a SOAPBody?

      I've made some great progress on this. I now have almost what I am looking for. I have the following code in my invoke method:

      public void invoke(MessageContext msgContext) throws AxisFault {
      System.out.println("In INVOKE!!!!!!!!");

      Message resMsg = msgContext.getResponseMessage();
      SOAPEnvelope resEnv;
      // If we didn't have a response message, make sure we set one up
      // with the appropriate versions of SOAP and Schema
      if (resMsg == null) {
      resEnv = new SOAPEnvelope(msgContext.getSOAPConstants(), msgContext
      .getSchemaVersion());

      resMsg = new Message(resEnv);
      msgContext.setResponseMessage(resMsg);
      } else {
      resEnv = resMsg.getSOAPEnvelope();
      }

      Message reqMsg = msgContext.getRequestMessage();
      SOAPEnvelope reqEnv = reqMsg.getSOAPEnvelope();

      DocumentBuilderFactory domFactory = DocumentBuilderFactory
      .newInstance();
      DocumentBuilder domBuilder = null;
      Document doc = null;
      try {
      domBuilder = domFactory.newDocumentBuilder();

      doc = domBuilder.parse("/Users/mlb/test.xml");

      } catch (Exception e) {
      e.printStackTrace();

      }

      RPCElement body = null;
      body = new RPCElement("rpc-resp");

      RPCElement resBody = new RPCElement("Response");
      resBody.setPrefix(body.getPrefix());
      resBody.setNamespaceURI(body.getNamespaceURI());
      try {
      resBody.setEncodingStyle(msgContext.getEncodingStyle());
      RPCParam param = new RPCParam(new QName("http://soapinterop.org/",
      "echoString"), doc);
      resBody.addParam(param);
      resEnv.addBodyElement(resBody);
      } catch (SOAPException e1) {
      // TODO Auto-generated catch block
      e1.printStackTrace();
      }

      }

      I took most of the code from the JavaProdiver and the RPCProvider. This will produce the following SOAP message:
      <?xml version="1.0" encoding="UTF-8"?>
      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <soapenv:Body>
      <echoString xmlns="http://soapinterop.org/">
      <myxml xmlns="">
      <val>test</val>
      <val>test</val>
      <val>test</val>
      </myxml>
      </echoString>
      </soapenv:Body>
      </soapenv:Envelope>

      Everything is great except for the "<echoString" tag. The tag is generated be the RPCParam which deserizlized the Document object. It looks like that at this point I need to look at the RPCParam class to see if I can create a version that will not create the wrapper tags and will just de-serialize the Document into the soap body. Any thoughts?

      --------------------------------------------------------------------------------------------------
      Marc Boorshtein
      Sr. Software Engineer, Octet String
      marc.boorshtein@octetstring.com
      On Aug 1, 2004, at 1:36 PM, Vijai Mohan wrote:


      I think that will work.

      

      

      Vijai Mohan


      Software Design Engineer


      SensorLogic¦M2M made easy.


      972-934-7375 x 2111


      972-934-7376 (fax)


      vmohan@sensorlogic.com


      www.Sensorlogic.com


       <image.tiff>

      

      -----Original Message-----
      From: Marc Boorshtein [mailto:marc.boorshtein@octetstring.com]
      Sent: Sunday, August 01, 2004 1:33 PM
      To: axis-user@ws.apache.org
      Subject: Re: Going from Text Based XML to a SOAPBody?

      

      Thanks for the tip, but this is a bit simple for what I'm looking to do. I'd like to build a provider that will let me take the XML in the request's body, perform some tasks to extract the information into an object model and then pass that information into a dynamic content generation system to generate some XML and add it to the SOAPBody. From the looks of it, I can serialize the XML into Document as you showed below, and then create an RPCElement and add it to the body as it's done in RPCProvider. Is this correct?

      --------------------------------------------------------------------------------------------------
      Marc Boorshtein
      Sr. Software Engineer, Octet String
      marc.boorshtein@octetstring.com
      On Aug 1, 2004, at 12:41 PM, Vijai Mohan wrote:



      Create a simple webservice and use this snippet to return a xml document
      from an xml file.
      Axis automatically converts the Document in to the soap body .


      public static Document getXMLDocument(){
      DocumentBuilderFactory domFactory = DocumentBuilderFactory
      .newInstance();
      DocumentBuilder domBuilder = null;
      try {
      domBuilder = domFactory.newDocumentBuilder();

      Document doc = domBuilder.parse("c:\\XMLFILE.xml");

      return doc;
      } catch (Exception e) {
      e.printStackTrace();
      return null;
      }
      }

      Vijai Mohan
      Software Design Engineer
      SensorLogic¦M2M made easy.
      972-934-7375 x 2111
      972-934-7376 (fax)
      vmohan@sensorlogic.com
      www.Sensorlogic.com



      -----Original Message-----
      From: Marc Boorshtein [mailto:marc.boorshtein@octetstring.com]
      Sent: Sunday, August 01, 2004 12:11 PM
      To: axis-dev@ws.apache.org; axis-user@ws.apache.org
      Subject: Going from Text Based XML to a SOAPBody?

      Hello,

      I am working on implementing a document service in which I want to take
      text representation of XML and add it to a SOAPBody. From the looks of
      it, it appears that I have to use an XML Parser to go from
      XML->SOAPElement in a similar way that I would parse XML into a DOM
      Tree. The only problem is that I can't find this "parsing" class. I
      found SOAPFactory, but it doesn't seem to be a parser. Am I missing
      something?

      Thanks!

      ------------------------------------------------------------------------
      --------------------------
      Marc Boorshtein
      Sr. Software Engineer, Octet String
      marc.boorshtein@octetstring.com





*********************************************************
Disclaimer:         

This message (including any attachments) contains
confidential information intended for a specific
individual and purpose, and is protected by law.
If you are not the intended recipient, you should
delete this message and are hereby notified that
any disclosure, copying, or distribution of this
message, or the taking of any action based on it,
is strictly prohibited.

*********************************************************
Visit us at http://www.mahindrabt.com