Why am I getting org.xml.sax.SAXException for this block of XML?

Posted by drachenstern on Stack Overflow See other posts from Stack Overflow or by drachenstern
Published on 2010-05-12T00:44:09Z Indexed on 2010/05/12 0:54 UTC
Read the original article Hit count: 300

Filed under:
|
|
|
|

I've anonymised a bit of this. Hopefully it doesn't detract from the useful message. stringARRAY is where I think I'm getting thrown at, but I'm not sure, so if I'm looking at the wrong place, lemme know.

From the WSDL

  <xsd:element name="LongishOpName">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element maxOccurs="unbounded" name="stringARRAY" type="xsd:string" />
        <xsd:element name="stringfield1" type="xsd:string" />
        <xsd:element name="stringfield2" type="xsd:string" />
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>

Actual method call looks like this:

string originalValue = "some useful value";
string[] usefulName1 = new[] { originalValue };
service.response[] responses = server.LongishOpName( usefulName1, someString1, someString2 );

And it generates this XML to the server (Thanks to Fiddler2):

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <LongishOpName xmlns="http://appropriate-namespace">
      <stringARRAY>114003</stringARRAY>
      <stringfield1>a string</stringfield1>
      <stringfield2>a string</stringfield2>
    </LongishOpName>
  </soap:Body>
</soap:Envelope>

To which I get this response

<?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>
    <soapenv:Fault>
      <faultcode>soapenv:Server.userException</faultcode>
      <faultstring>org.xml.sax.SAXException: Found character data inside an array element while deserializing</faultstring>
      <detail>
        <ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">SERVERNAME</ns1:hostname>
      </detail>
    </soapenv:Fault>
  </soapenv:Body>
</soapenv:Envelope>

Is my soap message actually coming out malformed? (yes I am using the ASP.NET web references to do all the lifting, I'm not generating by hand)

Should I be doing something different?

Do I just need to go home and sleep on it and tomorrow everything will "just work"?

© Stack Overflow or respective owner

Related posts about Xml

Related posts about soap