Wrox Programmer Forums
|
Classic ASP Professional For advanced coder questions in ASP 3. 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 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 2nd, 2010, 02:11 AM
Registered User
 
Join Date: Aug 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Posting data from ASP to WebService

Hi.



How can I send string from classic ASP to .Net web service?



Thanks.
 
Old October 31st, 2010, 12:54 PM
J_P J_P is offline
Authorized User
 
Join Date: May 2009
Posts: 12
Thanks: 0
Thanked 1 Time in 1 Post
Default

it doesn't matter what type of code the webservice uses.

ASP can send the string as a querystring via the url.
Code:
function GetIt(strUrl)
Dim xmlhttp
Set xmlhttp=Server.CreateObject("MSXML2.ServerXMLHTTP"  )
xmlhttp.open "GET",strUrl,false
xmlhttp.send
GetIt = xmlhttp.responseText
Set xmlhttp=nothing
end function
 
Old October 31st, 2010, 07:02 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Not true, at all.

If the Web Service is using SOAP, which 99.5% of all ASP.NET Web Services do (because that's what the ASP.NET framework automatically creates for you when you ask for a Web Service) then you
(a) can *NOT* use "GET"; you MUST use "POST"
(b) MUST send a CORRECTLY FORMATTED request, using XML notation, with the XML parameters, etc., that the SOAP service is expecting.

It's not easy. But it can be done.

Google for "SOAP via classic ASP" or something to that effect.
 
Old October 31st, 2010, 07:03 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Oh, yes...and the response you will receive will *ALSO* be in SOAP format. So you will need to learn to use the XML DOM to read it.
 
Old October 31st, 2010, 09:14 PM
J_P J_P is offline
Authorized User
 
Join Date: May 2009
Posts: 12
Thanks: 0
Thanked 1 Time in 1 Post
Default

not that big of a deal - use post if you wish...

sending xml is just as easy as sending a string and so is receiving it...

I've done it with simple code as shown above.
 
Old November 1st, 2010, 03:12 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

LOL! Well, sure, if you have used XML quite a bit. But I'm assuming that anyone newbie enough to need to ask the question will be utterly lost when it comes to creating a proper SOAP request. Possibly even lost when it comes to handling the XML response.

As for "use post if you wish": Depending on how big the request needs to be, you may have no choice. And certainly won't have a choice if the ASP.NET code is *ONLY* looking for posted data.
 
Old November 2nd, 2010, 02:41 PM
J_P J_P is offline
Authorized User
 
Join Date: May 2009
Posts: 12
Thanks: 0
Thanked 1 Time in 1 Post
Default

I rarely use XML.

This is just not that complicated. Stop trying to make it sound like rocket science. It's as simple as it looks in the code example above.

If the OP has problems with xml they will post another question - likely to the XML forums...
 
Old November 2nd, 2010, 04:20 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

And clearly you've never used a stanadard ASP.NET Web Service. Or a SOAP Web Service, at all.

http://www.w3schools.com/webservices...nheitToCelsius

Granted, that shows using an HTTP Post, but that's only possible with really really simple web services. The two SOAP versions are much more typical.

Well, we shall see if and when the OP comes back.
 
Old November 2nd, 2010, 05:03 PM
J_P J_P is offline
Authorized User
 
Join Date: May 2009
Posts: 12
Thanks: 0
Thanked 1 Time in 1 Post
Default

Quote:
Originally Posted by Old Pedant View Post
And clearly you've never used a stanadard ASP.NET Web Service. Or a SOAP Web Service, at all....
You make a lot of assumptions. A bad habit.
 
Old November 2nd, 2010, 05:12 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

I will withdraw the comment. But for the rest I'll still wait to see what the OP intended. It would have been helpful if he'd shown the web service he wanted to query.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Data not posting to the DB par0ar Classic ASP Databases 0 January 3rd, 2010 10:38 PM
Posting form data from ASP.NET page to another page [email protected] BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 1 January 22nd, 2009 10:46 AM
Posting data from Control to Page bmains ASP.NET 2.0 Basics 1 December 6th, 2005 08:08 PM
ASP.NET not posting form data sqzgnlib ASP.NET 1.0 and 1.1 Basics 2 May 10th, 2005 09:59 AM
posting table data satishb Classic ASP Databases 6 November 11th, 2003 07:32 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.