Loading ...
Sorry, an error occurred while loading the content.

SOAP::Lite client for a .Net web service - SOAP message encoding

Expand Messages
  • sihambenabbou
    Hi all, I am a SOAP::Lite and Perl Newbie. I m implementing a SOAP::Lite client with perl under a linux machine that is supposed to iteroperate with a .Net
    Message 1 of 2 , Jul 12 1:16 PM
    • 0 Attachment
      Hi all,

      I am a SOAP::Lite and Perl Newbie.
      I'm implementing a SOAP::Lite client with perl under a linux machine
      that is supposed to iteroperate with a .Net webservice (my proxy)
      installed on a IIS webserver. At the end are the source code for my
      client as well as its generated SOAP message.

      I send authentication attributes in the soap header and the
      authentication fails. My guess is that the failure is due to the
      following couple of problems and I would greatly appreciate any help
      or correction:

      1 - I need the client to send the soap message in document literal
      format for it to be understood by the .Net server. This is because
      for the .Net server to undertand RPC encoding I need to change the
      source code explicitly and unfortunatly i'm not supposed to do so for
      the server to stay compatible with other .Net clients that use
      document literal encoding format. Can anyboby help solve this out?

      2 - The soap envelope tags generated by my client are different from
      the ones generated by the MS server. e.g <SOAP-ENV:Envelope> as
      generated by the client corresponds to <soap:Envelope> according to
      .Net. Also <SOAP-Env:Header> for the client is <soap:header> for .net
      server
      How can I make the tags generated by the soap::Lite look same as those
      generated by .Net. Is this an encoding style related issue?

      Thanks in advance.
      ####### BEGIN CODE #####################
      #!/usr/bin/perl -w

      use SOAP::Lite maptype => {};
      use SOAP::Lite +trace => "all";

      my $soap = SOAP::Lite
      -> uri('http://xx.xx.xx.xx/')
      -> on_action( sub{ join '/', 'http://xx.xx.xx.xx',
      $_[1] })
      -> proxy('http://xx.xx.xx.xx/service/service.asmx');

      my $header = SOAP::Header->name(AuthenticationHeader => {
      username => 'yyyyyyyyy',
      password => 'zzzzzzzzz',
      })->uri('http://xx.xx.xx.xx/')->prefix('');

      my $result = $soap->remote_function($header);
      if ($result->fault) {
      print "fault is: " . $result->faultstring ."\n"
      } else {
      print "result is: " . $result->result . "\n";
      }
      ####### END CODE #####################

      ####### BEGIN CLIENT GENERATED SOAP MESSAGE ###############
      <?xml version="1.0" encoding="UTF-8"?>
      <SOAP-ENV:Envelope
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
      <SOAP-ENV:Header>
      <AuthenticationHeader xmlns="http://10.44.1.17/">
      <username xsi:type="xsd:string">yyyyyyyyy</username>
      <password xsi:type="xsd:string">zzzzzzzzz</password>
      <AuthenticationHeader>
      </SOAP-ENV:Header>
      <SOAP-ENV:Body>
      <namesp1:remote_function xmlns:namesp1="http://xx.xx.xx.xx/">
      </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>

      ####### END CLIENT GENERATED SOAP MESSAGE ###############
      Thanks in advance
      Siham
    Your message has been successfully submitted and would be delivered to recipients shortly.