Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How To Post From A Script

Posted on 2004-03-23
3
Medium Priority
?
464 Views
Last Modified: 2010-07-27
I need to post some XML to an external web address (Java servlet on another web server) from within a shopping cart written in aspl. I need example code for how to do this. I also need to know if it can be done to an SSL address.
0
Comment
Question by:jimkat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 21

Expert Comment

by:ap_sajith
ID: 10665171
Have you looked into XMLHTTP as an option?. You can use XMLHTTP to send an XML stream to the other server and recieve the output from the other server.

eg:

Dim xmlhttp
Set xmlhttp = CreateObject("Microsoft.XMLHTTP")
'Open a connection and send a request to the server in the form of an XML fragment
xmlhttp.Open("POST", "http://www.yourserver.com/yourpage.asp", False)
xmlhttp.send("<reqtimesheet user='jimbob'/>")
Response.WRite Cmlhttp.ResponseText ' ** Use ResponseXML if an XML stream is returned **

Check out these articles for further info..

http://www.15seconds.com/issue/991125.htm
http://www.eggheadcafe.com/articles/20010209.asp

Cheers!!
0
 
LVL 28

Accepted Solution

by:
sybe earned 2000 total points
ID: 10665642
Function PostToUrl(url,data)
    Dim oXMLHttpRequest
    Set oXMLHttpRequest = Server.CreateObject("Microsoft.XMLHTTP")
    oXMLHttpRequest.Open "POST", url, False
    oXMLHttpRequest.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    oXMLHttpRequest.Send data
    PostToUrl = oXMLHttpRequest.responseText
    Set oXMLHttpRequest = Nothing
End Function
0
 
LVL 8

Expert Comment

by:fozylet
ID: 10665725
If it is SOAP...

function GetSendSoapResponse(strMessage,strURL,strAction)
      ' must create an XML document to format the request message
      Dim xmlhttp, strSoap
      Set xmlhttp = Server.CreateObject("Msxml2.ServerXMLHTTP")

      ' Build the XML/SOAP request message
      strSoap = strMessage
      ' Send the request to the server
      xmlhttp.Open "POST", strURL, False
      xmlhttp.setRequestHeader "Man", "POST " & strURL & " HTTP/1.1"
      xmlhttp.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
      xmlhttp.setRequestHeader "SOAPAction", strAction

      'send the request to the webservice
      xmlhttp.send(strSoap)

      If xmlhttp.Status = 200 Then 'if response code is OK
      GetSendSoapResponse = xmlhttp.responseText
      Else 'an error has occurred
      GetSendSoapResponse = ""
      Response.Write("Web service Server Error...<br>")
      Response.Write("status = " & xmlhttp.status)
      Response.Write("<br>" & xmlhttp.statusText)
      Response.Write("<br><pre>" & Request.ServerVariables("ALL_HTTP") & "</pre>")
      End If
      Set xmlhttp = nothing
end function
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question