2017-03-06 16 views
0

私はRailsアプリケーションでSavon gemを使用していますので、フォームフィールドをEquifaxに送信する必要があります。ここでSavon SOAPリクエストが機能しない

はエクイファックスのXMLです:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v3="http://eid.equifax.com/soap/schema/canada/v3"> 
    <soapenv:Header/> 
    <soapenv:Body> 
     <v3:InitialRequest> 
     <v3:Identity> 
      <v3:Name> 
       <v3:FirstName>Michael</v3:FirstName> 
       <v3:LastName>Smith</v3:LastName> 
      </v3:Name> 
      <!--1 to 3 repetitions:--> 
      <v3:Address timeAtAddress="72" addressType="current"> 
       <v3:HybridAddress> 
        <!--1 to 6 repetitions:--> 
        <v3:AddressLine>1028 Summerville</v3:AddressLine> 
        <v3:City>Vancouver</v3:City> 
        <v3:Province>BC</v3:Province> 
        <v3:PostalCode>V7B0A8</v3:PostalCode> 
       </v3:HybridAddress> 
      </v3:Address> 
      <!--Optional:--> 
      <v3:DateOfBirth> 
       <v3:Day>26</v3:Day> 
       <v3:Month>08</v3:Month> 
       <v3:Year>1984</v3:Year> 
      </v3:DateOfBirth> 
      <v3:PhoneNumber phoneType="current"> 
       <v3:PhoneNumber>6045556666</v3:PhoneNumber> 
      </v3:PhoneNumber> 
     </v3:Identity> 
     <v3:ProcessingOptions> 
      <v3:Language>English</v3:Language> 
     </v3:ProcessingOptions> 
     </v3:InitialRequest> 
    </soapenv:Body> 
</soapenv:Envelope> 

これは、SOAPリクエストを作る私のRubyコードです。

<%= client.call(:start_transaction, message: { "v3:InitialRequest" => { "v3:Identity" => { "v3:Name" => { "v3:FirstName" => "michael", "v3:LastName" => "Smith"}, "v3:Address" => {"v3:AddressLine" => "233 Cambie St", "v3:City" => "Vancouve", "v3:Province" => "BC", "v3:PostalCode" => "V6B0E8"}, "v3:DateOfBirth" => {"v3:Day" => "26", "v3:Month" => "08", "v3:Year" => "1984"}, "v3:PhoneNumber" => {"v3:PhoneNumber" => "6048885555"}}}, attributes: { "v3:Address" => { "timeAtAddress" => "72", "addressType" => "current"}}) %> 

返されるエラーメッセージ:(石鹸:クライアント)の読み取りエラーXMLStreamReader内。

誰かが正しい方向に向かうことができますか?

答えて

0

そのXMLの1つの文字列

xml_str = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:v3="http://eid.equifax.com/soap/schema/canada/v3"><soapenv:Header/><soapenv:Body><v3:InitialRequest><v3:Identity><v3:Name><v3:FirstName>Michael</v3:FirstName><v3:LastName>Smith</v3:LastName></v3:Name><!--1 to 3 repetitions:--><v3:Address timeAtAddress="72" addressType="current"><v3:HybridAddress><v3:AddressLine>1028 Summerville</v3:AddressLine><v3:City>Vancouver</v3:City><v3:Province>BC</v3:Province><v3:PostalCode>V7B0A8</v3:PostalCode></v3:HybridAddress></v3:Address><v3:DateOfBirth><v3:Day>26</v3:Day><v3:Month>08</v3:Month><v3:Year>1984</v3:Year></v3:DateOfBirth><v3:PhoneNumber phoneType="current"><v3:PhoneNumber>6045556666</v3:PhoneNumber></v3:PhoneNumber></v3:Identity><v3:ProcessingOptions><v3:Language>English</v3:Language></v3:ProcessingOptions></v3:InitialRequest></soapenv:Body></soapenv:Envelope>' 

client.call(:start_transaction, xml: xml_str) 

あなたがXML文字列を作ったためにhere documentを使用することができますが、文字列は、返信用"\n

+0

おかげconsisいけない覚えておいてくださいを送信することにより、以下の方法を試してみてください。私は "(ns1:InvalidSecurity)を取得しています。ヘッダーの処理中にエラーが検出されました。"私のwsse_authを取っていないと仮定します。クライアント= Savon.client(wsse_auth:["username"、 "password"]、wsdl: "https://ifs-uat.ca.equifax.com/uru/soap/ut/canadav3?wsdl")%> – Michael

+0

I soap_headerを介してセキュリティを渡そうとしましたが、どちらも機能しませんでした。 SOAP_HEADER = { \t \t \t \t "WSSE:セキュリティ" => { \t \t \t \t "@soapenv:でmustUnderstand" => 1、 \t \t \t \t "@xmlns:石鹸" =>「のhttp://スキーマ.xmlsoap.org/wsdl/soap/"、 \t \t \t \t" @xmlns:wsse "=>" http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity -secext-1.0.xsd "、 \t \t \t \t" wsse:UsernameToken "=> { \t \t \t "WSSE:ユーザ名" => "ユーザ名"、 \t \t \t "WSSE:パスワード" => "パスワード"、 \t \t \t "ダイジェスト" =>真 \t \t \t \t} \t \t \t \t} \t \t \t} – Michael

関連する問題