Post XML Https help PLEASE!

Discussion in 'ASP General' started by DavidT, Sep 7, 2004.

  1. DavidT

    DavidT Guest

    I need to build a valid XML file using ASP form elements, pass that "file"
    to a https url and then retrieve the ID that is returned. I can build the
    XML into a string no problem but how then heck do I go about
    posting/retrieving?

    I've come across something like this in my search:

    Dim oXML, sURL
    Dim sContents
    sURL = "https://domain/page.asp"
    Set oXML = CreateObject("MSXML2.ServerXMLHTTP")
    oXML.Open "POST", sURL, False
    oXML.SetRequestHeader "Content-Type","application/x-www-form-urlencoded"
    oXML.Send "txtUsername=Anthony&txtPassword=abcdefghi"
    GetPostResponse = oXML.responseText
    Set oXML = Nothing

    But where would my XML string to post fit into this?

    Driving me nutters. Any help is appreciated.

    Thanks

    David
    DavidT, Sep 7, 2004
    #1
    1. Advertising

  2. > oXML.Send "txtUsername=Anthony&txtPassword=abcdefghi"
    > GetPostResponse = oXML.responseText
    > Set oXML = Nothing
    >
    > But where would my XML string to post fit into this?


    Have you tried

    oXML.Send
    "txtUsername=Anthony&txtPassword=abcdefghi&xmlDataVariableName=" & xmlData

    ? How is page.asp expecting to receive the XML data?

    A
    Aaron [SQL Server MVP], Sep 7, 2004
    #2
    1. Advertising

  3. DavidT

    Jeff Cochran Guest

    On Tue, 7 Sep 2004 08:52:33 -0700, "DavidT" <>
    wrote:

    >I need to build a valid XML file using ASP form elements, pass that "file"
    >to a https url and then retrieve the ID that is returned. I can build the
    >XML into a string no problem but how then heck do I go about
    >posting/retrieving?
    >
    >I've come across something like this in my search:
    >
    > Dim oXML, sURL
    > Dim sContents
    > sURL = "https://domain/page.asp"
    > Set oXML = CreateObject("MSXML2.ServerXMLHTTP")
    > oXML.Open "POST", sURL, False
    > oXML.SetRequestHeader "Content-Type","application/x-www-form-urlencoded"
    > oXML.Send "txtUsername=Anthony&txtPassword=abcdefghi"
    > GetPostResponse = oXML.responseText
    > Set oXML = Nothing
    >
    >But where would my XML string to post fit into this?


    oXML.Send YourXMLStringVariable

    Jeff
    Jeff Cochran, Sep 7, 2004
    #3
  4. DavidT

    DavidT Guest

    Thanks Both.

    Page.asp is expecting preformated valid XML. I have a spec for that so I'm
    not to concerned. Sending via XML is new to me. I'm used to just setting up
    the DSN(less) connection and putting things directly into a db.

    Can I do multuple sends?
    oXML.Send "txtUsername=Anthony&txtPassword=abcdefghi"
    oXML.Send strXML


    "DavidT" <> wrote in message
    news:...
    > I need to build a valid XML file using ASP form elements, pass that "file"
    > to a https url and then retrieve the ID that is returned. I can build the
    > XML into a string no problem but how then heck do I go about
    > posting/retrieving?
    >
    > I've come across something like this in my search:
    >
    > Dim oXML, sURL
    > Dim sContents
    > sURL = "https://domain/page.asp"
    > Set oXML = CreateObject("MSXML2.ServerXMLHTTP")
    > oXML.Open "POST", sURL, False
    > oXML.SetRequestHeader

    "Content-Type","application/x-www-form-urlencoded"
    > oXML.Send "txtUsername=Anthony&txtPassword=abcdefghi"
    > GetPostResponse = oXML.responseText
    > Set oXML = Nothing
    >
    > But where would my XML string to post fit into this?
    >
    > Driving me nutters. Any help is appreciated.
    >
    > Thanks
    >
    > David
    >
    >
    DavidT, Sep 7, 2004
    #4
  5. DavidT

    Jeff Cochran Guest

    On Tue, 7 Sep 2004 10:16:26 -0700, "DavidT" <>
    wrote:

    >Thanks Both.
    >
    >Page.asp is expecting preformated valid XML. I have a spec for that so I'm
    >not to concerned. Sending via XML is new to me. I'm used to just setting up
    >the DSN(less) connection and putting things directly into a db.
    >
    >Can I do multuple sends?
    >oXML.Send "txtUsername=Anthony&txtPassword=abcdefghi"
    >oXML.Send strXML


    Haven't tried. I usually build the string then send it, but I'm doing
    small amounts of XML. You could find out with a quick test of course.

    Jeff


    >"DavidT" <> wrote in message
    >news:...
    >> I need to build a valid XML file using ASP form elements, pass that "file"
    >> to a https url and then retrieve the ID that is returned. I can build the
    >> XML into a string no problem but how then heck do I go about
    >> posting/retrieving?
    >>
    >> I've come across something like this in my search:
    >>
    >> Dim oXML, sURL
    >> Dim sContents
    >> sURL = "https://domain/page.asp"
    >> Set oXML = CreateObject("MSXML2.ServerXMLHTTP")
    >> oXML.Open "POST", sURL, False
    >> oXML.SetRequestHeader

    >"Content-Type","application/x-www-form-urlencoded"
    >> oXML.Send "txtUsername=Anthony&txtPassword=abcdefghi"
    >> GetPostResponse = oXML.responseText
    >> Set oXML = Nothing
    >>
    >> But where would my XML string to post fit into this?
    >>
    >> Driving me nutters. Any help is appreciated.
    >>
    >> Thanks
    >>
    >> David
    >>
    >>

    >
    Jeff Cochran, Sep 7, 2004
    #5
  6. DavidT

    DavidT Guest

    Thanks to all. I managed to get this to work. My solution was:

    Dim strXMLFile,objXml,ObjHTTP

    Set objXml= Server.CreateObject("Microsoft.XMLDOM")
    Set ObjHTTP = Server.CreateObject("MSXML2.XMLHTTP")

    objXml.loadxml strXML

    If objXML.parseError.errorCode = 0 Then

    ObjHTTP.open "POST",
    "https://www.trandotcom.com/LoanManager/QuickApp/QuickPost.ASPX", false
    ObjHTTP.setRequestHeader "Content-type", "application/xml"
    ObjHTTP.send strXML
    Response.Write(ObjHTTP.responseText)
    Else
    Response.Write(objXML.parseError.errorCode &
    objXML.parseError.reason)
    End If

    Thanks again


    "DavidT" <> wrote in message
    news:...
    > I need to build a valid XML file using ASP form elements, pass that "file"
    > to a https url and then retrieve the ID that is returned. I can build the
    > XML into a string no problem but how then heck do I go about
    > posting/retrieving?
    >
    > I've come across something like this in my search:
    >
    > Dim oXML, sURL
    > Dim sContents
    > sURL = "https://domain/page.asp"
    > Set oXML = CreateObject("MSXML2.ServerXMLHTTP")
    > oXML.Open "POST", sURL, False
    > oXML.SetRequestHeader

    "Content-Type","application/x-www-form-urlencoded"
    > oXML.Send "txtUsername=Anthony&txtPassword=abcdefghi"
    > GetPostResponse = oXML.responseText
    > Set oXML = Nothing
    >
    > But where would my XML string to post fit into this?
    >
    > Driving me nutters. Any help is appreciated.
    >
    > Thanks
    >
    > David
    >
    >
    DavidT, Sep 8, 2004
    #6
  7. What happened to txtUsername and txtPassword?

    --
    http://www.aspfaq.com/
    (Reverse address to reply.)




    "DavidT" <> wrote in message
    news:#...
    > Thanks to all. I managed to get this to work. My solution was:
    >
    > Dim strXMLFile,objXml,ObjHTTP
    >
    > Set objXml= Server.CreateObject("Microsoft.XMLDOM")
    > Set ObjHTTP = Server.CreateObject("MSXML2.XMLHTTP")
    >
    > objXml.loadxml strXML
    >
    > If objXML.parseError.errorCode = 0 Then
    >
    > ObjHTTP.open "POST",
    > "https://www.trandotcom.com/LoanManager/QuickApp/QuickPost.ASPX", false
    > ObjHTTP.setRequestHeader "Content-type", "application/xml"
    > ObjHTTP.send strXML
    > Response.Write(ObjHTTP.responseText)
    > Else
    > Response.Write(objXML.parseError.errorCode &
    > objXML.parseError.reason)
    > End If
    >
    > Thanks again
    >
    >
    > "DavidT" <> wrote in message
    > news:...
    > > I need to build a valid XML file using ASP form elements, pass that

    "file"
    > > to a https url and then retrieve the ID that is returned. I can build

    the
    > > XML into a string no problem but how then heck do I go about
    > > posting/retrieving?
    > >
    > > I've come across something like this in my search:
    > >
    > > Dim oXML, sURL
    > > Dim sContents
    > > sURL = "https://domain/page.asp"
    > > Set oXML = CreateObject("MSXML2.ServerXMLHTTP")
    > > oXML.Open "POST", sURL, False
    > > oXML.SetRequestHeader

    > "Content-Type","application/x-www-form-urlencoded"
    > > oXML.Send "txtUsername=Anthony&txtPassword=abcdefghi"
    > > GetPostResponse = oXML.responseText
    > > Set oXML = Nothing
    > >
    > > But where would my XML string to post fit into this?
    > >
    > > Driving me nutters. Any help is appreciated.
    > >
    > > Thanks
    > >
    > > David
    > >
    > >

    >
    >
    Aaron [SQL Server MVP], Sep 9, 2004
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mallya

    XML post via HTTPS

    Mallya, Oct 5, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    569
    Mallya
    Oct 5, 2004
  2. KK
    Replies:
    2
    Views:
    546
    Big Brian
    Oct 14, 2003
  3. c676228
    Replies:
    2
    Views:
    764
    c676228
    Oct 24, 2007
  4. brad
    Replies:
    4
    Views:
    145
  5. Jonathan Rochkind

    https post with xml data?

    Jonathan Rochkind, Mar 26, 2009, in forum: Ruby
    Replies:
    2
    Views:
    114
    Stephen Mautrin
    Aug 8, 2009
Loading...

Share This Page