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

help with SOAP::Lite client connecting to ASP.NET Windows Service App

Expand Messages
  • Scott
    I m having troubles getting my client to send values to function. I need a perl client to send this structure: POST /VSMapi/VSMapi.asmx HTTP/1.1 Host:
    Message 1 of 2 , Jan 12, 2011
    • 0 Attachment
      I'm having troubles getting my client to send values to function. I need a perl client to send this structure:

      POST /VSMapi/VSMapi.asmx HTTP/1.1
      Host: localhost
      Content-Type: text/xml; charset=utf-8
      Content-Length: length
      SOAPAction: "http://g3w0877.americas.hpqcorp.net/VSMapi/Test"

      <?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Body>
      <Test xmlns="http://g3w0877.americas.hpqcorp.net/VSMapi/">
      <x1>string</x1>
      <x2>string</x2>
      </Test>
      </soap:Body>
      </soap:Envelope>
      HTTP/1.1 200 OK
      Content-Type: text/xml; charset=utf-8
      Content-Length: length

      <?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
      <soap:Body>
      <TestResponse xmlns="http://g3w0877.americas.hpqcorp.net/VSMapi/">
      <TestResult />
      </TestResponse>
      </soap:Body>
      </soap:Envelope>

      Here is my client :
      use SOAP::Lite +trace => 'debug';

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

      $function = 'Test';
      $result = $soap->$function
      (\SOAP::Data->value(
      (SOAP::Data->name('x1')->type(string => ' what the '),
      SOAP::Data->name('x2')->type(string => 'heck')
      )))->result;
      print $result;

      Here is the debugging results. I can't figure out why the service isn't accepting the parameters.

      SOAP::Transport::HTTP::Client::send_receive: POST http://myserver/VSMapi/VSMapi.asmx HTTP/1.1
      Accept: text/xml
      Accept: multipart/*
      Accept: application/soap
      Content-Length: 542
      Content-Type: text/xml; charset=utf-8
      SOAPAction: http://myserver/VSMapi/Test

      <?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><Test xmlns="http://myserver/VSMapi/VSMapi.asmx"><c-gensym3><x1 xsi:type="xsd:string"> what the </x1><x2 xsi:type="xsd:string">heck</x2></c-gensym3></Test></soap:Body></soap:Envelope>
      SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 200 OK
      Cache-Control: private, max-age=0
      Date: Wed, 12 Jan 2011 23:08:15 GMT
      Server: Microsoft-IIS/6.0
      Content-Length: 382
      Content-Type: text/xml; charset=utf-8
      Client-Date: Wed, 12 Jan 2011 23:08:15 GMT
      Client-Peer: 16.233.58.154:80
      Client-Response-Num: 1
      X-AspNet-Version: 2.0.50727
      X-Powered-By: ASP.NET

      <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><TestResponse xmlns="http://myserver/VSMapi/"><TestResult xsi:type="xsd:string">accepted</TestResult></TestResponse></soap:Body></soap:Envelope>
    • Martin Busik
      Hi, ... The header SOAPAction is the Problem, you should write something like: $soap = SOAP::Lite- ... $soap- on_action( sub{
      Message 2 of 2 , Jan 13, 2011
      • 0 Attachment
        Hi,

        > I need a perl client to send this structure:
        >
        > SOAPAction: "http://g3w0877.americas.hpqcorp.net/VSMapi/Test"
        > ...
        > Here is the debugging results. I can't figure out why the
        > service isn't accepting the parameters.
        >
        > SOAPAction: http://myserver/VSMapi/Test

        The header "SOAPAction" is the Problem, you should write something like:

        $soap = SOAP::Lite->...
        $soap->on_action( sub{ "http://g3w0877.americas.hpcorp.net/".$_[1] } );

        or - as a starting point:

        $soap->on_action( qub { "http://g3w0877.americas.hpqcorp.net/VSMapi/Test" }
        );

        Cheers,
        Martin
      Your message has been successfully submitted and would be delivered to recipients shortly.