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

Trouble talking to .NET Web Service using SOAP::Lite 0.46

Expand Messages
  • lordcornish
    I m trying to write a Perl client that interacts with a .NET web service. I ve written several others in the past and they ve all worked just fine, but this
    Message 1 of 1 , Oct 31 8:52 AM
    • 0 Attachment
      I'm trying to write a Perl client that interacts with a .NET web
      service. I've written several others in the past and they've all
      worked just fine, but this one is giving me absolute fits. Using
      SOAPscope I've been able to determine that if I change

      <UserCredentials soap:xmlns="http://tempuri.org/xxxxx">


      <UserCredentials xmlns="http://tempuri.org/xxxxx">

      everything will work just fine. I've included sample source code and
      a full copy of the soap message I'm sending below. I'd sure
      appreciate it if someone could nudge me in the right direction.

      <?xml version="1.0" encoding="UTF-8"?>
      <Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"
      <UserCredentials soap:xmlns="http://tempuri.org/xxxxx">
      <CheckCreds xmlns="http://tempuri.org/xxxxx"/>

      use Carp;
      use DBI;
      use SOAP::Lite;
      use XML::Parser;
      require "incPerlFunctions.pl";

      my %Config = (wsURI => "http://ws.xxxxx.com/xxxxx",
      wsURIFromWSDL => "http://tempuri.org/xxxxx",
      wsProxy => "http://ws.xxxxx.com/xxxxx.asmx",
      wsUsername => "xxxxx",
      wsPassword => "xxxxx"

      # Problem is rpc/encoded (default in SOAP::Lite) vs. document/literal

      my $soap = new SOAP::Lite (uri => $Config{wsURI},
      proxy => $Config{wsProxy},
      #for .NET: set an on_action sub to
      change the way the SOAPaction header is constructed.
      on_action => sub {join '/', @_},
      on_debug => sub {print "-" x 20;
      print "\n@_"},
      maptype => {}, #for .NET
      autotype => 0, #for .NET
      trace => all,
      namespace => 'soap' #for .NET switch
      to soap instead of SOAP-ENV

      my $header = SOAP::Header->name(UserCredentials => {UserName =>
      Password =>
      #for .NET: add xmlns attribute to the
      method name in the SOAP body
      ->attr({xmlns => $Config{wsURIFromWSDL}});

      my @parms = ($header);

      my $method = SOAP::Data->name('CheckCreds')
      ->attr({xmlns => $Config{wsURIFromWSDL}});

      my @result = $soap->call($method => @parms)->result;
      my $env = $soap->call;

      #check envelope for faults and report them, otherwise print result.
      if ($env->fault) {
      confess $env->faultcode . ": ". $env->faultstring;
      else {
      return @result;
    Your message has been successfully submitted and would be delivered to recipients shortly.