我们正在向.Net 3.5ASMX web服务发送以下请求。
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<Login xmlns="http://tempuri.org/" id="o0" SOAP-ENC:root="1">
<password xsi:type="xsd:string">1234</password>
<userName xsi:type="xsd:string">Developer</userName>
</Login>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope> 在调试web服务时,我们发现web方法(login和method)可用的Parametr值为空。但是,如果我们从密码和用户名中删除字符串“xsd: xsi:type=”属性,一切都会正常工作。
名称空间xsd指向有效的http://www.w3.org/2001/XMLSchema。
为什么.Net不能反序列化响应?为什么不抛出异常呢?顺便说一下:我们的服务定义将http://www.w3.org/2001/XMLSchema别名为"s“。这会是一个问题吗?
致以亲切的问候,
发布于 2009-03-05 11:17:44
.NET序列化程序依赖于底层架构来反序列化内容。当您指定xsi:type属性时,基本上就破坏了模式契约。
顺便说一句。不要使用http://tempuri.org/,使用自己的URI。
发布于 2009-05-16 21:05:57
您的ASMX服务是否使用SoapRpcService属性进行了修饰?如果不是,那么它就是一个文档/文字服务,并且不需要这种格式的XML。
这个XML是如何发送的?它是手工建造的吗?它是由基于从"service.asmx?WSDL“派生的WSDL创建的客户端发送的吗?
https://stackoverflow.com/questions/614176
复制相似问题