You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ws.apache.org by Suresh Janardhanan <su...@gmail.com> on 2012/01/20 01:32:01 UTC
Axis client CDATA XML in a string request
Andreas,
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 2.1.6.1.
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" />
</wsdl:message>
The Target expects an XML string to be set in "sXmlParameters", something
like this -
<![CDATA[<PARAMETERS><RETURN><GENERALINFORMATION><INFORMATIONRETURNTYPEID>3294f665bc644359bfd15824d2efe29c</INFORMATIONRETURNTYPEID></GENERALINFORMATION></RETURN></PARAMETERS>]]
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 xmlns:soapenv="
http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><ns1:RetrieveByParameter
xmlns:ns1="http://wsdl.echelon.com/Panoramix/
"><sKey>e1839da0c11c4058928b650f97c06853</sKey><sIDTypeID>f76e5d708edd464593bb031f646990b6</sIDTypeID><sID>100063728</sID><sXmlParameters><![CDATA[<PARAMETERS><RETURN><GENERALINFORMATION><INFORMATIONRETURNTYPEID>3294f665bc644359bfd15824d2efe29c</INFORMATIONRETURNTYPEID></GENERALINFORMATION></RETURN></PARAMETERS>]]></sXmlParameters></ns1:RetrieveByParameter></soapenv:Body></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 XMLInputFactory.properties -
javax.xml.stream.isCoalescing=false,
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.
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://wsdl.echelon.com/Panoramix/">
<xsd:complexType name="xmlStringType">
<xsd:sequence>
<xsd:any xmlns:xsd="
http://www.w3.org/2001/XMLSchema"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:part name="sXmlParameters" type="tns:xmlStringType" />
Code Snippet:
XmlStringType xmlStrType = *new* XmlStringType();
OMElement element = AXIOMUtil.*stringToOM*(xmlParameters);
xmlStrType.setExtraElement(element);
Stack Trace:
Caused by:
org.apache.axiom.om.OMException:
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:
org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:297)
org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement(OMDocumentImpl.java:111)
org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:571)
org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:567)
org.apache.axiom.om.util.AXIOMUtil.stringToOM(AXIOMUtil.java:54)
org.apache.axiom.om.util.AXIOMUtil.stringToOM(AXIOMUtil.java:39)
Any help is much appreciated.
Thanks,
Suresh
RE: Axis client CDATA XML in a string request
Posted by Ajit Bhingarkar <ab...@tibco.com>.
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.
Regards,
Ajit
________________________________
From: Suresh Janardhanan [mailto:suresh.janardhanan@gmail.com]
Sent: 20 January 2012 06:02
To: users@ws.apache.org; dev@ws.apache.org
Subject: Axis client CDATA XML in a string request
Andreas,
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 2.1.6.1.
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" />
</wsdl:message>
The Target expects an XML string to be set in "sXmlParameters", something like this -
<![CDATA[<PARAMETERS><RETURN><GENERALINFORMATION><INFORMATIONRETURNTYPEID>3294f665bc644359bfd15824d2efe29c</INFORMATIONRETURNTYPEID></GENERALINFORMATION></RETURN></PARAMETERS>]]
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 xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><ns1:RetrieveByParameter xmlns:ns1="http://wsdl.echelon.com/Panoramix/"><sKey>e1839da0c11c4058928b650f97c06853</sKey><sIDTypeID>f76e5d708edd464593bb031f646990b6</sIDTypeID><sID>100063728</sID><sXmlParameters><![CDATA[<PARAMETERS><RETURN><GENERALINFORMATION><INFORMATIONRETURNTYPEID>3294f665bc644359bfd15824d2efe29c</INFORMATIONRETURNTYPEID></GENERALINFORMATION></RETURN></PARAMETERS>]]></sXmlParameters></ns1:RetrieveByParameter></soapenv:Body></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 XMLInputFactory.properties - javax.xml.stream.isCoalescing=false, 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.
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://wsdl.echelon.com/Panoramix/">
<xsd:complexType name="xmlStringType">
<xsd:sequence>
<xsd:any xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:part name="sXmlParameters" type="tns:xmlStringType" />
Code Snippet:
XmlStringType xmlStrType = new XmlStringType();
OMElement element = AXIOMUtil.stringToOM(xmlParameters);
xmlStrType.setExtraElement(element);
Stack Trace:
Caused by:
org.apache.axiom.om.OMException: 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:
org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:297)
org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement(OMDocumentImpl.java:111)
org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:571)
org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:567)
org.apache.axiom.om.util.AXIOMUtil.stringToOM(AXIOMUtil.java:54)
org.apache.axiom.om.util.AXIOMUtil.stringToOM(AXIOMUtil.java:39)
Any help is much appreciated.
Thanks,
Suresh
Re: Axis client CDATA XML in a string request
Posted by Andreas Veithen <an...@gmail.com>.
Let's forget about the CDATA section for now. If you pass
"<PARAMETERS><RETURN><GENERALINFORMATION><INFORMATIONRETURNTYPEID>3294f665bc644359bfd15824d2efe29c</INFORMATIONRETURNTYPEID></GENERALINFORMATION></RETURN></PARAMETERS>"
as the value of sXmlParameters to the stub, does the invocation
succeed or not?
Andreas
On Fri, Jan 20, 2012 at 13:35, Suresh Janardhanan
<su...@gmail.com> wrote:
> I am using the Stub generated by wsdl2java.
>
> Suresh
>
>
> On Thu, Jan 19, 2012 at 7:32 PM, Suresh Janardhanan
> <su...@gmail.com> wrote:
>>
>> Andreas,
>>
>> 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 2.1.6.1.
>> 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" />
>> </wsdl:message>
>> The Target expects an XML string to be set in "sXmlParameters", something
>> like this -
>>
>>
>> <![CDATA[<PARAMETERS><RETURN><GENERALINFORMATION><INFORMATIONRETURNTYPEID>3294f665bc644359bfd15824d2efe29c</INFORMATIONRETURNTYPEID></GENERALINFORMATION></RETURN></PARAMETERS>]]
>>
>>
>> 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
>> xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><ns1:RetrieveByParameter
>> xmlns:ns1="http://wsdl.echelon.com/Panoramix/"><sKey>e1839da0c11c4058928b650f97c06853</sKey><sIDTypeID>f76e5d708edd464593bb031f646990b6</sIDTypeID><sID>100063728</sID><sXmlParameters><![CDATA[<PARAMETERS><RETURN><GENERALINFORMATION><INFORMATIONRETURNTYPEID>3294f665bc644359bfd15824d2efe29c</INFORMATIONRETURNTYPEID></GENERALINFORMATION></RETURN></PARAMETERS>]]></sXmlParameters></ns1:RetrieveByParameter></soapenv:Body></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 XMLInputFactory.properties
>> - javax.xml.stream.isCoalescing=false, 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.
>>
>> <wsdl:types>
>>
>> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>>
>> targetNamespace="http://wsdl.echelon.com/Panoramix/">
>>
>> <xsd:complexType name="xmlStringType">
>>
>> <xsd:sequence>
>>
>> <xsd:any
>> xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
>>
>> </xsd:sequence>
>>
>> </xsd:complexType>
>>
>> </xsd:schema>
>>
>> </wsdl:types>
>>
>> <wsdl:part name="sXmlParameters" type="tns:xmlStringType" />
>>
>> Code Snippet:
>>
>> XmlStringType xmlStrType = new XmlStringType();
>>
>> OMElement element = AXIOMUtil.stringToOM(xmlParameters);
>>
>> xmlStrType.setExtraElement(element);
>>
>> Stack Trace:
>>
>> Caused by:
>>
>> org.apache.axiom.om.OMException:
>> 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:
>>
>>
>> org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:297)
>>
>>
>> org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement(OMDocumentImpl.java:111)
>>
>>
>> org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:571)
>>
>>
>> org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:567)
>>
>> org.apache.axiom.om.util.AXIOMUtil.stringToOM(AXIOMUtil.java:54)
>>
>> org.apache.axiom.om.util.AXIOMUtil.stringToOM(AXIOMUtil.java:39)
>>
>>
>> Any help is much appreciated.
>>
>>
>> Thanks,
>>
>> Suresh
>
>
Re: Axis client CDATA XML in a string request
Posted by Suresh Janardhanan <su...@gmail.com>.
I am using the Stub generated by wsdl2java.
Suresh
On Thu, Jan 19, 2012 at 7:32 PM, Suresh Janardhanan <
suresh.janardhanan@gmail.com> wrote:
> Andreas,
>
> 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 2.1.6.1.
> 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" />
> </wsdl:message>
> The Target expects an XML string to be set in "sXmlParameters", something
> like this -
>
>
> <![CDATA[<PARAMETERS><RETURN><GENERALINFORMATION><INFORMATIONRETURNTYPEID>3294f665bc644359bfd15824d2efe29c</INFORMATIONRETURNTYPEID></GENERALINFORMATION></RETURN></PARAMETERS>]]
>
>
> 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 xmlns:soapenv="
> http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><ns1:RetrieveByParameter
> xmlns:ns1="http://wsdl.echelon.com/Panoramix/
> "><sKey>e1839da0c11c4058928b650f97c06853</sKey><sIDTypeID>f76e5d708edd464593bb031f646990b6</sIDTypeID><sID>100063728</sID><sXmlParameters><![CDATA[<PARAMETERS><RETURN><GENERALINFORMATION><INFORMATIONRETURNTYPEID>3294f665bc644359bfd15824d2efe29c</INFORMATIONRETURNTYPEID></GENERALINFORMATION></RETURN></PARAMETERS>]]></sXmlParameters></ns1:RetrieveByParameter></soapenv:Body></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 XMLInputFactory.properties - javax.xml.stream.isCoalescing=false,
> 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.
>
> <wsdl:types>
>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
> targetNamespace="http://wsdl.echelon.com/Panoramix/">
>
> <xsd:complexType name="xmlStringType">
>
> <xsd:sequence>
>
> <xsd:any xmlns:xsd="
> http://www.w3.org/2001/XMLSchema"/>
>
> </xsd:sequence>
>
> </xsd:complexType>
>
> </xsd:schema>
>
> </wsdl:types>
>
> <wsdl:part name="sXmlParameters" type="tns:xmlStringType" />
>
> Code Snippet:
>
> XmlStringType xmlStrType = *new* XmlStringType();
>
> OMElement element = AXIOMUtil.*stringToOM*(xmlParameters);
>
> xmlStrType.setExtraElement(element);
>
> Stack Trace:
>
> Caused by:
>
> org.apache.axiom.om.OMException:
> 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:
>
>
> org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:297)
>
>
> org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement(OMDocumentImpl.java:111)
>
>
> org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:571)
>
>
> org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:567)
>
> org.apache.axiom.om.util.AXIOMUtil.stringToOM(AXIOMUtil.java:54)
>
> org.apache.axiom.om.util.AXIOMUtil.stringToOM(AXIOMUtil.java:39)
>
>
> Any help is much appreciated.
>
>
> Thanks,
>
> Suresh
>
>
RE: Axis client CDATA XML in a string request
Posted by Ajit Bhingarkar <ab...@tibco.com>.
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.
Regards,
Ajit
________________________________
From: Suresh Janardhanan [mailto:suresh.janardhanan@gmail.com]
Sent: 20 January 2012 06:02
To: users@ws.apache.org; dev@ws.apache.org
Subject: Axis client CDATA XML in a string request
Andreas,
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 2.1.6.1.
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" />
</wsdl:message>
The Target expects an XML string to be set in "sXmlParameters", something like this -
<![CDATA[<PARAMETERS><RETURN><GENERALINFORMATION><INFORMATIONRETURNTYPEID>3294f665bc644359bfd15824d2efe29c</INFORMATIONRETURNTYPEID></GENERALINFORMATION></RETURN></PARAMETERS>]]
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 xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><ns1:RetrieveByParameter xmlns:ns1="http://wsdl.echelon.com/Panoramix/"><sKey>e1839da0c11c4058928b650f97c06853</sKey><sIDTypeID>f76e5d708edd464593bb031f646990b6</sIDTypeID><sID>100063728</sID><sXmlParameters><![CDATA[<PARAMETERS><RETURN><GENERALINFORMATION><INFORMATIONRETURNTYPEID>3294f665bc644359bfd15824d2efe29c</INFORMATIONRETURNTYPEID></GENERALINFORMATION></RETURN></PARAMETERS>]]></sXmlParameters></ns1:RetrieveByParameter></soapenv:Body></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 XMLInputFactory.properties - javax.xml.stream.isCoalescing=false, 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.
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://wsdl.echelon.com/Panoramix/">
<xsd:complexType name="xmlStringType">
<xsd:sequence>
<xsd:any xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:part name="sXmlParameters" type="tns:xmlStringType" />
Code Snippet:
XmlStringType xmlStrType = new XmlStringType();
OMElement element = AXIOMUtil.stringToOM(xmlParameters);
xmlStrType.setExtraElement(element);
Stack Trace:
Caused by:
org.apache.axiom.om.OMException: 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:
org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:297)
org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement(OMDocumentImpl.java:111)
org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:571)
org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:567)
org.apache.axiom.om.util.AXIOMUtil.stringToOM(AXIOMUtil.java:54)
org.apache.axiom.om.util.AXIOMUtil.stringToOM(AXIOMUtil.java:39)
Any help is much appreciated.
Thanks,
Suresh
Re: Axis client CDATA XML in a string request
Posted by Andreas Veithen <an...@gmail.com>.
What kind of client API are you using? A stub generated using
wsdl2java or the ServiceClient API together with Axiom?
Andreas
On Fri, Jan 20, 2012 at 01:32, Suresh Janardhanan
<su...@gmail.com> wrote:
> Andreas,
>
> 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 2.1.6.1.
> 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" />
> </wsdl:message>
> The Target expects an XML string to be set in "sXmlParameters", something
> like this -
>
> <![CDATA[<PARAMETERS><RETURN><GENERALINFORMATION><INFORMATIONRETURNTYPEID>3294f665bc644359bfd15824d2efe29c</INFORMATIONRETURNTYPEID></GENERALINFORMATION></RETURN></PARAMETERS>]]
>
>
> 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
> xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><ns1:RetrieveByParameter
> xmlns:ns1="http://wsdl.echelon.com/Panoramix/"><sKey>e1839da0c11c4058928b650f97c06853</sKey><sIDTypeID>f76e5d708edd464593bb031f646990b6</sIDTypeID><sID>100063728</sID><sXmlParameters><![CDATA[<PARAMETERS><RETURN><GENERALINFORMATION><INFORMATIONRETURNTYPEID>3294f665bc644359bfd15824d2efe29c</INFORMATIONRETURNTYPEID></GENERALINFORMATION></RETURN></PARAMETERS>]]></sXmlParameters></ns1:RetrieveByParameter></soapenv:Body></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 XMLInputFactory.properties
> - javax.xml.stream.isCoalescing=false, 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.
>
> <wsdl:types>
>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
> targetNamespace="http://wsdl.echelon.com/Panoramix/">
>
> <xsd:complexType name="xmlStringType">
>
> <xsd:sequence>
>
> <xsd:any
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
>
> </xsd:sequence>
>
> </xsd:complexType>
>
> </xsd:schema>
>
> </wsdl:types>
>
> <wsdl:part name="sXmlParameters" type="tns:xmlStringType" />
>
> Code Snippet:
>
> XmlStringType xmlStrType = new XmlStringType();
>
> OMElement element = AXIOMUtil.stringToOM(xmlParameters);
>
> xmlStrType.setExtraElement(element);
>
> Stack Trace:
>
> Caused by:
>
> org.apache.axiom.om.OMException:
> 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:
>
>
> org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:297)
>
>
> org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement(OMDocumentImpl.java:111)
>
>
> org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:571)
>
>
> org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:567)
>
> org.apache.axiom.om.util.AXIOMUtil.stringToOM(AXIOMUtil.java:54)
>
> org.apache.axiom.om.util.AXIOMUtil.stringToOM(AXIOMUtil.java:39)
>
>
> Any help is much appreciated.
>
>
> Thanks,
>
> Suresh
Re: Axis client CDATA XML in a string request
Posted by abel chavez <su...@gmail.com>.
I don't understand what you really want.
On Jan 19, 2012 7:39 PM, "Suresh Janardhanan" <su...@gmail.com>
wrote:
> Andreas,
>
> 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 2.1.6.1.
> 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" />
> </wsdl:message>
> The Target expects an XML string to be set in "sXmlParameters", something
> like this -
>
>
> <![CDATA[<PARAMETERS><RETURN><GENERALINFORMATION><INFORMATIONRETURNTYPEID>3294f665bc644359bfd15824d2efe29c</INFORMATIONRETURNTYPEID></GENERALINFORMATION></RETURN></PARAMETERS>]]
>
>
> 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 xmlns:soapenv="
> http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><ns1:RetrieveByParameter
> xmlns:ns1="http://wsdl.echelon.com/Panoramix/
> "><sKey>e1839da0c11c4058928b650f97c06853</sKey><sIDTypeID>f76e5d708edd464593bb031f646990b6</sIDTypeID><sID>100063728</sID><sXmlParameters><![CDATA[<PARAMETERS><RETURN><GENERALINFORMATION><INFORMATIONRETURNTYPEID>3294f665bc644359bfd15824d2efe29c</INFORMATIONRETURNTYPEID></GENERALINFORMATION></RETURN></PARAMETERS>]]></sXmlParameters></ns1:RetrieveByParameter></soapenv:Body></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 XMLInputFactory.properties - javax.xml.stream.isCoalescing=false,
> 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.
>
> <wsdl:types>
>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
> targetNamespace="http://wsdl.echelon.com/Panoramix/">
>
> <xsd:complexType name="xmlStringType">
>
> <xsd:sequence>
>
> <xsd:any xmlns:xsd="
> http://www.w3.org/2001/XMLSchema"/>
>
> </xsd:sequence>
>
> </xsd:complexType>
>
> </xsd:schema>
>
> </wsdl:types>
>
> <wsdl:part name="sXmlParameters" type="tns:xmlStringType" />
>
> Code Snippet:
>
> XmlStringType xmlStrType = *new* XmlStringType();
>
> OMElement element = AXIOMUtil.*stringToOM*(xmlParameters);
>
> xmlStrType.setExtraElement(element);
>
> Stack Trace:
>
> Caused by:
>
> org.apache.axiom.om.OMException:
> 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:
>
>
> org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:297)
>
>
> org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement(OMDocumentImpl.java:111)
>
>
> org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:571)
>
>
> org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:567)
>
> org.apache.axiom.om.util.AXIOMUtil.stringToOM(AXIOMUtil.java:54)
>
> org.apache.axiom.om.util.AXIOMUtil.stringToOM(AXIOMUtil.java:39)
>
>
> Any help is much appreciated.
>
>
> Thanks,
>
> Suresh
>
>
Re: Axis client CDATA XML in a string request
Posted by Suresh Janardhanan <su...@gmail.com>.
I am using the Stub generated by wsdl2java.
Suresh
On Thu, Jan 19, 2012 at 7:32 PM, Suresh Janardhanan <
suresh.janardhanan@gmail.com> wrote:
> Andreas,
>
> 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 2.1.6.1.
> 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" />
> </wsdl:message>
> The Target expects an XML string to be set in "sXmlParameters", something
> like this -
>
>
> <![CDATA[<PARAMETERS><RETURN><GENERALINFORMATION><INFORMATIONRETURNTYPEID>3294f665bc644359bfd15824d2efe29c</INFORMATIONRETURNTYPEID></GENERALINFORMATION></RETURN></PARAMETERS>]]
>
>
> 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 xmlns:soapenv="
> http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><ns1:RetrieveByParameter
> xmlns:ns1="http://wsdl.echelon.com/Panoramix/
> "><sKey>e1839da0c11c4058928b650f97c06853</sKey><sIDTypeID>f76e5d708edd464593bb031f646990b6</sIDTypeID><sID>100063728</sID><sXmlParameters><![CDATA[<PARAMETERS><RETURN><GENERALINFORMATION><INFORMATIONRETURNTYPEID>3294f665bc644359bfd15824d2efe29c</INFORMATIONRETURNTYPEID></GENERALINFORMATION></RETURN></PARAMETERS>]]></sXmlParameters></ns1:RetrieveByParameter></soapenv:Body></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 XMLInputFactory.properties - javax.xml.stream.isCoalescing=false,
> 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.
>
> <wsdl:types>
>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
> targetNamespace="http://wsdl.echelon.com/Panoramix/">
>
> <xsd:complexType name="xmlStringType">
>
> <xsd:sequence>
>
> <xsd:any xmlns:xsd="
> http://www.w3.org/2001/XMLSchema"/>
>
> </xsd:sequence>
>
> </xsd:complexType>
>
> </xsd:schema>
>
> </wsdl:types>
>
> <wsdl:part name="sXmlParameters" type="tns:xmlStringType" />
>
> Code Snippet:
>
> XmlStringType xmlStrType = *new* XmlStringType();
>
> OMElement element = AXIOMUtil.*stringToOM*(xmlParameters);
>
> xmlStrType.setExtraElement(element);
>
> Stack Trace:
>
> Caused by:
>
> org.apache.axiom.om.OMException:
> 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:
>
>
> org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:297)
>
>
> org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement(OMDocumentImpl.java:111)
>
>
> org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:571)
>
>
> org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:567)
>
> org.apache.axiom.om.util.AXIOMUtil.stringToOM(AXIOMUtil.java:54)
>
> org.apache.axiom.om.util.AXIOMUtil.stringToOM(AXIOMUtil.java:39)
>
>
> Any help is much appreciated.
>
>
> Thanks,
>
> Suresh
>
>