Fog Creek Software
Discussion Board




Welcome! and rules

Joel on Software

Calling web services from old-style ASPages

So I've finally found a problem that actually requires a solution that needs all this new-fangled web services shenanigans (sharing HTML headers and footers across many webservers) and I'm stumped on this one: how do the old apps access the brand new web service that spoons out the HTML.  I'm particularly interested in ASP (most of our apps) but also Cold Fusion and Java.  A quick scout around the web gave me nothing much of any use.  Its easy to change their "GetHeader" shared lib to do the right thing I'm just not sure what the "right thing" is - do I need to install some kind of SOAP-enabling components on each webserver?

Thanks,

T

Thomas Baker
Thursday, October 31, 2002

You can do this in just a few lines of code using the MSSOAP toolkit. Here's some javascript that does it.

var soapClient = Server.CreateObject("MSSOAP.SoapClient");
    
soapClient.ClientProperty("ServerHTTPRequest") = true;

soapClient.msSoapInit("http://yourhost/serviceName.asmx?wsdl");

After the msSoapInit call you can use:
soapClient.yourServiceMethod();

I'm not sure about talking to ColdFusion since I don't use it but if a CF web service returns a WSDL file it should work just the same.

Hope that helps
8)

sean slavin
Thursday, October 31, 2002

That's perfect thanks.  Why the wdsl on the end of the URL? 

Now I've just got to rewrite the header library and install the MSSOAP toolkit on all those servers.  I knew this would make my life easier!

Thanks,

T

Thomas Baker
Thursday, October 31, 2002

The WSDL file is an XML file that describes all the methods and their parameters in a web service. When you create the soapClient it uses the WSDL file to know what method to call. Adding '?wsdl' to the end of a url to a .NET service is how you get the XML description of the service.

8)

sean slavin
Thursday, October 31, 2002

When you create a WebService project in .NET and run it from the debugger, it launches a web page that has examples for calling your service using SOAP, HTTP GET, and HTTP POST.  It also creates a test harness for your service.  This is a nifty little feature of .NET that I really like.

I'm using HTTP POST to call a C# webservice from VBScript within a webpage.

Jason
Sunday, November 03, 2002

*  Recent Topics

*  Fog Creek Home