繁体   English   中英

在WCF SOAP消息中删除其他名称空间定义

[英]Removing additional namespace definition in WCF SOAP message

我有这个WSDL(服务不是我的): http//soaptest.webapi-beta.gratka.pl/dom.html?wsdl

当我使用WCF生成的代理时,请求soap消息中的方法标记获得额外的命名空间定义,如:

<q1:zaloguj xmlns:q1="http://soaptest.webapi-beta.gratka.pl/dom.html">

当我使用PHP或wsdl.exe生成的代理时,这不会发生。

我想问一下,为什么WCF会这样做,并且有可能改变这种行为(不在BeforeSendRequest中使用手工修改的消息)

下面我粘贴PHP和WCF生成的消息:

PHP一:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://soaptest.webapi-beta.gratka.pl/dom.html" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <SOAP-ENV:Body>
        <ns1:zaloguj>
            <login xsi:type="xsd:string">login</login>
            <haslo xsi:type="xsd:string">password</haslo>
            <klucz_webapi xsi:type="xsd:string">key</klucz_webapi>
            <id_kategoria xsi:type="xsd:int">382a</id_kategoria>
            <wersja_webapi xsi:type="xsd:int">2</wersja_webapi>
        </ns1:zaloguj>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

WCF一:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <q1:zaloguj xmlns:q1="http://soaptest.webapi-beta.gratka.pl/dom.html">
            <login xsi:type="xsd:string">login</login>
            <haslo xsi:type="xsd:string">password</haslo>
            <klucz_webapi xsi:type="xsd:string">key</klucz_webapi>
            <id_kategoria xsi:type="xsd:int">382</id_kategoria>
            <wersja_webapi xsi:type="xsd:int">2</wersja_webapi>
        </q1:zaloguj>
    </s:Body>
</s:Envelope> 

你有任何问题吗? 就xml而言,两者都是等价的。 PHP代码在根元素处声明命名空间( xmlns:ns1="http://soaptest.webapi-beta.gratka.pl/dom.html" ),而WCF在需要它的地方声明 - 我相信这就是WSDL的实现 - 它似乎没有任何错误。

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM