XML 文档(2, 309)中有错误。未经处理的异常在 System.Xml.dll 中发生 。
最近在学习WCF,项目要用WCF做服务端。但WCF不仅仅是服务端,因为也会调用gsoap生成的C++客户端里的一些函数,所以现在的状态是WCF和C++互为服务端和客户端。
问题出在WCF远程调用C++的"math"函数时,想传入2个int型(x和y),返回3个字符串,抓包看到传入和返回都没问题,但是WCF停在这里的this.Invoke这句:
public stringarray math(int x, int y) {
object[] results = this.Invoke("math", new object[] {x, y});
return ((stringarray)(results[0]));
提示:
“System.InvalidOperationException”类型的未经处理的异常在 System.Xml.dll 中发生。
其他信息: XML 文档(2, 309)中有错误。
实际上返回的xml包是没问题的:
<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ns2="urn:dslforum-org:cwmp-1-1">
<SOAP-ENV:Body>
<ns2:mathResponse>
<result SOAP-ENC:arrayType="xsd:string[3]" xsi:type="SOAP-ENC:Array">
<string>GetRPCMethods</string>
<string>GetParameterValues</string>
<string>SetParameterValues</string>
</result>
</ns2:mathResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
前面还试过,传入两个int值,返回两个int值,是可以的。请问前辈们,这种问题该如何处理?