SOAP::Lite client for document/literal .NET web services

| | Comments (0) | TrackBacks (0)

Update

Recently (it's early September 2008) Microsoft released an update that made the original example in this entry fail with an error along to the lines of:

a:InternalServiceFault <faultstring xml:lang="en-GB">The server was unable to process the request due to an internal error.  For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the &lt;serviceDebug&gt; configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.</faultstring></s:Fault>

Thanks to a colleague, here's a very minor alteration that should fix the problem:

use SOAP::Lite; # +trace
use strict;

my $uri = 'http://www.webserviceX.NET';
my $url = 'http://www.webservicex.net/globalweather.asmx';

my $soap = SOAP::Lite
       ->uri($uri)
       ->on_action( sub { '"' . $uri . $_[1] . '"' } ) # surround with double quotes
       ->proxy($url)
       ->autotype(0);

# $soap->readable(1);

my $method = SOAP::Data->name('GetWeather')->attr({xmlns =>$uri});

my $result = $soap->call($method => (
      SOAP::Data->name('CityName')->value('Cambridge'),
      SOAP::Data->name('CountryName')->value('United Kingdom'),)
)->result;

The original example below probably works with .NET web services that haven't yet had the latest update from Microsoft applied:

use SOAP::Lite; # +trace
use strict;

my $uri = 'http://www.webserviceX.NET';
my $url = 'http://www.webservicex.net/globalweather.asmx';

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

$soap->autotype(0);
# $soap->readable(1);

my $method = SOAP::Data->name('GetWeather')->attr({xmlns =>$uri});

my $result = $soap->call($method => (
      SOAP::Data->name('CityName')->value('Cambridge'),
      SOAP::Data->name('CountryName')->value('United Kingdom'),)
)->result;

 

0 TrackBacks

Listed below are links to blogs that reference this entry: SOAP::Lite client for document/literal .NET web services.

TrackBack URL for this entry: http://www.robbiebow.co.uk/mt/mt-tb.cgi/48

Leave a comment

About this Entry

This page contains a single entry by Robbie Bow published on March 13, 2008 9:59 PM.

The Second To Last Cigarette was the previous entry in this blog.

Rounding and int is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Powered by Movable Type 4.21-en