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
CloudConversionCloudConversion 

Access HTTP Post Body via Sites?

Has anyone figured out a way to access to the HTTP body of a post to a Salesforce site?  We're basically looking for an unauthenticated servlet type listener using Sites.


Thanks,
Jon

 

Andy BoettcherAndy Boettcher

Is this your own Site that you're trying to "listen" to?

CloudConversionCloudConversion

Yes, we're trying to Post to a Salesforce Site and grab the http body in Apex.  I don't think it's currently possible, so hopefully it's coming in the Spring '12 release...

 

Thanks,
Jon 

Andy BoettcherAndy Boettcher

You should be able to do that - essentially it sounds like the same process that you would utilize when consuming a RESTful Web Service.  Check out this link (Apex Dev Guide - http://bit.ly/v2mKwt).

 

Follow through the same motions as you would do if you were consuming a RESTful Web Service - parse out the HTML you receive back and see what it yields you.

 

-Andy

 

 

 

CloudConversionCloudConversion

Yeah, we're familiar with the HTTP methods, but they don't apply with a standard Salesforce Site VisualForce/Apex Controller.

Andy BoettcherAndy Boettcher

Why not?  You're creating an HTTPRequest, submitting it, and reading the HTTPResponse back.  That Response should have the entire body of the page in the .getBody method.  As long as you don't exceed the 3MB heap, you should be able to parse through the body and get what you need?

CloudConversionCloudConversion

No, we're not creating an HTTP Request in Apex.  An outside service is posting to a Salesforce Site like http://ecs-custom-developer-edition.na12.force.com and we're trying to grab the http body here...  We're able to grab the HTTP Parameters, but there doesn't appear to be any way to grab the HTTP body.  Does that make sense?

 

Thanks,
Jon 

Andy BoettcherAndy Boettcher

AAAHHHHH!  *bing!*

 

I get what you're trying to do now.  The reverse of what I was thinking (naturally)  =)

 

If you have a Controller behind your Sites page, and you can access the HTTP Parameters - what else on the HTML body that you don't already control via the Controller and VF do you need to grab?