rjx5 has asked for the wisdom of the Perl Monks concerning the following question:
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:Server did not recognize the value of HTTP Header SOAPAction: http://t +empuri.org/#Add.
Here is my Perl code:<?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>
Note: I tried loading the WSDL in SOAPUI tool and the API works fine there.#!/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";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Error calling a simple Soap API using Perl's Soap::Lite
by poj (Abbot) on Oct 10, 2018 at 12:41 UTC | |
by rjx5 (Novice) on Oct 10, 2018 at 22:31 UTC |