这两个 SOAP 请求有什么区别?
我正在向 SOAP API 发送请求,不幸的是我对 SOAP 的了解有限。以下两个请求都返回响应,但响应不同。不起作用的示例仅返回 send_fax_response。该工作返回send_fax_response和send_fax_result。有什么想法吗?会不会是订单?
不工作
SOAP request: https://faxregistration.com/SfaxWS/SfaxAPI.asmx
SOAPAction: "http://tempuri.org/sendFax", Content-Type: text/xml;charset=UTF-8, User-Agent: sfax-api gem 0.0.1
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:wsdl="http://tempuri.org" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ins0="http://tempuri.org/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Body>
<ins0:sendFax>
<ins0:xDoc>
<FaxRequest>
<DocMerge>false</DocMerge>
<RecipientFax>555.123.4567</RecipientFax>
<Password>test</Password>
<UserId>test</UserId>
<image>PGh0bWw+PGJvZHk+VGVzdCBGYXg8L2JvZHk+PC9odG1sPg==</image>
<DocType>html</DocType>
<RecipientName>test</RecipientName>
</FaxRequest>
</ins0:xDoc>
</ins0:sendFax>
</env:Body>
</env:Envelope>
工作
SOAP request: https://faxregistration.com/SfaxWS/SfaxAPI.asmx
SOAPAction: "http://tempuri.org/sendFax", Content-Type: text/xml;charset=UTF-8, User-Agent: sfax-api gem 0.0.1
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<sendFax xmlns="http://tempuri.org/">
<xDoc>
<FaxRequest>
<UserId>test</UserId>
<Password>test</Password>
<RecipientName>test</RecipientName>
<RecipientFax>555.123.4567</RecipientFax>
<DocType>html</DocType>
<image>PGh0bWw+PGJvZHk+VGVzdCBGYXg8L2JvZHk+PC9odG1sPg==</image>
<DocMerge>false</DocMerge>
</FaxRequest>
</xDoc>
</sendFax>
</soap:Body>
</soap:Envelope>
I am sending a request to a SOAP API and unfortunately my knowledge of SOAP is limited. The following two requests both return a response but the response differs. The not working example returns a send_fax_response only. The working returns a send_fax_response and a send_fax_result. Any ideas as to why? Could it be the order?
Not working
SOAP request: https://faxregistration.com/SfaxWS/SfaxAPI.asmx
SOAPAction: "http://tempuri.org/sendFax", Content-Type: text/xml;charset=UTF-8, User-Agent: sfax-api gem 0.0.1
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:wsdl="http://tempuri.org" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ins0="http://tempuri.org/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Body>
<ins0:sendFax>
<ins0:xDoc>
<FaxRequest>
<DocMerge>false</DocMerge>
<RecipientFax>555.123.4567</RecipientFax>
<Password>test</Password>
<UserId>test</UserId>
<image>PGh0bWw+PGJvZHk+VGVzdCBGYXg8L2JvZHk+PC9odG1sPg==</image>
<DocType>html</DocType>
<RecipientName>test</RecipientName>
</FaxRequest>
</ins0:xDoc>
</ins0:sendFax>
</env:Body>
</env:Envelope>
Working
SOAP request: https://faxregistration.com/SfaxWS/SfaxAPI.asmx
SOAPAction: "http://tempuri.org/sendFax", Content-Type: text/xml;charset=UTF-8, User-Agent: sfax-api gem 0.0.1
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<sendFax xmlns="http://tempuri.org/">
<xDoc>
<FaxRequest>
<UserId>test</UserId>
<Password>test</Password>
<RecipientName>test</RecipientName>
<RecipientFax>555.123.4567</RecipientFax>
<DocType>html</DocType>
<image>PGh0bWw+PGJvZHk+VGVzdCBGYXg8L2JvZHk+PC9odG1sPg==</image>
<DocMerge>false</DocMerge>
</FaxRequest>
</xDoc>
</sendFax>
</soap:Body>
</soap:Envelope>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我注意到的第一件事是,您的请求的第一行在“不工作”示例中是
env:Envelope
,在“工作”示例中是soap:Envelope
。除此之外,该标签还缺少一些属性。它们可能很重要,但我认为是外部元素的命名导致了损坏。
First thing I notice is that the first line of your request is
env:Envelope
in the "Not Working" example andsoap:Envelope
in the "Working" example.Aside from that, there's a couple of attributes that are also missing from this tag. They could be important, but I reckon it's the naming of that outer element which is causing the breakage.
我认为您的肥皂服务器期望正文,即
具有 http://tempuri。 org 元素内定义的命名空间。如果是,更改 not_working 肥皂请求中的正文也可能有效。I think your soap server expects the the body, i.e.,
<sendFax>
to have http://tempuri.org namespace defined within the element. If it is, changing body in the not_working soap request may also work.我正在使用 Savon for Rails。我的 SOAP 请求总是失败,我注意到工作示例具有 soap:Envelope,而我生成的请求具有 env:Envelope。
如何将我的不工作 SOAP 请求转换为工作 SOAP 请求?
请帮忙:)
i'm using Savon for Rails. My SOAP request always fails and I noticed that the working example is having soap:Envelope while my generated request has env:Envelope.
How can I make my not-working SOAP request into a working SOAP request?
Help please :)