2013-01-10 147 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