Thursday, December 16, 2004

Call .NET ASMX from ASP

Call .NET ASMX from ASP:

Call .NET ASMX from ASP
Let's say you have an ASMX webservice written in C# or VB.NET or some other .NET language, and you want to call it from an ASP page written in VBScript.

There are a couple of ways to do this.

Use the MS Soap Toolkit.
http://www.microsoft.com/downloads/details.aspx?FamilyId=C943C0DD-CEEC-4088-9753-86F052EC8450&displaylang=en

But as the download page states, this toolkit will be retired in April 2005. This means Microsoft will no longer support its use. This would mean, for example, that if a security bug were found in the toolkit after April 2005, Microsoft would not be bound to correct it and issue a patch. Because of this, most developers are not writing new code on the SOAP Toolkit.

Write a client of the webservice in C# (or VB.NET) and have that *client* expose a COM interface. You would do this with tlbexp.exe and follow along the guidelines for COM--to-.NET interop. In this case the ASP page would call the COM component, which would then act as the client to the webservice.
http://msdn.microsoft.com/library/en-us/vbcn7/html/vaconIntroductionToCOMInteroperability.asp

If the webservice is simple, then you may be able to use MSXML to make the call. Here is an example.
http://cheeso.members.winisp.net/srcview.aspx?dir=web-services&file=Soap-v4.js

and here's an article covering that technique:
http://www.eggheadcafe.com/articles/20001006.asp

Use an alternative SOAP toolkit for COM-based environments (like VBScript). PocketSOAP is one.
http://www.pocketsoap.com/pocketsoap/

Are there other ways to do this?


-Dino


posted on Monday, November 22, 2004 11:21 AM
Comments
# re: Call .NET ASMX from VBScript
ptau
Posted @ 11/22/2004 12:21 PM
yes, try webservice.htc (http://msdn.microsoft.com/library/default.asp?url=/workshop/author/webservice/webservice.asp)
this's realy cool thing ;)
# re: WebService behavior
Dino
Posted @ 11/22/2004 3:30 PM
According to http://msdn.microsoft.com/workshop/author/behaviors/behaviors_node_entry.asp

...the webservice behavior enables client-side script to invoke remote methods exposed by Web Services, or other Web servers, that support the SOAP and Web Services Description Language (WSDL) 1.1.

Client-side script, not server-side script.
So yes, this gives you the ability to invoke a webservice, but not really from server-side ASP.

I have updated the title on this post accordingly. The original title was "Call .NET ASMX from VBScript" and now it is "Call .NET ASMX from ASP" .


# re: re: WebService behavior
ptau
Posted @ 11/22/2004 4:10 PM
yes, webservice behavior is a client-side technics. but if you take a closer look at this webservice.htc source (jscript with some xml meta declarations) you'll find a complete set of soap/webservice operations (much more complete than at link #3 in original post). the only action needed is replacement of the client-side call (XMLHttp) to its server-side equivalent.

0 Comments:

Post a Comment

<< Home