Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Coldfusion Integration

by PyrexKidd (Monk)
on Jul 16, 2011 at 18:27 UTC ( [id://914870]=perlquestion: print w/replies, xml ) Need Help??

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

I'm attempting to work with a web application that was written in ColdFusion (not my choice).


Said web application exposes certain functions through an API that I would like to call using my Perl Script. The API is located in:

C:\domains\foo.com\wwwroot\websvc.cfc

I -think- I want to use SOAP::WSDL::Client to make the remote calls, but it's not working.

Here's the sample I'm working with:

#!/usr/bin/perl use 5.010001; use strict; use warnings; use SOAP::WSDL::Client; my $address = 'https://foo.com/websvc.cfc'; my $soap = SOAP::WSDL::Client->new( { proxy => $address; } ); my $IP = '127.0.0.1'; my $ret = $soap->call('getConfigByIP', $IP); say "Ret: $ret";

Obviously $address and $IP have been replaced with anonymous data in the sample.

The thing I really don't understand is the Docs show three different ways to make remote calls. http://search.cpan.org/~mkutter/SOAP-WSDL-2.00.10/lib/SOAP/WSDL/Client.pm

$soap->call( \%method, $body, $header); $soap->call( $method, \@parts ); sub mySoapMethod { my $self = shift; $soap_wsdl_client->call( mySoapMethod, @_); }

in the first example, $body and $header appear to be redundant. Also it doesn't seem that this method of RPC doesn't allow variables to be passed to the method.

The second method seems to be the same as the third but not in a subroutine.

In the third example $self is assigned the first var in @_, but then it uses the $soap_wsdl_client to call the SOAP method...
at first I thought this was a typo, but now I'm not so sure...
if it is not a typo, what does $self represent, and where is $soap_wsdl_client set?

Maybe I'm missing something... Well, I'm definitely missing something, but I'm not sure what. Any help would be greatly appreciated.

Replies are listed 'Best First'.
Re: Coldfusion Integration
by Anonymous Monk on Jul 16, 2011 at 22:27 UTC
Re: Coldfusion Integration
by PyrexKidd (Monk) on Jul 19, 2011 at 17:32 UTC

    So, riddle me this:
    This url:

    https://example.com/webservices.cfc?j_username=foo&j_password=bar&meth +od=MyMethodName&someVar=123456&returnformat=json
    returns a valid json encoded string.

    I think my problem here, I am not authenticating... (Actually I'm pretty sure this is the problem.) Is there a way to authenticate with wsdl/SOAP? Or, do I have to use lynx (or wget) to pull the response down, then parse the response. The latter seems like a hack way to do this...

    #!/usr/bin/perl use 5.010001; use strict; use warnings; use LWP::Simple qw/mirror/; use SOAP::Simple; my $url = "https://example.com/webservices.cfc"; my $wsdlFile = 'webservices.wsdl'; mirror( $wsdlUrl, $wsdlFile ); my $soap = SOAP::Simple->new( $wsdlFile );

      To answer my question: I can use LWP::Simple to make the remote call and JSON to decode the string into an array. this does two things,
      a) it makes it portable because I am not relying on lynx
      b) makes the code cleaner.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2024-04-18 22:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found