EldoS | Feel safer!

Software components for data protection, secure storage and transfer

how to add XML Data in a POST with elHtppsclient?

Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.
#29779
Posted: 06/13/2014 07:45:47
by Walter Schrabmair (Priority Standard support level)
Joined: 05/03/2013
Posts: 150

Hi,
After my analyses of a website, there is a POST done with some XML data (besides some cookies and other headers.) I know how I prepare the Headers. But how can I POST my XLM data? Can there anyone provide a simple example, please?
Thanks
#29780
Posted: 06/13/2014 07:49:12
by Eugene Mayevski (EldoS Corp.)

With POST there can be no simple example because you need to know exactly in which format you have to post the data. When the browser POSTs the web form, there's a complex structure posted. But in general the data can be posted as is, in which case Post() method overload that accepts Content (a string or a stream) will work for you.


Sincerely yours
Eugene Mayevski
#29781
Posted: 06/13/2014 07:51:01
by Vsevolod Ievgiienko (EldoS Corp.)

Hello.

There are two ways to do this:

1) use one of TElHTTPSClient.Post overloads like

Code
function Post(const URL: string; Content: string): integer;


where Content parameter contains the XML.

2) Use TElRESTClient and its

Code
function Post(const URL: string; Content: TElXMLDOMDocument): integer;


method if your XML was constructed using TElXMLDOMDocument class.
#29782
Posted: 06/13/2014 08:03:57
by Walter Schrabmair (Priority Standard support level)
Joined: 05/03/2013
Posts: 150

thanks Vsevolod Ievgiienko, I will use method 1) but the XML Content is about byte long. Too long for a string. How can it be done with a stream ?
Thanks
#29783
Posted: 06/13/2014 08:06:51
by Vsevolod Ievgiienko (EldoS Corp.)

You can create an instance of TMemoryStream or TFileStream depending on your content location and then pass this stream to another Post overload:

Code
function Post(const URL: string; Content: TStream; CloseStream: Boolean = False): integer;
#29787
Posted: 06/13/2014 11:34:13
by Walter Schrabmair (Priority Standard support level)
Joined: 05/03/2013
Posts: 150

Thanks a lot.
My Problem is now following.
I tried it with Eldos but as there are complex JScripts on the website, I decided to use TWebbrowser. It works fine. I could successfully see the resulting PDF in the Browser. But how can I save it to a PDF FIle with TWebbrowser?
Please help, I tried it now a while, whithout success.
thanks
#29788
Posted: 06/13/2014 11:38:34
by Eugene Mayevski (EldoS Corp.)

Quote
Walter Schrabmair wrote:
I could successfully see the resulting PDF in the Browser. But how can I save it to a PDF FIle with TWebbrowser?


I suggest you ask on StackOverflow as this question is not related to our products in any way.


Sincerely yours
Eugene Mayevski
Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.

Reply

Statistics

Topic viewed 479 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!