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
ranizraniz 

How to send xml in a Http post request and read the data

Hi,

I need to be able to receive a pdf form in xfdf format (xml) inside my force.com application.

Currently I am able to post (HTTP POST) the data to the server.

But does anyone know how can I access the body of the request from an apex class (be it a controller or otherwise) and parse it?

I cannot name the data to imitate the posing of a form...

Thanks in advance

Walter@AdicioWalter@Adicio

do you mean parsing the xml in the response? wouldnt that be something like this...

 

httpRequest req = new httpRequest();

httpResponse res = http.send(req);

string xmlString = res.getBody();

XmlStreamReader xsr = new XmlStreamReader(xmlString);

 

ranizraniz

Thanks very much Walter for the fast reply.

Perhaps I did not explain myself that well. I'm sending the request from an external client.

My aim is to be able to access the xml (sent by the client in the body of the POST request) inside force.com app in some way.

The actual parsing of the xml is less problematic once I'll know how to access it.

Would you happen to know how to do that?

 

I have tried creating a page backed by a controller to receive the call. But I do not know how to get the body of the request. The currentpage has nly m,ethods to get named parameters (whether in queryString or in POST body)

 

MattyPMattyP

*Bump*

 

Anyone? Anyone at all?

 

If searched and searched on sending XML to a REST HttpPost service and found almost nothing. A snippet of JSON.

 

I know that the XML needs to be encased in a <service> tag. I've learned that through trial and errors.

 

Help, anyone.

sreejasreeja
hi rainz, can you please provide you email id, i have a small doudt