I am having trouble to construct the soap client using savon in rails 3.1. But i am able to successfully get the response when i try to make the request from the curl command line. My curl request from command line look like this
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 response 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 Savon client every time i am getting the
HTTPI executes HTTP POST using the net_http adapter
Timeout::Error: Timeout::Error
My Savon request look like this
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 dont know where i am making the mistake. If anybody help me in this to figure it out. Thanks!