这是 SOAP 请求的标准或通用编码吗?
我正在使用一个 Web 服务,其中 WSDL 在每个请求和响应中描述单个字符串元素。
<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>
该字符串中嵌入了许多带有转义标签的纯 XML 元素。
<?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/">
<SERVICERequest>
<SERVICE_REQ>
<PARAM_1>
Value1
</PARAM_1>
<PARAM_2>
Value2
</PARAM_2>
<PARAM_3>
Value3
</PARAM_3>
</SERVICE_REQ>
</SERVICERequest>
</SERVICE>
</soap:Body>
</soap:Envelope>
这是服务响应的格式,也是传入请求的预期格式。
这在 SOAP 接口中常见吗?实际上,它会导致我正在使用的 SOAP 库无法访问内部参数。 (soap4r) 感谢 SOAP 资深人士的任何反馈。
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/">
<SERVICERequest>
<SERVICE_REQ>
<PARAM_1>
Value1
</PARAM_1>
<PARAM_2>
Value2
</PARAM_2>
<PARAM_3>
Value3
</PARAM_3>
</SERVICE_REQ>
</SERVICERequest>
</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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,这并不常见。
这完全忽略了使用实际的模式(它定义了返回的数据类型),并将其替换为一个巨大的字符串,一旦收到响应,您就必须解析该字符串。
...糟糕的。
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.