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

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

Hello Monks,

I am trying to replicate the following code written in C#:

//In C#, using a web reference to auto generate the proxy class defini +tion, var proxy = new GSDIAuthentication.IGSDIBaseAuthentication +(); //Not needed, but showing where the web reference goes to +get the WSDL proxy.Url = "http://gsdi.goldstandard.com/GSDIAuthenticati +onWS.asmx?WSDL"; //Set up a string array with the key given to you by techn +ical support var urls = proxy.Authenticate(new [] { "KEY_ISSUED_BY_GOLDSTANDARD" } ); foreach (var url in urls) { //Use the URL field to attach this to an anchor tag se +rver side, this //url is what you want users to click on in order to a +ccess our site. //If an error has occurred, the url.ErrorDescription w +ill be populated //with the error message. Should be blank otherwise. Response.Write(url.ErrorDescription); Response.Write(url.Url); }

using the PERL SOAP::lite module. I am not familiar with either C# or SOAP so I am totally lost. Here is what I have so far:

#!/usr/bin/perl -w BEGIN { my $b__dir = (-d '/home/consumer/perl'?'/home/consumer/perl':( get +pwuid($>) )[7].'/perl'); unshift @INC,$b__dir.'5/lib/perl5',$b__dir.'5/lib/perl5/x86_64-lin +ux',map { $b__dir . $_ } @INC; } use strict; use CGI qw(:standard); use CGI::Carp qw(fatalsToBrowser); use SOAP::Lite; use SOAP::Transport::HTTP; my $cgi = new CGI; print header; #print required HTML headers print start_html('Token Results'); #print HTML Title my $soap = SOAP::Lite ->uri('http://gsdi.goldstandard.com/GSDIAuthenticationWS.asmx?WSDL +') ->proxy('http://GSDI.Authentication/2009/4/1/Authenticate'); my $drugID = 'KEY_ISSUED_BY_GOLDSTANDARD'; # Key for Drug ID print "I got here without error so far";

The goal is to pass the KEY_ISSUED_BY_GOLDSTANDARD and return a data from the server. The data is a URL that changes daily.

Thanks in advance for any help or direction.

Rich

Replies are listed 'Best First'.
Re: SOAP::lite module help
by nikosv (Deacon) on Mar 27, 2012 at 05:52 UTC

    calling a .NET web service from a Perl SOAP client is not that straightforward since there are inconsistencies. For example SOAP::Lite uses RPC encoding while .NET uses document literal etc

    Just by looking at it, the uri and proxy section doesn't look right plus you are not calling the authenticate method.Then you have to take the data types and parameter naming into consideration

    Check this guide How to Call a .NET-based Web Service Using the SOAP::Lite Perl Library for more information