2015-10-22 102 views
0

爲什麼這個肥皂呼叫不能用於這個URL?肥皂呼叫無效

http://services.aonaware.com/DictService/DictService.asmx?op=Define

<v:Envelope xmlns:i="http://www.w3.org/1999/XMLSchema-instance" xmlns:d="http://www.w3.org/1999/XMLSchema" xmlns:c="http://schemas.xmlsoap.org/soap/encoding/" xmlns:v="http://schemas.xmlsoap.org/soap/envelope/"> 
    <v:Header /> 
    <v:Body> 
     <Define xmlns="http://tempuri.org/" id="o0" c:root="1"> 
      <word i:type="d:string">Name</word> 
     </Define> 
    </v:Body> 
</v:Envelope> 

但是這一次確實

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://services.aonaware.com/webservices/"> 
    <soapenv:Header/> 
    <soapenv:Body> 
     <web:Define> 
     <!--Optional:--> 
     <web:word>Test</web:word> 
     </web:Define> 
    </soapenv:Body> 
</soapenv:Envelope> 

回答

1

因爲它們是不同的:不僅在內容上,而且在命名空間定義,以糾正您對至少應第一個使用正確的命名空間,因此您可以使用http://services.aonaware.com/webservices/作爲您的<Define>元素,就像您在第二個元素中一樣:

<v:Envelope xmlns:i="http://www.w3.org/1999/XMLSchema-instance" xmlns:d="http://www.w3.org/1999/XMLSchema" xmlns:c="http://schemas.xmlsoap.org/soap/encoding/" xmlns:v="http://schemas.xmlsoap.org/soap/envelope/"> 
    <v:Header /> 
    <v:Body> 
     <Define xmlns="http://services.aonaware.com/webservices/" id="o0" c:root="1"> 
      <word i:type="d:string">Name</word> 
     </Define> 
    </v:Body> 
</v:Envelope> 

然後請確保idc:root是您的xsd<Definition>i:type的有效屬性,這對於<word>是正確的。

編輯

使用我更正請求調用http://services.aonaware.com/DictService/DictService.asmx與SOAPUI,它響應正確:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
    <soap:Body> 
     <DefineResponse xmlns="http://services.aonaware.com/webservices/"> 
     <DefineResult> 
      <Word>Name</Word> 
      <Definitions> 
       <Definition> 
        <Word>Name</Word> 
        <Dictionary> 
        <Id>gcide</Id> 
        <Name>The Collaborative International Dictionary of English v.0.44</Name> 
        </Dictionary> 
        <WordDefinition>Name \Name\ (n[=a]m), n. [AS. nama; akin to D. naam, OS. &amp; OHG. 
    ... 
      [1913 Webster]</WordDefinition> 
       </Definition> 
       <Definition> 
        <Word>Name</Word> 
        <Dictionary> 
        <Id>gcide</Id> 
        <Name>The Collaborative International Dictionary of English v.0.44</Name> 
        </Dictionary> 
        <WordDefinition>Name \Name\ (n[=a]m), v. t. [imp. &amp; p. p. {Named} (n[=a]md); p. 
    ... 
       </WordDefinition> 
       </Definition> 
      </Definitions> 
     </DefineResult> 
     </DefineResponse> 
    </soap:Body> 
</soap:Envelope> 

希望這有助於