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
Solved

How To Post From A Script

Posted on 2004-03-23
3
460 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
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 500 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

808 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