开发者

Is this a standard or common encoding for a SOAP request?

开发者 https://www.devze.com 2022-12-10 02:05 出处:网络
I\'m using a web service where the WSDL describes a single string element in each request and response.

I'm using a web service where the WSDL describes a single string element in each request and response.

<s:element name="SERVICE">
  <s:complexType>
    <s:sequence>
      <s:element minOccurs="0" maxOccurs="1" name="SERVICERequest" type="s:string" />
    </s:sequence>
  </s:complexType>
</s:element>

Embedded in that string are a number of plain XML elements that have escaped tags.

<?xml version="1.0" encoding="utf-8"?>
<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>
      <SERVICE xmlns="https://services.transcard.com/">
        &lt;SERVICERequest&gt;
          &lt;SE开发者_运维技巧RVICE_REQ&gt;
            &lt;PARAM_1&gt;
              Value1
            &lt;/PARAM_1&gt;
            &lt;PARAM_2&gt;
              Value2
            &lt;/PARAM_2&gt;
            &lt;PARAM_3&gt;
              Value3
            &lt;/PARAM_3&gt;
          &lt;/SERVICE_REQ&gt;
        &lt;/SERVICERequest&gt;
      </SERVICE>
    </soap:Body>
</soap:Envelope>

This is the format of responses from the service, and is the format expected for incoming requests.

Is this common in SOAP interfaces? In practice, it causes the inner parameters to be inaccessible to the SOAP library I'm using. (soap4r) Any feedback from SOAP veterans is appreciated.


No. That's not common.

That completely disregards using an actual schema (which defines the data type being returend) and replaces it with a giant string that you're going to have to parse once you get the response.

...Terrible.

0

精彩评论

暂无评论...
验证码 换一张
取 消