2013-01-10 153 views
0

我有了这个WSDL删除其他命名空间定义(服务是不是我的):http://soaptest.webapi-beta.gratka.pl/dom.html?wsdl在WCF SOAP消息

当我使用WCF生成的代理的请求SOAP消息的方法标签获取额外的命名空间定义,如:

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

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

我想问一下,为什么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> 

回答

2

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

+0

是的,不幸的是webservice是一块废话,并返回505与肥皂故障与消息'元'{http://soaptest.webapi-beta.gratka.pl/dom.html}zaloguj':没有匹配的全球声明可用验证根。 – user1121956

+0

当我手动将名称空间定义从方法标记移动到BeforeSendRequest中的body标记时,它的作用是 – user1121956

+0

@ user1121956,我实际上会建议解决方法 - 修改生成的soap消息。它不漂亮,但... – VinayC