Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

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( +asmx?WSDL'); $params = array( 'AuthUserName' => '', 'AuthPassword' => 'xxxxxxxxxx', 'NewUsername' => 'xxxxxxxx', 'NewPassword' => 'xxxxxxxxxxxx', 'DomainName' => '', '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' => '', 'AuthPassword' => 'xxxxxxxxxx', 'NewUsername' => 'xxxxxxxx', 'NewPassword' => 'xxxxxxxxxxxx', 'DomainName' => '', 'FirstName' => 'john', 'LastName' => 'doe', 'IsDomainAdmin' => 0 ); my $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....

Replies are listed 'Best First'.
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: 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 was u +nexp ected. Expecting 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
        I get an error, like
        Connecting to||:80... connected.
        HTTP request sent, awaiting response... 404 Not Found
        2010-03-24 23:50:20 ERROR 404: Not Found.

Re: SOAP::Lite Module
by hominid (Priest) 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?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://830639]
Approved by zwon
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2018-06-20 06:43 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (116 votes). Check out past polls.