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

Hi, I am trying to get the response from using SOAP API and results in parsing error. I am using SOAP LITE module to pull response. Is there a way we can get rid of error responses (￿￿) and process the rest of the data? or Are there any conversions available for SOAP responses? Below are code. Appreciate your reply

not well-formed (invalid token) at line 15, column 314, byte 3846 at C:/Perl64/lib/XML/Parser.pm line 187. <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Body> <GetRelevanceResultResponse xmlns="http://schemas.bigfix.com/Relevance"> ..... 1sys234&~&15802503&~&Adobe Creative Suite&~& &~& &~& C:\Users\boundsjr\Adobe &~& &~& &~& C:\PROGRA~2\INSTAL~1\{0134A~1\setup.exe /relaunched/rootloc=c:\users\boundsjr\desktop\creative suite 2 - standard\adobe creative suite 2.0/lang=0409￿￿嘸ņ椺倝 鈀牔湡潳瑦匠汯瑵潩獮䌠癩汩㌠⁄牆浡睥牯⸱‰縦…⸱‰縦…牔湡潳瑦匠汯瑵潩獮☠♾䌠尺牐杯慲楆敬⁳砨㘸尩牔湡潳瑦匠汯瑵潩獮䌠癩汩㌠⁄牆浡睥牯縦…☠♾†縦…䌢尺楗摮睯屳牔湡潳瑦匠汯瑵潩獮䌠癩汩㌠⁄牆浡睥牯屫湵湩瑳污⹬硥≥∠唯䌺尺楗摮睯屳牔湡潳瑦匠汯瑵潩獮䌠癩汩㌠⁄牆浡睥牯屫湕湩瑳污屬湵湩瑳污⹬浸≬" ..... </GetRelevanceResultResponse> </soapenv:Body> </soapenv:Envelope> at C:\Users\User1\Desktop\rep\SW\SoftwareInventoryFull_v5.pl line 74.

use SOAP::Lite; my $configfile="Config.txt"; my $host; my $cusername; my $cpassword; my $cexpr1; my $offset = 0; while ($offset < $loop) { my $username = SOAP::Data->name('username' => $cusername ); my $password = SOAP::Data->name('password' => $cpassword ); my $service = SOAP::Lite -> uri( 'https://' . $host . '/reports?ws +dl' ) -> proxy( 'https://' . $host ); $timestamp = localtime(time); #Retrieve the records my $expr = SOAP::Data->name('relevanceExpr' => $cexpr1 ); my $result = $service -> GetRelevanceResult( $expr, $username, $p +assword ); if( $result->fault ) { print " [".$timestamp. "] ---- faultcode: " . $result->faultco +de . "\n"; print " [".$timestamp. "] ---- faultstring: " . $result->fault +string . "\n"; } else { # Insert the data in to Temp table from API foreach my $answer ( $result->valueof( "//GetRelava +nceResultResponse/a" ) ) { Insert in to the table. } } }

Replies are listed 'Best First'.
Re: not well-formed (invalid token) while using SOAP Lite Module
by Anonymous Monk on Jun 26, 2018 at 23:31 UTC

    Is there a way we can get rid of error responses (￿￿) and process the rest of the data?

    So you're asking is there a way to edit a string, and feed a string to SOAP Deserializer? The answer is yes