You need to sign in to do that
Don't have an account?
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
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();
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