Does anyone know how to use Net:HTTP make soap request?

22 views
Skip to first unread message

Fanglu Jiang

unread,
Oct 23, 2014, 1:16:16 AM10/23/14
to rubyonra...@googlegroups.com
Hi 

I am developing code to send XML to a SOAP WebService. 

There function at that end is call checkReceived(arg0,arg1,arg3).

as you can see it has 3 arguments. 

Getting very confused on how to achieve this. Below is my code, and it does not work.


    uri = URI.parse(HZ_RECORD_URL)
    http = Net::HTTP.new(uri.host, uri.port)
    http.use_ssl = false
    operation = "checkReceived"
    data = {
      :arg0 => content_xml_str,
      :arg1 => business_type_str,
      :arg2 => "1"
    }
    headers = {
      'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8',
      'SOAPAction' => '"' + service + '#' + operation + '"',
    }
    response = http.request_post(uri.path, data, headers)

Can anyone help? Thanks in advance

Vivek Sampara

unread,
Oct 23, 2014, 2:09:22 AM10/23/14
to rubyonra...@googlegroups.com
As long as the soap request has the right headers, it should be fine with simple request with text. But i'd recommend using savon, I've used it before. 

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/22110172-90e6-418d-b335-bcd67691ae08%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages