Classic ASP BasicsFor beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
I have to do some code where I call a wsdl file in classic ASP (I'm not happy about it but it has to be done)... I got it working with a simple hello world that returns an input string but... how do I make more advanced calls where the input parameters is complex objects?
The function I need to call is "InsertInvoiceAndCustomer". The code will be used by a company to show customers that it can be done in classic ASP.
This is the code I use for the HelloWorld function (everything works except the xmlDoc part):
'Incase web service throws an exception.
'on error resume next
dim objDoc, objSOAPClient
set objDoc = Server.CreateObject("Msxml2.DomDocument.4.0")
set objSOAPClient = Server.CreateObject("MSSOAP.SoapClient30")
sPath = "http://testhorizon.gothiagroup.com/AFSServices/AFSService.svc?wsdl"
objSOAPClient.ClientProperty("ServerHTTPRequest") = true
if err.number <> 0 then
Response.write("<h2>Web Service Call Failed!</h2>")
Response.write("<h2>Web Service Call success!<br></h2>")
dim token, xmlDoc
'Get the token
token = objSOAPClient.HelloWorld("Hello World!")
'Get the XML.
set xmlDoc = Server.CreateObject( "MSXML2.DomDocument" )
Response.write(xmlDoc.hasChildNodes & "<br><br>")
'result = xmlDoc.getElementsByTagName("Envelope/Body/HelloWorldResponse/HelloWorldResult").item(0).text
result = xmlDoc.documentElement.selectSingleNode("book")
From a program I have called soapUI 2.5.1 I can see how the Envelope calls should look like:
Well, you appear to be using the Soap Toolkit, and unfortunately it's about the best thing there is for ASP usage. Have you got a decent set of docs and examples for it? If not, you should be able to find some online somewhere.
Sure you can't use ASP.NET for this one task?? ASP.NET makes calling and consuming Web services a true snap, esp. when used with Visual Studio (even the freebie Web Developer Express).
You need to have code that *AUTOMATICALLY* build the structure of the XML by inspecting the WSDL!
WOW! That's tough! Essentially, you need to duplicate all the stuff that .NET does for you. There's a .NET utility (I forget it's name) that will take the URL of a WSDL and spit out the code for a Class, and that's what you need to duplicate. WOW! Tough!
I wonder if it might be easier to run that utility and then parse the Class it outputs (does it allow you to choose C# or VB.NET class code??? I forget) into source code usable with ASP/VBScript.
Wow. This sounds like a TOUGH project. It also sounds like a fun project, and if I had the time I'd love to help, but I just don't have it right now.