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

Hey guys, Im killing myself over this soap-lite script I have written. Its using an asp.net SOAP server, so in my experience, its best to pass through the soap information through raw XML, if you know what the servers expecting. Here is what its expecting.
POST /services/svrLogin.asmx HTTP/1.1 Host: website.com Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://tempuri.org/ControlNET/svrLogin/GetCreds" <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" x +mlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schema +s.xmlsoap.org/soap/envelope/"> <soap:Body> <GetCreds xmlns="http://tempuri.org/ControlNET/svrLogin"> <Username /> <Password /> </GetCreds> </soap:Body> </soap:Envelope>
And this is what im passing to it.. (per my Data Dump in Perl)
<?xml version="1.0" encoding="UTF-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <GetCreds xmlns="http://tempuri.org/ControlNET/svrLogin"> <Username>username</Username> <Password>********(hidden)**********</Password> </GetCreds> </soap:Body> </soap:Envelope>
Now I know its interacting with the right namespace, but it should be returning some proper information about the server its interacting with, however the response is "Failed to authenticate the proper username and password" Any idea what I could be doing wrong? I know the password is 100% right. Here is the code as well
#!c:/perl/bin use SOAP::Lite+trace => 'all'; use XML::Simple; use Data::Dumper; system("cls"); $method = 'GetCreds'; $ep = 'http://website.com/services/svrLogin.asmx'; $uri = 'http://tempuri.org/ControlNET/svrLogin'; $xml = '<Username>username</Username> <Password>********(hidden)**********</Password>'; $soap = SOAP::Lite -> proxy ($ep) -> uri($uri) -> on_action( sub { join '', $uri, $_[1] } ) -> readable(1) -> call ($method => SOAP::Data->type('xml' => $xml)); print Dumper($soap);
Any ideas?

Replies are listed 'Best First'.
Re: soap-lite issue
by alwaysuseperl (Novice) on Jul 14, 2010 at 05:13 UTC
    Well I found out what it was... After comparing it to some of my other scripts, they would show what the server was expecting.. such as this..
    <username>string</username> <password>string</password>
    And this server was like..
    <Username /> <Password />
    After thinking about it.. I realized this may mean that the server has no idea if it should be expecting a string, or an intiger, or boolean, etc, so changing the XML to below.. fixed it..
    <AdminUsername xsi:type="xsd:string">bla bla</AdminUsername> <AdminPassword xsi:type="xsd:string">bla bla</AdminPassword>