• Bernardo.Lira
  • NEWBIE
  • 0 Points
  • Member since 2007

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

We're currently working with Activa Live Chat and we need to create a salesforce Case whenever a chat session ends. This can only be done sending a form (POST) containing an XML file from the chat app to salesforce.

Managing the XML content should be quite easy, but I've been unable to understand how to read the POST'ed variables.

It's an urgent request, so any ideas will be greatly appreciated. Please let me know if you guys need any additional info to help me.

Thanks in advance

Bernardo

>>All,
>>
>>Does anyone know if it is at all possible to get access to to the POST data from a visualforce page when posting from another domain. The >>example below works fine for GET but I actually prefer to use POST if at all possible.
>>
>>-Tom
 
Nevermind,
 
I was able to get the POST values using the same technique for GET fields by using.
ApexPages.CurrentPage().getParameters()
 
only caveat is you must post to the true url in my case:
 c.cs2.visual.force.com/apex/mypage
 
luckily the $Page.mypage returns the true url.
 
Sorry about the previous Message,  my sample code seemed to hose the page so I could not reply or remove
(don't use chrome to post messages and paste code).
 
-Tom
 
 
well here is the working code:
 
Code:
<apex:page>
<h1>Wrapper to Punchout Site</h1>
 <br></br><b>Browser Post URL:</b>  {!$Page.testProxy}
 <br></br>
 <apex:iframe src="http://127.0.0.1/fakePunchout/submitPOOM.html" id="Iframe_Punchout"/>
</apex:page>

----------------------------------------------------------------
submitPOOM.html
----------------------------------------------------------------
<html>
<body>
    <h1>DEMO Punchout FORM POST</h1>
    <form action="https://c.cs2.visual.force.com/apex/testProxy" method="POST" target="_top">
  <br/><input type="text" name="cxml-urlencoded" id="payload2" value="POST Entire URL-Encoded PunchOutOrderMessage"/>
        <input type="submit" value="confirm"/>
    </form>
    <br/><br/>

 <h1>DEMO Punchout FORM GET</h1>
    <form action="https://cs2.salesforce.com/apex/testProxy" method="GET" target="_top">
     <br/><input type="text" name="cxml-urlencoded" id="payload3" value="GET Entire URL-Encoded PunchOutOrderMessage"/>
        <input type="submit" value="confirm"/>
    </form>
</body>
</html>
----------------------------------------------------------------
testProxy
----------------------------------------------------------------

<apex:page controller="testProxy" action="{!init}">
  <form>
  <h1>SFDC - DEMO PROCESS POOM</h1> 
  <br></br>
  <textarea name="payload" style="width:500px;height=400px;">{!cxml}</textarea>
  <br></br>
  {!headers}
   <br></br>
  </form>
</apex:page>
----------------------------------------------------------------
public class testProxy {
    public string cxml{get; set;}
    public string headers {get; set;}

    public PageReference init() {
     if ( ApexPages.currentPage().getParameters().get('cxml-urlencoded') != null )
         cxml = ApexPages.currentPage().getParameters().get('cxml-urlencoded');
         
        headers='';
        MAP<string, string> hdrs = ApexPages.currentPage().getheaders();
        for (string key : hdrs.keySet() )
            headers += key + ' : ' + hdrs.get(key) + '\n';
    
        return null;
    }
}

 
 
 


Message Edited by tesii on 01-06-2009 12:35 PM

Message Edited by tesii on 01-06-2009 12:36 PM