Hello Monks, I am trying to make simple API call (at least that's what I thought initially when I started ) using SOAP::Lite module. I am using one of the publicly available SOAP API here to add two numbers. I am getting following error:
Server did not recognize the value of HTTP Header SOAPAction: http://t +empuri.org/#Add.
I enabled the debug in SOAP::Lite and it seems my request is not formed correctly. I suspect the type specified (xsi:type="xsd:int") in intA and intB is causing issue or the # sign in the SOAPAction (I couldnt find out why and where this is added to the uri) Request from debug:
<?xml version="1.0" encoding="UTF-8"?> <soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soap:Body> <Add xmlns="http://tempuri.org/"> <intA xsi:type="xsd:int">5</intA> <intB xsi:type="xsd:int">10</intB> </Add> </soap:Body> </soap:Envelope>
Here is my Perl code:
#!/usr/bin/env perl use strict; use warnings; use SOAP::Lite; #use SOAP::Lite +trace => 'all'; SOAP::Lite->import(trace => 'debug'); #my $uri = 'http://tempuri.org/'; my $proxy = 'http://www.dneonline.com/calculator.asmx'; my $ns = 'http://tempuri.org/'; my $client = SOAP::Lite ->readable(1) ->uri($ns) ->proxy($proxy); my $param1 = SOAP::Data->name("intA" => $x); my $param2 = SOAP::Data->name("intB" => $y); my $response = $client->Add($param1,$param2); print "Result is $response \n";
Note: I tried loading the WSDL in SOAPUI tool and the API works fine there.

In reply to Error calling a simple Soap API using Perl's Soap::Lite by rjx5

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.