You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ktiongson <kr...@gmail.com> on 2008/07/29 20:05:27 UTC

How do I preserve the XML tags when invoking the web service?

Environment: Apache Axis 1.4, Java 1.5
Tools Used: Axis WSDL2Java, JAXB
Scenario: Java application sends an XML message via SOAP/HTTP to SAP XI's
SOAP adapter

How do I invoke a web service from the application by preserving the XML
tags and not transforming them to XML entities?

I intercepted the message using TCPMon and I saw that the SOAP Body looks
like this:
<soapenv:Body><PePCPricing>&lt;Header&gt;&lt;JMSDestination&gt;PcPricing&lt;/JMSDestination&gt;

But I want it to look like this when I intercept the message:

<soapenv:Body>
  <PePCPricing><Header><JMSDestination>PcPricing</JMSDestination>


I marshal the XML message into a String (pePCPricing) before invoking the
web service. Here is the code I use to invoke the web service:
This is the Java code on the application side that invokes the web service:
 
   public void oa_PBA_PCP(java.lang.String pePCPricing) throws
java.rmi.RemoteException {
        if (super.cachedEndpoint == null) {
            throw new org.apache.axis.NoEndPointException();
        }
        org.apache.axis.client.Call _call = createCall();
        _call.setOperation(_operations[0]);
        _call.setUseSOAPAction(true);
        _call.setSOAPActionURI("http://sap.com/xi/WebService/soap1.1");
        _call.setEncodingStyle(_call.CHARACTER_SET_ENCODING);       
        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR,
Boolean.FALSE);
        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS,
Boolean.FALSE);
       
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
        _call.setOperationName(new javax.xml.namespace.QName("",
"oa_PBA_PCP"));
       
        setRequestHeaders(_call);
        setAttachments(_call);
        _call.invokeOneWay(new java.lang.Object[] { pePCPricing
});               
    }

How do I preserve the XML tags when invoking the web service? 


-- 
View this message in context: http://www.nabble.com/How-do-I-preserve-the-XML-tags-when-invoking-the-web-service--tp18718113p18718113.html
Sent from the Axis - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


Re: How do I preserve the XML tags when invoking the web service?

Posted by WJ Krpelan <kr...@yahoo.com>.
Hi,
if you transport xml within xml-schema strings it is syntactically necessary to escape certain characters as the embedded xml-strings are no "official" part of the surrounding document and the xml-parser would behave unpredictably. This got nothing to do with AXIS, however so maybe you should get in touch with an xml-list.
Cheers,
Wolfgang


--- On Tue, 7/29/08, ktiongson <kr...@gmail.com> wrote:

> From: ktiongson <kr...@gmail.com>
> Subject: How do I preserve the XML tags when invoking the web service?
> To: axis-dev@ws.apache.org
> Date: Tuesday, July 29, 2008, 8:05 PM
> Environment: Apache Axis 1.4, Java 1.5
> Tools Used: Axis WSDL2Java, JAXB
> Scenario: Java application sends an XML message via
> SOAP/HTTP to SAP XI's
> SOAP adapter
> 
> How do I invoke a web service from the application by
> preserving the XML
> tags and not transforming them to XML entities?
> 
> I intercepted the message using TCPMon and I saw that the
> SOAP Body looks
> like this:
> <soapenv:Body><PePCPricing>&lt;Header&gt;&lt;JMSDestination&gt;PcPricing&lt;/JMSDestination&gt;
> 
> But I want it to look like this when I intercept the
> message:
> 
> <soapenv:Body>
>  
> <PePCPricing><Header><JMSDestination>PcPricing</JMSDestination>
> 
> 
> I marshal the XML message into a String (pePCPricing)
> before invoking the
> web service. Here is the code I use to invoke the web
> service:
> This is the Java code on the application side that invokes
> the web service:
>  
>    public void oa_PBA_PCP(java.lang.String pePCPricing)
> throws
> java.rmi.RemoteException {
>         if (super.cachedEndpoint == null) {
>             throw new
> org.apache.axis.NoEndPointException();
>         }
>         org.apache.axis.client.Call _call =
> createCall();
>         _call.setOperation(_operations[0]);
>         _call.setUseSOAPAction(true);
>        
> _call.setSOAPActionURI("http://sap.com/xi/WebService/soap1.1");
>        
> _call.setEncodingStyle(_call.CHARACTER_SET_ENCODING);      
> 
>        
> _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR,
> Boolean.FALSE);
>        
> _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS,
> Boolean.FALSE);
>        
> _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
>         _call.setOperationName(new
> javax.xml.namespace.QName("",
> "oa_PBA_PCP"));
>        
>         setRequestHeaders(_call);
>         setAttachments(_call);
>         _call.invokeOneWay(new java.lang.Object[] {
> pePCPricing
> });               
>     }
> 
> How do I preserve the XML tags when invoking the web
> service? 
> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/How-do-I-preserve-the-XML-tags-when-invoking-the-web-service--tp18718113p18718113.html
> Sent from the Axis - Dev mailing list archive at
> Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail:
> axis-dev-help@ws.apache.org


      

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org