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.
use strict; use XML::Compile::SOAP11; use XML::Compile::WSDL11; use XML::Compile::Transport::SOAPHTTP; use Data::Dumper; $Data::Dumper::Indent=1; # Query details my $inFn='John Smith'; # WSDL URL my $WSDL = 'http://iivmware:14500/NameWorksScoring/services/ScoringWeb +ServiceSEIPort?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'); # 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'}->{'resul +t'}->{'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;
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/ScoringWebService +SEIPort 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/env +elope/"> <SOAP-ENV:Body><ns2:analyzeForSearch xmlns:ns2="urn:ScoringWebService/ +types" xml ns:xsi="http://www.w3.org/2001/XMLSchema-instance"><name>John Smith</n +ame><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/envel +ope/" xm lns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="htt +p://www.w3 .org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-insta +nce"><soap env:Header/><soapenv:Body><p47:analyzeForSearchResponse xmlns:p47="urn +:ScoringWe bService/types"><result><categoriesInt>1</categoriesInt><name>JOHN SMI +TH</name>< surname>SMITH</surname><givenName>JOHN</givenName><titles/><qualifiers +/><origina lSurname>John Smith</originalSurname><originalGivenName/><scriptTypeIn +t>0</scrip tTypeInt><nameCultureInt>1</nameCultureInt><surnameCultureInt>1</surna +meCultureI nt><givenNameCultureInt>1</givenNameCultureInt><nameCultureSetInt>2</n +ameCulture SetInt><surnameCultureSetInt>2</surnameCultureSetInt><givenNameCulture +SetInt>2</ givenNameCultureSetInt><confidence>98</confidence><alternate>0</altern +ate></resu lt></p47:analyzeForSearchResponse></soapenv:Body></soapenv:Envelope> c:\Temp>
In reply to Access SOAP return structure.. by hubascuba
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |