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/soaptest6.pl
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"?>
<soapenv:Envelope
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:impl="http://impl.webservice.acts.ito.aoc.nj"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<impl:getCodes>
<codeTable xsi:type="xsd:string">STATE_CODES</codeTable>
</impl:getCodes>
</soapenv:Body>
</soapenv:Envelope>
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-Peer: 192.168.248.33:2001
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='http://schemas.xmlsoap.org/soap/envelope/'>
<env:Body>
<env:Fault>
<faultcode>env:Client</faultcode>
<faultstring>Internal Error</faultstring>
</env:Fault>
</env:Body>
</env:Envelope>
<?xml version='1.0' ?>
<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
<env:Body>
<env:Fault>
<faultcode>env:Client</faultcode>
<faultstring>Internal Error</faultstring>
</env:Fault>
</env:Body>
</env:Envelope>
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.