Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

SOAP LITE return message

by NewMonk2Perl (Sexton)
on Feb 17, 2011 at 14:55 UTC ( [id://888725]=perlquestion: print w/replies, xml ) Need Help??

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

Good morning gurus! I am trying to automate and replace a process that we currently have which sends out information from an Excel spreadsheet written with VB code using a button to call a web service from one of our clients. I think I have it working but it only returns the code of "1 , 1" which Im sure it means that it errorred or failed (which I fully expect because Im using test data that they already have). How would I write it so that it will return the actual return message? Below is the code that I am using:
#!perl -w use SOAP::Lite; #use SOAP::Lite +trace => 'all'; use warnings; use strict; my $soap = SOAP::Lite -> uri('http://tempuri.org/test/serv') -> on_action( sub { join '/', 'tempuri.org/test/Serv', $_[1] } ) -> proxy('http://webserver.company.com/test/svc.asmx?wsdl'); my $method = SOAP::Data->name('wsm_Get_WMLead') ->attr({xmlns => 'http://tempuri.org/test/Serv/'}); my @params = ( SOAP::Data->name(str_UserName => "Manual"), SOAP::Data->name(str_Password => "M*Post"), SOAP::Data->name(str_TraceNumber => "19381120000000"), SOAP::Data->name(str_FName => "QU"), SOAP::Data->name(str_Minit => "D"), SOAP::Data->name(str_LName => "TEALS"), SOAP::Data->name(str_Address1 => "155 GRIFFIN LANE"), SOAP::Data->name(str_City => "MANSFIELD"), SOAP::Data->name(str_State => "CA"), SOAP::Data->name(str_ZipCode => "96063"), SOAP::Data->name(str_Phone => "5555534821"), SOAP::Data->name(str_ACEID => "4108574"), SOAP::Data->name(str_Center => "1938"), SOAP::Data->name(str_NewCustDate => "20110214"), SOAP::Data->name(str_PrinAmnt => "400.00"), SOAP::Data->name(str_CompanyCode => "C01"), SOAP::Data->name(str_ScriptNo => "") ); print $soap->call($method => @params)->result; unless ($soap->fault) { print $soap->result(); } else { print join ', ', $soap->faultcode, $soap->faultstring; }
The script prints out "1 , 1"; I am assuming this is the faultcode and faultstring. I want to know what these value really means. How would I write it so I actually get the message rather than just the code? Thanks in advance. -Paul

Replies are listed 'Best First'.
Re: SOAP LITE return message
by toolic (Bishop) on Feb 17, 2011 at 15:10 UTC
    When things look unexpected to me, I try to print more info. What is the output using Data::Dumper?
    print $soap->call($method => @params)->result; print Dumper($soap->fault);
      Im still looking thru it. Thanks! Looks like this is what the faultstring is saying. What is "fault."?
      <faultstring>Server did not recognize the value of HTTP Header SOAPAct +ion: tempuri.org/acecash/Service1/fault.</faultstring>
Re: SOAP LITE return message
by dHarry (Abbot) on Feb 17, 2011 at 15:41 UTC

    The script prints out "1 , 1"; I am assuming this is the faultcode and faultstring.

    The faultstring is suposed to contain a human readable explanation;) The value "1" looks more like the value of an attribute to me. You can customize fault behavior, maybe that's what the server side did? As was mentioned before, turn (back) on tracing to find out what is going on. If possible, look what the server is supposed to send e.g. documentation?!

    Harry

      Based on the return message that are printed on the Excel spreadsheet we should get either :
      "Success: Record Submitted - Return From CallNow Service: SUCCESS: Ass +igned to List 841" OR "Success: Record Submitted - Return From CallNow Service: ERROR: Dupli +cate Record already exist in list table - Insert Aborted" I turned on Trace and I get multiple error msgs below: SOAP::TRANSPORT::HTTP::CLIENT::send_Receive::HTTP/1.1 500 Internal Err +or.
      Im not sure what that means. -Paul
Re: SOAP LITE return message
by Anonymous Monk on Feb 17, 2011 at 15:13 UTC
    The script prints out "1 , 1"; I

    Turn on tracing :)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://888725]
Approved by toolic
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-19 21:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found