无效的肥皂调用

Invalid Soap Call

为什么这个 soap 调用对这个 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>

因为它们不同:不仅在内容上,而且在命名空间定义上,要更正第一个你至少要使用正确的命名空间,所以使用 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:rootxsd<Definition> 的有效属性,并且 i:type 对于 <word>.

编辑

我使用更正后的请求通过 SOAPUI 调用 http://services.aonaware.com/DictService/DictService.asmx,它正确响应:

<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>

希望这对您有所帮助,