function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ArunrajArunraj 

XML via HTTP POST to a sites page without parameters

Hello,

 

We are developing an XML listener (service) as a Sites page.

We are using getContent() to obtain the XML content posted (via HTTP POST) without parameters. To be more specific, this is not through a form POST.

 

When I call xmlBody.toString() based on the code below, it returns nothing.

 

VF page Coding

 

<apex:page controller="InboundProcessor" action="{!init}" showHeader="false" sidebar="false"></apex:page>

 

ApexClass Coding

 

public PageReference init() {  
   PageReference xml = new PageReference(ApexPages.currentPage().GetURL());
   Blob xmlBody = xml.getContent();

   System.debug('blobcontent::'+xmlBody);
   System.debug('xmlStringcontent::'+xmlBody.toString());

}

 

Is there any issue with getContent()?

 



Arunraj

Message Edited by Arunraj on 03-22-2010 06:16 AM
Message Edited by Arunraj on 03-22-2010 06:16 AM
TomSnyderTomSnyder

This is because you are getting the contents of your empty page not the results of the inbound post.  IFAIK, you cannot pull the enitire POST you can only pull the POST fields via getParameters(). 

 

I know this is not what you were hoping to do but a workaround would be to pass as a POST field.

 

HTTP POST: base64payload:[base64payload]

 

apex:
string xml = EncodingUtil.base64Decode(ApexPages.currentPage().getParameters().get(base64payload')).toString();

 

Message Edited by tesii on 03-22-2010 01:26 PM
narensnarens

Hi Experts,

   I am able to process the POST using Site/Visual Force Page from a sender.

How can i send immediate response to the sender (that POSTed teh original message) that message is successful. Please note that Sender's requirements is NOT to send a new POST back.

 

Any ideas?

 

I appreciate your help.

 

-Naren