Soap webservice从同一个调用返回不同的响应

时间:2016-10-05 23:07:07

标签: web-services delphi iis soap

我在SOAP中开发了DELPHI服务并在IIS上发布。测试我们发现一些奇怪行为的服务,在我们用错误的参数类型调用操作后,soap响应结构发生了变化。

测试用例很简单,我们称之为简单操作:

Test1_1(i:Integer; var s:string);

调用1(右侧参数类型)

请求:

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:WS_MCH_PrivadosIntf-IWS_MCH_Privados">
   <soapenv:Header/>
   <soapenv:Body>
      <urn:Test1_1 soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <numero xsi:type="xsd:int">1</numero>
      </urn:Test1_1>
   </soapenv:Body>
</soapenv:Envelope>

响应:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 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:Body>
      <Test1_1Response xmlns="urn:WS_MCH_PrivadosIntf-IWS_MCH_Privados">
         <res xmlns="http://www.w3.org/2001/XMLSchema">TEST1_1 OK</res>
      </Test1_1Response>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

调用2(参数类型错误)

请求:

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:WS_MCH_PrivadosIntf-IWS_MCH_Privados">
   <soapenv:Header/>
   <soapenv:Body>
      <urn:Test1_1 soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <numero xsi:type="xsd:int">a</numero>
      </urn:Test1_1>
   </soapenv:Body>
</soapenv:Envelope>

响应:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 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:Body>
      <SOAP-ENV:Fault>
         <faultcode>SOAP-ENV:Server</faultcode>
         <faultstring>'a' is not a valid integer value</faultstring>
         <faultactor/>
      </SOAP-ENV:Fault>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

调用3(正确的参数类型,并在第一次调用时更改响应)

请求:

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:WS_MCH_PrivadosIntf-IWS_MCH_Privados">
   <soapenv:Header/>
   <soapenv:Body>
      <urn:Test1_1 soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <numero xsi:type="xsd:int">1</numero>
      </urn:Test1_1>
   </soapenv:Body>
</soapenv:Envelope>

响应:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 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:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:NS1="urn:WS_MCH_PrivadosIntf-IWS_MCH_Privados">
      <NS1:Test1_1Response>
         <res xsi:type="xsd:string">TEST1_1 OK</res>
      </NS1:Test1_1Response>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

如您所见,第一个呼叫和第三个呼叫完全相同,但响应不同。就像我之前说过的那样,它在使用错误的参数类型调用后会发生变化。 服务的客户在更改后无法识别响应。

有关此行为的任何线索? 我需要服务器始终以相同的方式回答。

1 个答案:

答案 0 :(得分:1)

您需要联系Idera并将测试用例发送给他们。

几个月前我遇到了类似的问题,正如你所描述的那样,我无法解决这个错误。我联系了Idera(Delphi的所有者),并将此报告为VCL错误。

我确实得到了回复并修复了,但我无法与您分享热门修复程序。 (请不要联系我......)

这是Delphi Seattle的热门修复程序或Delphi Berlin的Update 1修复程序。