Art*_*huk 5 ruby namespaces savon
使用savon gem,我得到以下请求XML:
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wsdl="URL"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ins0="SOME URL">
<soap:Body>
<ins0:Test xmlns="SOME URL">
</ins0:Test>
</soap:Body>
</soap:Envelope>
Run Code Online (Sandbox Code Playgroud)
但它需要是这样的:
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wsdl="URL"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Test xmlns="SOME URL">
</Test>
</soap:Body>
</soap:Envelope>
Run Code Online (Sandbox Code Playgroud)
通知ins0
已删除.
有什么建议?
这两个 XML 文档是等效的,因此只要该文档由符合 XML 的代理解析,就不应该有任何问题。
Savon 生成的文档只是为“SOME URL”命名空间创建了 ins0 命名空间前缀。这对于包含该命名空间中的许多元素的大型 SOAP 文档来说很方便。在此示例中,前缀并不是真正必要的。
我能看到的唯一潜在问题是 Savion 生成的文档似乎声明了 ins0 命名空间两次 - 一次在soap:Envelope 中,然后再次在soap:Body 中。似乎是多余的并且可能容易出错。
归档时间: |
|
查看次数: |
2377 次 |
最近记录: |