简体   繁体   English

为什么我得到这个XML块的org.xml.sax.SAXException?

[英]Why am I getting org.xml.sax.SAXException for this block of 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. stringARRAY是我认为我被抛出的地方,但我不确定,所以如果我看错了地方,lemme就知道了。

From the WSDL 来自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生成到服务器(感谢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) (是的,我使用ASP.NET Web引用来完成所有提升,我不是手工生成)

Should I be doing something different? 我应该做些不同的事吗?

Do I just need to go home and sleep on it and tomorrow everything will "just work"? 我只需要回家睡觉就明天一切都会“正常工作”吗?

So the answer to this question was: the WSDL does not match what the actual method does. 所以这个问题的答案是:WSDL与实际方法的作用不匹配。 I don't know how this is exactly. 我不知道这究竟是怎么回事。

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". 所以外卖是“双重检查WSDL是准确的”。

I'm guessing it has to do with namespaces not being treated properly. 我猜它与命名空间没有被正确对待有关。

I always find it helpful to cut & paste the error messages I get into Google and see if someone else has had the same problem. 我总是发现它有助于剪切和粘贴错误消息我进入谷歌 ,看看是否有其他人有同样的问题。 I don't always find an answer, but I usually learn that I'm neither alone nor the first. 我并不总能找到答案,但我通常知道我既不是孤独的,也不是第一个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在ASP.Net中使用SOAP:org.xml.sax.SAXException:…找不到类型的反序列化器 - consuming SOAP in ASP.Net: org.xml.sax.SAXException: …could not find deserializer for type 为什么我没有得到XML值 - Why am I not Getting the XML Values 为什么我在有效的XML上获得XmlException? - Why am I getting an XmlException on valid XML? 为什么使用 LINQ to XML 会得到额外的 xmlns=&quot;&quot;? - Why am I getting the extra xmlns=“” using LINQ to XML? org.xml.sax.SAXParseException:字符引用“&#x0”是无效的XML字符 - org.xml.sax.SAXParseException: Character reference “&#x0” is an invalid XML character 为什么在尝试从XML文件读取数据时出现Null Referenfe异常? - Why am I getting Null Referenfe exception while trying to read data from XML file? 我在尝试XML序列化对象时遇到错误 - I am getting an error when trying to XML serialize an object 即使XML格式正确,我也得到了一个空的XmlNodeList - I am getting an empty XmlNodeList eventhough XML is wellformed xml反序列化-我正在使用具有属性的某些节点获得0项 - xml deserialization - I am getting 0 item with some node that has attribute org.xml.sax.SAXParseException:在.net中使用服务时,prolog中不允许使用内容 - org.xml.sax.SAXParseException: Content is not allowed in prolog when consuming service in .net
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM