ws-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Janardhanan, Suresh B" <Suresh.Janardha...@duke-energy.com>
Subject CDATA XML String
Date Thu, 19 Jan 2012 19:20:59 GMT
Andreas,

Thanks for your response. You pointed out that the <![CDATA[ section is actually a character
section. But since the soap envelope is getting sent with invalid XML characters the Target
.Net web service is sending a code back, which interprets to invalid XML parameters format.

2012-01-18 13:35:20,422 [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>&lt;![CDATA[&lt;PARAMETERS>&lt;RETURN>&lt;GENERALINFORMATION>&lt;INFORMATIONRETURNTYPEID>3294f665bc644359bfd15824d2efe29c&lt;/INFORMATIONRETURNTYPEID>&lt;/GENERALINFORMATION>&lt;/RETURN>&lt;/PARAMETERS>]]&gt;</sXmlParameters></ns1:RetrieveByParameter></soapenv:Body></soapenv:Envelope>"

Do you know if there is a way to send the XML string as is?

<![CDATA[<PARAMETERS><RETURN><GENERALINFORMATION><INFORMATIONRETURNTYPEID>3294f665bc644359bfd15824d2efe29c</INFORMATIONRETURNTYPEID></GENERALINFORMATION></RETURN></PARAMETERS>]]>

I also tried changing the WSDL type and that resulted in an Exception - CDATA not allowed
in prolog/epilog.

WSDL - 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)

Thanks much for your help,
Suresh


Mime
View raw message