ws-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ajit Bhingarkar <>
Subject RE: Axis client CDATA XML in a string request
Date Fri, 20 Jan 2012 06:16:51 GMT
In my case xmlInputFactory.setProperty(XMLInputFactory.IS_COALESCING, false); worked. XML aware
editors show CDATA wrapped string correctly even though raw data may appear so.


From: Suresh Janardhanan []
Sent: 20 January 2012 06:02
Subject: Axis client CDATA XML in a string request


I'll try to start from the beginning and explain what I am trying to achieve as you suggested.
I generated a web service client for a .NET Target web service using Apache Axis
Here is a snippet of the .Net WSDL.
            <wsdl:message name="RetrieveByParameterSoapIn">
                        <wsdl:part name="sKey" type="s:string" />
                        <wsdl:part name="sIDTypeID" type="s:string" />
                        <wsdl:part name="sID" type="s:string" />
                        <wsdl:part name="sXmlParameters" type="s:string" />
The Target expects an XML string to be set in "sXmlParameters", something like this -

Since it is a "string type", Axis client is converting the characters - < and >
So, the request looks like this -
[main] DEBUG httpclient.wire.content  - >> "<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope

My objective is to send the XML string inside "sXmlParameters" as is without the <, >
getting converted.

So I tried these steps.
1. I thought by adding -, it
would the issue. But you pointed out that since it is character data this won't work.
2. I tried changing the "sXmlParameters" type in the wsdl, but that resulted in com.ctc.wstx.exc.WstxUnexpectedCharException.
changed sXmlParameters type=s:string to xmlStingType as shown below.
            <xsd:schema xmlns:xsd=""
                  <xsd:complexType name="xmlStringType">
                              <xsd:any xmlns:xsd=""/>
<wsdl:part name="sXmlParameters" type="tns:xmlStringType" />
Code Snippet:
XmlStringType xmlStrType = new XmlStringType();
      OMElement element = AXIOMUtil.stringToOM(xmlParameters);
Stack Trace:
Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected
character 'C' (code 67) (CDATA not allowed in prolog/epilog)
at [row,col {unknown-source}]: [1,3]
  Stack Trace:

Any help is much appreciated.


View raw message