PerlMASA has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to call a Soap Webservice.I have to pass the name of a Code table (for eg STATE_CODES) and it returns key value pair like NY - New york, DE-Delaware etc.

#!/usr/local/bin/perl use strict; use warnings; use Data::Dumper qw<Dumper>; #use SOAP::Lite trace=>'all'; use SOAP::Lite +trace =>'debug'; #use SOAP::Lite; $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME}=0; use Data::Dumper; $Data::Dumper::Terse = 1; $Data::Dumper::Indent = 1; #my $wsdl = 'https://dev1:2001/ACTS?wsdl'; my $endpoint = 'https://qa1:2001/ACTS'; my $wsdl = 'HTTPS://QA1:2001/ACTS?wsdl'; my $method_name = 'impl:getCodes'; my $uri = 'http://impl.webservice.acts.ito.aoc.nj'; my $ns = 'http://impl.webservice.acts.ito.aoc.nj'; my $client = SOAP::Lite->new( proxy=>$endpoint, service=>$wsdl, readable=>1 ); $client->outputxml(1); $client->envprefix('soapenv'); $client->ns($uri,'impl'); $client->outputxml('true'); my @param; push @param, SOAP::Data->name("codeTable"=>'STATE_CODES'); my $soapResp = $client->call($method_name,@param); print $soapResp; print "\n";

output is as below
root@np1 ~# perl /test/
SOAP::Transport::HTTP::Client::send_receive: POST https://qa1:2001/ACTS HTTP/1.1
Accept: text/xml
Accept: multipart/*
Accept: application/soap
Content-Length: 580
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://impl.webservice.acts.ito.aoc.nj#getCodes"

<?xml version="1.0" encoding="UTF-8"?>
<codeTable xsi:type="xsd:string">STATE_CODES</codeTable>
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Error
Connection: close
Content-Type: text/xml; charset=utf-8
Client-Date: Sat, 24 Oct 2020 02:46:04 GMT
Client-Response-Num: 1
Client-SSL-Cert-Issuer: /CN=qa1
Client-SSL-Cert-Subject: /CN=qa1
Client-SSL-Cipher: ECDHE-RSA-AES256-GCM-SHA384
Client-SSL-Socket-Class: IO::Socket::SSL
Client-SSL-Warning: Peer certificate not verified
X-Backside-Transport: FAIL FAIL

<?xml version='1.0' ?>
<env:Envelope xmlns:env=''>
<faultstring>Internal Error</faultstring>
<?xml version='1.0' ?>
<env:Envelope xmlns:env=''>
<faultstring>Internal Error</faultstring>

The soap request kind of looks good, but it gives error. I pasted the soap request into SOAPUI from the soapActionand it worked.

Why is my soap request resulting in failure. is it because of some certificate issue. i believe i have asked the code to skip certificate validation and Client-SSL-Warning: Peer certificate not verified in output above is just a warning and can be ignored

Is the line between getCodes" and <?xml version="1.0"... in soapAction causing failure. The request failed in SOAPUI if I added a line before the <?xml version="1.0"...

if it helps, the soap webservice is a java application on websphere and it is being accessed by perl through datapower.

Replies are listed 'Best First'.
Re: Soap Call fails
by jo37 (Friar) on Oct 24, 2020 at 07:21 UTC

    If the same request is working in SoapUI, then look at the headers sent with the request. Make sure you're using the same with your request from Perl.
    Also check if a client certificate is requested and provided by SoapUI.
    It would be very helpful to see the error on the server side, too.


      Double checking if my server is getting request or not