SAVON v2. authentication issue

437 views
Skip to first unread message

Artem Tambovskiy

unread,
Feb 7, 2014, 7:59:56 AM2/7/14
to sav...@googlegroups.com
Hello All,

I'm trying to rebuild using SAVON v2 some old SOAP code which was using SOAP4R gem. And I got stuck at very beginning :(
I can't even pass digest authentication and receiving HTTP 403 all the time.

The credentials are correct as 'curl https://peakflow-int.telia.net/soap/sp -k -3 --digest -u user:password' gives no errors here.

Can anyone advise me that can be the issue here?

Thank you in advance!
Regards,
Artem

require 'savon'
require 'httpclient'

HTTPI.adapter = :httpclient
 client = Savon.client do
   wsdl './PeakflowSP.wsdl'
   endpoint 'https://peakflow-int.telia.net/soap/sp'
   ssl_verify_mode :none
   ssl_version :SSLv3
   convert_request_keys_to :none
   pretty_print_xml true
   log true
   log_level :debug
   digest_auth("user","password")
 end

rqst = (<<__XML__)
<?xml version="1.0" encoding="utf-8"?>
<peakflow version="1.0">
 <query id="query1" type="traffic">
  <time start_ascii="10 days ago" end_ascii="now"/>
  <unit type="bps_snmp"/>
  <search limit="2000"/>
  <filter type="router">
    <instance name="router_name"/>
  </filter>
  <filter type="interface" binby="1"/>
 </query>
</peakflow>
__XML__

response = client.call(:run_xml_query, message: { :query => rqst} )

Here is some debug output

I, [2014-02-07T16:51:13.700631 #20838]  INFO -- : SOAP request: https://peakflow-int.telia.net/soap/sp
I, [2014-02-07T16:51:13.700851 #20838]  INFO -- : SOAPAction: "urn:PeakflowSPAction", Content-Type: text/xml;charset=UTF-8, Content-Length: 885
D, [2014-02-07T16:51:13.701199 #20838] DEBUG -- : <?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="urn:PeakflowSP" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
  <env:Body>
    <tns:runXmlQuery>
      <query>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;peakflow version="1.0"&gt;
 &lt;query id="query1" type="traffic"&gt;
  &lt;time start_ascii="10 days ago" end_ascii="now"/&gt;
  &lt;unit type="bps_snmp"/&gt;
  &lt;search limit="2000"/&gt;
  &lt;filter type="router"&gt;
    &lt;instance name="router_name"/&gt;
  &lt;/filter&gt;
  &lt;filter type="interface" binby="1"/&gt;
 &lt;/query&gt;
&lt;/peakflow&gt;
</query>
      <output_format>xml</output_format>
    </tns:runXmlQuery>
  </env:Body>
</env:Envelope>

D, [2014-02-07T16:51:13.701760 #20838] DEBUG -- : HTTPI POST request to peakflow-int.telia.net (httpclient)
at depth 1 - 19: self signed certificate in certificate chain
I, [2014-02-07T16:51:14.042514 #20838]  INFO -- : SOAP response (status 403)

.....

/home/arta00/.rvm/gems/ruby-2.1.0/gems/savon-2.3.3/lib/savon/response.rb:86:in `raise_soap_and_http_errors!': HTTP error (403): <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> (Savon::HTTPError)

Artem Tambovskiy

unread,
Feb 10, 2014, 8:18:55 AM2/10/14
to sav...@googlegroups.com
Ok, I figured our that was wrong. I have HTTP Proxy in the network, and HTTPClient is trying to use the same proxy for HTTPS requests by default.
Is there any way to overide this behavior? In Savon v1 that was possible to set by http.proxy/no_proxy. Savon v2 doesn't seem to have such functionality?
Reply all
Reply to author
Forward
0 new messages