我刚接触SOAP,在使用Savon时遇到了很多麻烦。我尝试访问的API有非常简单的文档:http://www.sona-systems.com/support/docs/sona_api_docs.pdf
在进行调用时,API期望在发送的参数中进行身份验证。下面是我的代码:
client = Savon.client(
wsdl: "https://school.sona-systems.com/services/SonaAPI.svc?singleWsdl",
soap_header: {'To:' => "http://www.sona-systems.com/"},
pretty_print_xml: true,
soap_version: 2
)
response = client.call(:get_study_list) do
message username: "foo", password: "bar"
end
我收到以下错误:
Savon::SOAPFault: (s:Sender) The message with To '' cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher. Check that the sender and receiver's EndpointAddresses agree.
发布于 2014-02-27 03:47:38
soap_header:
应该做什么?
我也无法访问您提供的url。您应该将log: true, log_level: :debug
添加到客户端定义中以获取更多信息。
试试这个:
client = Savon.client(
wsdl: "https://kellogg-elab.sona-systems.com/services/SonaAPI.svc?wsdl",
pretty_print_xml: true,
log: true,
log_level: :debug
)
puts client.operations
# then call a method of the service like this
resp = client.call(:get_study_list,
message: {username: "foo", password: "bar"}
)
https://stackoverflow.com/questions/22049087
复制相似问题