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

I am a little anonymous. Hope this doesn't detract from the helpful post. stringARRAY is the place where I think they throw me, but I'm not sure, therefore, if I look for the wrong place, I know that I know.

From 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> 

The actual method call is as follows:

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

And it generates this XML 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> 

Why am I getting this answer

 <?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 incorrect? (yes, I use ASP.NET web links to complete the whole upgrade, I do not create manually)

Should I do something else?

I just need to go home and sleep on it, and tomorrow everything will be "just working"?

+4
source share
2 answers

So the answer to this question is: WSDL does not match what the real method does. I don’t know how exactly that is.

For clarification, the method accepts an array of three strings, not an array of strings, and then two separate strings. Thus, the removal of "double mark WSDL is accurate."

+4
source

I assume this is due to namespace mishandling.

It’s always useful for me to cut and paste the error messages I get on Google and see if anyone else had the same problem. I do not always find the answer, but usually I find out that I am neither one nor the first.

0
source

Source: https://habr.com/ru/post/1309494/


All Articles