SAXException对XML的此块

SAXException对XML的此块

本文介绍了为什么我会得到org.xml.sax.SAXException对XML的此块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我匿名一点这一点。希望它不从有用的信息得出。字符串数组是我觉得我在得到抛出,但我不知道,所以如果我期待在错误的地方,还是让我知道了。

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.

从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 );

和它生成此XML的服务器(感谢Fiddler2):

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>

要我得到这个答复

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

其实就是走出我的SOAP消息格式不正确的? (是的,我使用ASP.NET Web引用来完成所有的吊装,我不能用手生成)

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)

我应该做不同的东西?

我只需要回家睡觉就可以了,明天一切都将只是工作?

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

推荐答案

所以,这个问题的答案是:在WSDL不符合实际的方法做了什么。我不知道这是怎么准确。

So the answer to this question was: the WSDL does not match what the actual method does. I don't know how this is exactly.

有关澄清,该方法有三个字符串,而不是字符串数组,然后两个独立的字符串数组。所以外卖是doublecheck的WSDL是准确的。

For clarification, the method takes an array of three strings, not an array of strings and then two separate strings. So the takeaway is "doublecheck the WSDL is accurate".

这篇关于为什么我会得到org.xml.sax.SAXException对XML的此块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 19:27