CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: General Discussions: General Questions:
Accessing results from SOAP call...using XML::Compile:SOAP11

 



hubascuba
New User

Mar 18, 2016, 11:37 AM

Post #1 of 1 (3200 views)
Accessing results from SOAP call...using XML::Compile:SOAP11 Can't Post

Hello everyone. I'm sure the answer is simple.. but I can't figure it out..

If I use SOAP::Lite, I can just reference the returned confidence value using ...valueof("//confidence"). That works, but when I start trying to use other script (non roman), it dies...

So I switched to XML::Compile::SOAP11... Now I can use the different scripts and get the results (see output)... but for the life of me I don't know how to access the data returned! I feel like an idiot, but I need help.

I have included the code, and the output from the prints and dumps...
ANY ideas will be appreciated.

Here is the code I am running

Code
use strict; 

use XML::Compile::SOAP11;
use XML::Compile::WSDL11;
use XML::Compile::Transport::SOAPHTTP;
use Data::Dumper;
$Data::Dumper::Indent=1;

# Chunk size for getting results
# my $chunkSize = 50;

# Query details
my $inFn='John Smith';

# EB-eye WSDL URL
my $WSDL = 'http://iivmware:14500/NameWorksScoring/services/ScoringWebServiceSEIPort?wsdl';

# Create service proxy for web service
my $wsdlXml = XML::LibXML->new->parse_file($WSDL);
my $soapSrv = XML::Compile::WSDL11->new($wsdlXml);

my $GNMAFS = $soapSrv->compileClient('analyzeForSearch');
my $GNMS = $soapSrv->compileClient('search');

# Call specific Webservice
my ($GNM_ANALYZE_RESULT, $trace ) = $GNMAFS->(
parameters => {
name => $inFn,
alternateThreshold => '65',
}
);
if ( $GNM_ANALYZE_RESULT->{'Fault'} ) {
die "Server fault: " . $GNM_ANALYZE_RESULT->{'Fault'}->{'faultstring'};
}

print Dumper $GNM_ANALYZE_RESULT;
print "\n\n ------------------------- \n";

my $test1 = $GNM_ANALYZE_RESULT->{'analyzeForSearchResponse'}->{'result'}->{'confidence'};
my $test2 = $GNM_ANALYZE_RESULT->{'result'}->{'confidence'};
my $test3 = $GNM_ANALYZE_RESULT->{'confidence'};
my $test4 = $GNM_ANALYZE_RESULT->{'result'}{'confidence'};
my $test5 = $GNM_ANALYZE_RESULT->{result}{confidence};
my $test6 = $GNM_ANALYZE_RESULT->{confidence};
my $test7 = $GNM_ANALYZE_RESULT->{'confidence'};
my $test8 = $GNM_ANALYZE_RESULT->{'analyzeForSearchResponse'}{'result'}{'confidence'};

print " test1: ".$test1."\n";
print " test2: ".$test2."\n";
print " test3: ".$test3."\n";
print " test4: ".$test4."\n";
print " test5: ".$test5."\n";
print " test6: ".$test6."\n";
print " test7: ".$test7."\n";
print " test8: ".$test8."\n";

print "\n\n ------------------------- \n";
my $pete1 = $GNM_ANALYZE_RESULT->{result};
my $test9=$pete1->{'confidence'};

print " test9: ".$test9."\n";
print " pete1: ".$pete1."\n";
print "\n\n ------------------------- \n";
# $trace->printTimings;
$trace->printRequest;
$trace->printResponse;

exit;

#################################

here is the output I get when I run this:

Code
c:\Temp>perl nonlitews.pl 
$VAR1 = {
'result' => {
'result' => [
{
'qualifiers' => '',
'givenNameCultureSetInt' => '2',
'alternate' => 0,
'givenNameCultureInt' => 1,
'scriptTypeInt' => 0,
'confidence' => 98,
'surnameCultureInt' => 1,
'surnameCultureSetInt' => '2',
'titles' => '',
'categoriesInt' => 1,
'nameCultureSetInt' => '2',
'givenName' => 'JOHN',
'originalGivenName' => '',
'name' => 'JOHN SMITH',
'originalSurname' => 'John Smith',
'surname' => 'SMITH',
'nameCultureInt' => 1
}
]
}
};


-------------------------
test1:
test2:
test3:
test4:
test5:
test6:
test7:
test8:


-------------------------
test9:
pete1: HASH(0x4cd2a98)


-------------------------
Request:
POST http://iivmware:14500/NameWorksScoring/services/ScoringWebServiceSEIPort
HTTP/1.1
User-Agent: libwww-perl/6.08
Content-Length: 374
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
X-LWP-Version: 6.08
X-XML-Compile-Cache-Version: 1.04
X-XML-Compile-SOAP-Version: 3.15
X-XML-Compile-Version: 1.52
X-XML-LibXML-Version: 2.0124

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body><ns2:analyzeForSearch xmlns:ns2="urn:ScoringWebService/types" xml
ns:xsi="http://www.w3.org/2001/XMLSchema-instance"><name>John Smith</name><alter
nateThreshold>65</alternateThreshold></ns2:analyzeForSearch></SOAP-ENV:Body></SO
AP-ENV:Envelope>

Response:
HTTP/1.1 200 OK
Date: Fri, 18 Mar 2016 18:27:41 GMT
Server: WebSphere Application Server/8.0
Content-Language: en-US
Content-Length: 946
Content-Type: text/xml; charset=utf-8
Client-Date: Fri, 18 Mar 2016 18:27:45 GMT
Client-Peer: 192.168.208.132:14500
Client-Response-Num: 1
X-Powered-By: Servlet/3.0

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xm
lns: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
env:Header/><soapenv:Body><p47:analyzeForSearchResponse xmlns:p47="urn:ScoringWe
bService/types"><result><categoriesInt>1</categoriesInt><name>JOHN SMITH</name><
surname>SMITH</surname><givenName>JOHN</givenName><titles/><qualifiers/><origina
lSurname>John Smith</originalSurname><originalGivenName/><scriptTypeInt>0</scrip
tTypeInt><nameCultureInt>1</nameCultureInt><surnameCultureInt>1</surnameCultureI
nt><givenNameCultureInt>1</givenNameCultureInt><nameCultureSetInt>2</nameCulture
SetInt><surnameCultureSetInt>2</surnameCultureSetInt><givenNameCultureSetInt>2</
givenNameCultureSetInt><confidence>98</confidence><alternate>0</alternate></resu
lt></p47:analyzeForSearchResponse></soapenv:Body></soapenv:Envelope>


c:\Temp>


(This post was edited by FishMonger on Mar 18, 2016, 2:07 PM)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives