开发者

How do I create a Ruby SOAP client without using a WSDL?

I need to write a soap client that is capab开发者_运维百科le of sending and receiving soap messages.

This soap service does not have an associated WSDL file and soap4r and savon both seem to require one.

I have an example of what I need to do in Java, see the link below.

http://community.cecid.hku.hk/index.php/product/article/writing_hermes_2_ws_client_under_java/#ebms-2_0-sender-ws

I could use java for this, at this point it seems like it would be easier. However I personally prefer coding in ruby and our company has more ruby resources than java.

Can anyone confirm thats its possible to do something similar to java example in ruby without writing my own specialised soap library?. I need to be able to send a payload, which I believe is usually in the form of a soap attachment.

I am particularly interested in seeing soap4r examples that don't use a WSDL as I have had trouble finding any with google.

Any help much appreciated.


as of Savon v2, the syntax is slightly different

client = Savon.client do
  endpoint "http://example.com"
  namespace "http://v1.example.com"
end

http://savonrb.com/version2/client.html


Savon does not require a WSDL document. Please take a look at the new documentation. If you know the SOAP endpoint and target namespace, you can execute a SOAP request like this:

client = Savon::Client.new
  wsdl.endpoint = "http://example.com"
  wsdl.namespace = "http://soap.example.com"
end

client.request :any_soap_action do
  soap.body = { :do => "something" }
end


client = Savon::Client.new
  wsdl.endpoint = "http://example.com"
  wsdl.namspace = "http://soap.example.com"
end

This does not work, it misses a the block name and the "e" in namespace:

client = Savon::Client.new do | wsdl |
  wsdl.endpoint = "http://example.com"
  wsdl.namespace = "http://soap.example.com"
end
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜