Sunday, July 18, 2004

 

First Steps

I surfed the web before getting started and found a tool called TcpTrace which prooved to be really useful when it comes to web services. I would advise that you should check it out too.

I started out with the simple Hello World web service that is created when you create a new web service in Visual Studio. After running the web service, I ran the following perl script.

#!/data/Perl/bin/perl -w
##!/usr/bin/perl -w

use SOAP::Lite;

my $webserviceURL = "http://localhost:8989/eConnectWebService/eConnectService.asmx";

print SOAP::Lite
-> uri("http://xxxx.com/webservices")
-> proxy($webserviceURL)
-> HelloWorld()
-> result;


Guess what? The above didn't print anything... Looking at the data returned to TcpTrace by IIS I saw "System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: http://tempuri.org/webservices#HelloWorld."

Doing some reasearch on the web I found out that I Microsoft prefers "URI/HelloWorld" instead of "URI#HelloWorld" in the request that is sent. The solution was to tell SOAP::Lite to replace the / with #, this can be accomplished by:

use SOAP::Lite
on_action => sub { return '"' . join('/', @_) . '"'}
;


The above solved this problem, and now I was able to print "Hello World" to the console!


Comments: Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?