Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

SOAP and .NET Web Services

by Akira71 (Scribe)
on May 10, 2005 at 19:59 UTC ( [id://455741]=perlquestion: print w/replies, xml ) Need Help??

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

Fellow monks.. again I am coming to the holy ones for help or at least some guidance.

I am trying to talk to a .NET web service via SOAP and I am using SOAP::Lite as is the way of all monks. However I am running into a problem that is confounding me. I assume it is my lack of knowledge on the matter, but let me set up the scenario for you.

The service is called Check status. It has an XML signature in my documentation that looks like this:
<TRANSACTION><CAIC>12345</CAIC></TRANSACTION>

Simple as it is I only have to send in my request to the SOAP WSDL server and recieve a response that should look thusly:
<RESPONSE><RESPONSECODE>00</RESPONSECODE></RESPONSE>

Silly me to think this would be so simple. As it turns out the string that must be sent them needs to be TripleDES encrypted as well. Ok this does not seem so bad yet. I was even provided a wonderful VB example that should clear all things up. So I go about trying to make this call and nothing seems to work. I have included a sample of my code in question so that it can be crtiqued, questioned, derided or what have you. However I do hope that some answers might be able to come out of this.

Of note is that I am not given all the data I think I need, so please if something is missing I will provide it. However the USERNAME and PASSWORD plus the TripleDES keys I cannot.

#!/usr/bin/perl use strict; use Crypt::TripleDES; use SOAP::Lite maptype => {}; my $lite; my $tDES1 = "1234567890123456"; my $tDES2 = "1234567890123456"; my $tDES3 = "1234567890123456"; my $passcode = $tDES1 . $tDES2 . $tDES3; my $CAIC = "123456"; my $des = new Crypt::TripleDES; my $namespace = 'https://wstest.solspark.com/'; # The URI/proxy may be different. $lite = SOAP::Lite -> uri($namespace) -> on_action( sub { join '/', 'https://wstest.solspark.com', $_[1] } + ) -> proxy('https://USERNAME:PASSWORD@wstest.solspark.com'); my $s = ""; $s = $des->encrypt3($s, $passcode); print "Encoded value: $s \n"; print $lite->CheckStatus($s, $CAIC)->result . "\n";


I have tried various values for $s above as well. I have tried using SOAP::DATA hashes. Above is about as simple as I can make what I am doing. I have scoured some of the links in forums and on this wonderful site. I even have tried best to make sense of the PERL CPAN DOC. While English is not my native language, I am proficient enoguh at it to be confused by what I read.

Please if anyone has a clue I would be most appreciative. Right now I only get blank lines as a response unless I use the service a (WSDL) and then I get login errors.
Oh the service can be found here:
# https://USER:PASS@wstest.solspark.com/SSVPWebService.WSDL

Sincerely,
Akira

Replies are listed 'Best First'.
Re: SOAP and .NET Web Services
by polettix (Vicar) on May 10, 2005 at 23:50 UTC
    I never used SOAP so forgive me if it doesn't help. In the line:
    -> on_action( sub { join '/', 'https://wstest.solspark.com', $_[1] }
    you use index 1 inside array @_, but indexes to arrays start from 0 in Perl. I tried to look at the on_action method more in depth in SOAP::Lite docs, but they didn't enlighten me much.

    On a more general base, why don't you start with some clear-text experiments (using HTTP instead of HTTPS)? In this way, you would be able to capture traffic (e.g. using ethereal) and see what's going on between your client and the server.

    Flavio (perl -e 'print(scalar(reverse("\nti.xittelop\@oivalf")))')

    Don't fool yourself.

      SOAP::Lite::on_action() is used to set a function that will be used to generate the SOAPAction header value. Arg 0 is the SOAP URI, and Arg 1 is the name of the method called. By default, the SOAPAction generated by SOAP::Lite is of the form 'URI#METHOD', but .Net expects 'URI/METHOD'.

      Also, if the web service isn't available as HTTP, it'd do no good to change protocols. If on_debug() doesn't work for HTTPS (I don't have any HTTPS webservices to test against), you can always fake it with a custom serializer/deserializer, like the following logic

        I understood that the OP owned the service and could change the server end as well as the client, but now that I re-read the post I don't find anything supporting this interpretation - thanks for correcting.

        Flavio (perl -e 'print(scalar(reverse("\nti.xittelop\@oivalf")))')

        Don't fool yourself.
Re: SOAP and .NET Web Services
by gellyfish (Monsignor) on May 11, 2005 at 08:48 UTC

    Would it be possible for you to send the output you get with

    use SOAP::Lite +trace => 'all';
    on - as well as the WSDL that is generated by the web service (you can get this from a .NET web service by going to the URL of the proxy with a ?WSDL appended).

    /J\

      Thank you! That acutally helps do the trick. I do have a list of the WSDL as well as the API documentation and I am calling it correctly, but the SOAP trace shows me this:
      SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 405 (Method Not +Allowed) Method not allowed
      The information there gives me a lot to go on in the full trace.
      Also sorry for the late reply to your message.

      Akira

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-19 14:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found