web-services – Soap webservice从同一个调用返回不同的响应

我有一个在DELPHI中开发并在IIS上发布的SOAP服务.测试我们发现一些奇怪行为的服务,在我们调用错误参数类型的操作后,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>

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

关于这种行为的任何线索?
我需要服务器始终以相同的方式回答.

最佳答案 您需要联系Idera并将测试用例发送给他们.

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

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

这是Delphi Seattle的热门修复或Delphi Berlin的Update 1修复.

点赞