Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

SOAP::Lite Module

by jhyland87 (Sexton)
on Mar 24, 2010 at 18:56 UTC ( #830639=perlquestion: print w/ replies, xml ) Need Help??
jhyland87 has asked for the wisdom of the Perl Monks concerning the following question:

Hey, so im working on messing with the SmarterMail system API, with SOAP, im trying to simply add a new user, I know there API works, because I can interface with it in PHP. However im having some issues with perls SOAP::LITE module. Here is the PHP example, (Which works)
<?php try { $client = new SoapClient(http://SMARTERMAIL.com/services/svcUserAdmin. +asmx?WSDL'); $params = array( 'AuthUserName' => 'xxxxxxxxxxxxxx@xxxxxxxx.com', 'AuthPassword' => 'xxxxxxxxxx', 'NewUsername' => 'xxxxxxxx', 'NewPassword' => 'xxxxxxxxxxxx', 'DomainName' => 'xxxxxxxxxxx.com', 'FirstName' => 'john', 'LastName' => 'doe', 'IsDomainAdmin' => 0 ); $addUser = $client->AddUser($params); ?>Email account: <b><?=$emailaddr ?></b> has been added<p><? } catch (Exception $e) { printf("Message = %s ",$e->__toString()); } ?>
And here is my Perl version, which returns "0", and has no effect on the server.
#!c:/perl/bin use SOAP::Lite; use strict; use warnings; my %domainArray = ( 'AuthUserName' => 'xxxxxxxxxxxxxx@xxxxxxxx.com', 'AuthPassword' => 'xxxxxxxxxx', 'NewUsername' => 'xxxxxxxx', 'NewPassword' => 'xxxxxxxxxxxx', 'DomainName' => 'xxxxxxxxxxx.com', 'FirstName' => 'john', 'LastName' => 'doe', 'IsDomainAdmin' => 0 ); my $WSDL = 'http://SMARTERMAIL.com/services/svcUserAdmin.asmx?WSDL +'; my $soap = new SOAP::Lite->service($WSDL); my %output = $soap->AddUser(%domainArray); print "Output: ". %output;
Anyone know what these two do differently? Im rather new to the SOAP module, and perl in general, really....

Comment on SOAP::Lite Module
Select or Download Code
Re: SOAP::Lite Module
by Anonymous Monk on Mar 24, 2010 at 20:11 UTC
      Interesting, when I did that, it pulled up a ton of SOAP::Data::Destroy: () and some other lines, what stood out is this though..
      SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0x31f +20bc) SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal Ser +ver Error Cache-Control: private Date: Wed, 24 Mar 2010 20:27:45 GMT Server: Microsoft-IIS/6.0 Content-Length: 1106 Content-Type: text/xml; charset=utf-8 Client-Date: Wed, 24 Mar 2010 20:27:45 GMT Client-Peer: 216.119.106.197:80 Client-Response-Num: 1 X-AspNet-Version: 2.0.50727
      EDIT: After cleaning it up a bit, I also found this...
      <faultcode>soap:VersionMismatch</faultcode> <faultstring> System.Web.Services.Protocols.SoapException: Possible SOAP version mis +match: Envelope namespace http://schemas.xmlsoap.org/wsdl/soap/ was u +nexp ected. Expecting http://schemas.xmlsoap.org/soap/envelope/. at System.Web.Services.Protocols.SoapServerProtocol.CheckHelperVers +ion() at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters( +) at System.Web.Services.Protocols.WebServiceHandler.CoreProcessReque +st() </faultstring>
      Interesting... Version mismatch?
        Is the WSDL you mention the good one ?

        If I try to
        $ wget http://www.smartertravel.com/services/svcUserAdmin.asmx?WSDL
        
        I get an error, like
        Resolving www.smartertravel.com... 207.154.57.193
        Connecting to www.smartertravel.com|207.154.57.193|:80... connected.
        HTTP request sent, awaiting response... 404 Not Found
        2010-03-24 23:50:20 ERROR 404: Not Found.
        

        Krambambuli
        ---
Re: SOAP::Lite Module
by hominid (Curate) on Mar 24, 2010 at 20:56 UTC
    Just for the heck of it, try sending the hash as a reference and see if that makes a difference.
    my %output = $soap->AddUser(\%domainArray);
      I tried that a while ago, it just returns 'String value expected instead of HASH reference'

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (10)
As of 2015-07-07 12:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (88 votes), past polls