• DLJ
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

Hi,

 

 I have an external application that sends an XML string with a HTTP Post to a sites page. The page then will treat the data from the XML, put it in Salesforce and show the results. The system works fine for 95% of the time. In the other 5% an XML is send but the ApexPages.currentPage().getParameters() returns no parameters at all.

 I don't now why. Can anybody help?

 Here is an example body of the HTTP Post that fails, the XML is urlencoded:

XML=%3C%3Fxml+version%3D%221.0%22+encoding%3D%22ISO-8859-1%22%3F%3E%0A%3CMESSAGES%3E%0A%3CMSG+TYPE%3D%22CONTENT%22%3E%0A%3CMSG_ID%3E0155295396%3C%2FMSG_ID%3E%0A%3CBODY%3E265+melanie_staes%40hotmail.com+M%E9lanie+Staes%3C%2FBODY%3E%0A%3CFROM+PROVID%3D%221%22%3E0032476513719%3C%2FFROM%3E%0A%3CTO%3E8863%3C%2FTO%3E%0A%3CTIMESTAMP%3E20101021200459%3C%2FTIMESTAMP%3E%0A%3C%2FMSG%3E%0A%3C%2FMESSAGES%3E%0A

 

 Here is some VBA code that I use to test the system with Excel:

Public Sub SendHTTPPost(ShowResultPage As Boolean)

    Dim objHTTP As Object

    Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")

    objHTTP.Open "POST", Sheets("Parameters").Range("B2").Value, False

    objHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" ' "text/xml"

    objHTTP.send ("XML=" & Sheets("Parameters").Range("B5").Value)

    If (ShowResultPage) Then

        SaveTextToFile Sheets("Parameters").Range("B7").Value, objHTTP.ResponseText, True

        Sheets("Parameters").Range("B7").Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True

    End If

End Sub

Thx on beforehand!

  • October 28, 2010
  • Like
  • 0

Hi everyone,

 

Does anyone have any experience/example code with setting a sites page to function as a listener/handler for an http POST?  

 

Thanks!