7

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!

Vivek Parihar
  • 2,318
  • 18
  • 18
  • have you tried to set the timeout to a bigger number? You might want to look into this question http://stackoverflow.com/questions/6384230/how-to-set-savon-default-timeout-value – Steffen Roller Jun 29 '12 at 18:17

1 Answers1

0

This may be soap server issue try to comment line:

http.headers = { "Content-Length" => "0", "Connection" => "Keep-Alive" }
rogal111
  • 5,874
  • 2
  • 27
  • 33