I am having trouble creating a soap client using savon in rails 3.1. But I can successfully get the answer when I try to make a request from the curl command line. My curl request from the command line is as follows
curl -d @Downloads/test.xml -H "content-type: text/xml;charset=UTF-8" -H "SOAPAction: http://services.bamnetworks.com/registration/identityPoint/create" "https://qaservices.bamnetworks.com/ws/services/IdentityPointService" -v
From which I got a perfect answer like this.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header /><soapenv:Body><identityPoint_create_response xmlns="http://services.bamnetworks.com/registration/types/1.6"><status><code>-2000</code><message> [Duplicate credential constraint violated] [com.bamnetworks.registration.types.exception.DuplicateCredentialException]</message><exceptionClass>com.bamnetworks.registration.types.exception.DuplicateCredentialException</exceptionClass>
But when I try to make a request from the Savon client every time I get
HTTPI executes HTTP POST using the net_http adapter Timeout::Error: Timeout::Error
My Savon request is as follows
client = Savon::Client.new do |wsdl, http| http.auth.ssl.verify_mode = :none wsdl.document = "https://qaservices.bamnetworks.com/ws/services/IdentityPointService?wsdl" end begin response = client.request :ns, :identityPoint_create_request do |soap, wsdl, http| http.headers['SOAPAction'] = 'http://services.bamnetworks.com/registration/identityPoint/create' http.headers = { "Content-Length" => "0", "Connection" => "Keep-Alive" } soap.namespaces["xmlns:ns0"]="http://services.bamnetworks.com/application/types/1.0" soap.header = { "ns0:appCredentials" => { "ns0:name"=>"XXXXXXX", "ns0:password"=>"XXXXXXXXX" } } soap.body ={ :identification => { :email => { :address => " mlb_user@mlb.com " }, :password => { :address => { :id => 44 } } }, :profileProperty => { :name => "birthDay", :value => "17" }, :profileProperty => { :name => "birthMonth", :value => "8" }, :profileProperty => { :name => "birthYear", :value => "1986" }, :attributes! => { :identification => { :type => "email-password" } } } end
I do not know where I am making a mistake. If anyone helps me figure this out. Thanks!
Vivek parihar
source share