Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 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 .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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.
Reply With Quote
  #2 (permalink)  
Old October 31st, 2010, 12:54 PM
J_P J_P is offline
Authorized User
Points: 48, Level: 1
Points: 48, Level: 1 Points: 48, Level: 1 Points: 48, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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
Reply With Quote
  #3 (permalink)  
Old October 31st, 2010, 07:02 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
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.
Reply With Quote
  #4 (permalink)  
Old October 31st, 2010, 07:03 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
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.
Reply With Quote
  #5 (permalink)  
Old October 31st, 2010, 09:14 PM
J_P J_P is offline
Authorized User
Points: 48, Level: 1
Points: 48, Level: 1 Points: 48, Level: 1 Points: 48, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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.
Reply With Quote
  #6 (permalink)  
Old November 1st, 2010, 03:12 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
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.
Reply With Quote
  #7 (permalink)  
Old November 2nd, 2010, 02:41 PM
J_P J_P is offline
Authorized User
Points: 48, Level: 1
Points: 48, Level: 1 Points: 48, Level: 1 Points: 48, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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...
Reply With Quote
  #8 (permalink)  
Old November 2nd, 2010, 04:20 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
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.
Reply With Quote
  #9 (permalink)  
Old November 2nd, 2010, 05:03 PM
J_P J_P is offline
Authorized User
Points: 48, Level: 1
Points: 48, Level: 1 Points: 48, Level: 1 Points: 48, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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.
Reply With Quote
  #10 (permalink)  
Old November 2nd, 2010, 05:12 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
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.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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 sastry532@gmail.com 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



All times are GMT -4. The time now is 07:15 AM.


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