http://www.perlmonks.org?node_id=986007

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

Hello, I am trying to connect to a WSDL, but I am having problems. Here is my code:
use SOAP::Lite +trace; use strict; my $client = SOAP::Lite ->readable(1) ->uri('http://somewebsite.net/RequestService/3?wsdl') ->proxy('http://somewebsite.net/RequestService/3?wsdl'); my $temp_elements = SOAP::Data ->name("CallDetails" => \SOAP::Data->value( SOAP::Data->name("first" => '8'), SOAP::Data->name("max" => '1'), SOAP::Data->name("provider" => 'homeFolderWin'), SOAP::Data->name("action" => 'bestMatch'), SOAP::Data->name("state" => 'PLACED')) ); my $response = $client->fetchAndLock($temp_elements);
----- Just some simple code to fetch one record. However, this is what the traces lists when I run the above program:
SOAPAction: "http://somewebsite.net/RequestService/3?wsdl#fetchAndLock +" <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instanc +e" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:S +OAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http:/ +/www.w3.org/1999/XMLSchema" SOAP-ENV:encodingStyle="http://schemas.xm +lsoap.org/soap/encoding/"> <SOAP-ENV:Body> <namesp1:fetchAndLock xmlns:namesp1="http://somewebsite.net/Reques +tService/3?wsdl"> <CallDetails> <first xsi:type="xsd:int">8</first> <max xsi:type="xsd:int">1</max> <provider xsi:type="xsd:string">homeFolderWin</provider> <action xsi:type="xsd:string">bestMatch</action> <state xsi:type="xsd:string">PLACED</state> </CallDetails></namesp1:fetchAndLock></SOAP-ENV:Body> </SOAP-ENV:Envelope> SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0x3a3 +9974) SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal Ser +ver Error
---------------- However, using SoapUI with the following code works:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envel +ope/" xmlns:ns="http://myid.jpmchase.net/request/service/3"> <soapenv:Header/> <soapenv:Body> <ns:fetchAndLock> <ns:first>8</ns:first> <ns:max>1</ns:max> <ns:provider>homeFolderWin</ns:provider> <ns:action>bestMatch</ns:action> <ns:state>PLACED</ns:state> </ns:fetchAndLock> </soapenv:Body> </soapenv:Envelope>
------------------

What am I doing wrong? Any help would be greatly appreciated! Another question that I have is once I do get this working, how will I read the return code?

Replies are listed 'Best First'.
Re: SOAP::Lite question
by Anonymous Monk on Aug 08, 2012 at 02:33 UTC

    you should use example.com , its one of the official example hostnames :)

    Also, you shouldn't use SOAP::Lite, seriously :) use SOAP::Simple or its daddy XML::Compile...

    And now a tip, ddg://site:perlmonks.org soapenv SOAP::Lite -> SOAP::Lite and SOAP-ENV,

    local $SOAP::Constants::PREFIX_ENV = "soapenv"; local $SOAP::Constants::PREFIX_ENC = "soapenc";

    If that works, great -- probably the proper thing would be to set an appropriate  $client->encoding($soap_12_encoding_URN);

    Good luck, I hate soap :)