EldoS | Feel safer!

Software components for data protection, secure storage and transfer

HttpClient to send a SOAP-request

Also by EldoS: Solid File System
A virtual file system that offers a feature-rich storage for application documents and data with built-in compression and encryption.
#28821
Posted: 03/18/2014 11:25:54
by Toni Santa (Standard support level)
Joined: 05/27/2013
Posts: 57

Hi,
I would like to use the TElHttpsClient component to send a SOAP-request to a server, this in replacement of the standard VCL THTTPReqResp. If I use the .Post-method, the OutputStream is nil. With the .Get-method where will I've to put the request (stream or string)? It must be simple but I cannot figure out where to assign the stream or string containig the soap-request.
best regards
Toni
#28822
Posted: 03/18/2014 11:29:23
by Eugene Mayevski (EldoS Corp.)

OutputStream is for receiving server response. And it's you who sets the property.

GET verb doesn't expect the data to be sent to the server. With GET request parameters are passed in the URL itself, after ? (question mark) character.


Sincerely yours
Eugene Mayevski
#28823
Posted: 03/18/2014 11:39:34
by Toni Santa (Standard support level)
Joined: 05/27/2013
Posts: 57

Will this mean, I've to add the entire text of the soaprequest (it's an very long xml-stream) hehind the ? (question mark)?
When trying this, I reveive an "Connection lost (error code is 10058)"-message. What will this mean?
best regards
Toni
#28824
Posted: 03/18/2014 11:40:08
by Eugene Mayevski (EldoS Corp.)

You must use POST method.


Sincerely yours
Eugene Mayevski
#28825
Posted: 03/18/2014 11:44:45
by Toni Santa (Standard support level)
Joined: 05/27/2013
Posts: 57

But the Post-method is not blocking. And how can I retrieve the response?
Toni
#28826
Posted: 03/18/2014 11:53:31
by Eugene Mayevski (EldoS Corp.)

Quote
Toni Santa wrote:
But the Post-method is not blocking.


What do you mean? All methods of TElHTTPSClient are synchronous.

Quote
Toni Santa wrote:
And how can I retrieve the response?


Use OutputStream property. You must assign an instance of some Stream class to this property before calling the transport method such as GET or POST.


Sincerely yours
Eugene Mayevski
#28827
Posted: 03/18/2014 12:13:04
by Roland Kossow (Standard support level)
Joined: 05/16/2013
Posts: 29

Hi Toni,
I guess you need o use OnDocumentBegin, OnData and OnDoucmentEnd.
Perhabs even OnDocumentEnd is sufficient.
You can use ElHTTPSClient1.ContentLength to get the length of the response and access OutputStream to get the response data.

Am I right Eugene?

Best regards

Roland
#28828
Posted: 03/18/2014 12:14:59
by Eugene Mayevski (EldoS Corp.)

As said, POST method is blocking and events exist mainly for progress/logging purpose). Just set OutputStream.


Sincerely yours
Eugene Mayevski
#28829
Posted: 03/18/2014 12:44:50
by Roland Kossow (Standard support level)
Joined: 05/16/2013
Posts: 29

Ok I understood - I posted before I read your previous answer.
#28830
Posted: 03/18/2014 12:55:01
by Toni Santa (Standard support level)
Joined: 05/27/2013
Posts: 57

Quote
You must assign an instance of some Stream class to this property before calling the transport method such as GET or POST.

I was missing this one. Now I can Post the request but I receive an Access Violation in the Post-method.
my code is:
Code
var
  Stream: TMemoryStream;
begin
..
  Stream := TMemoryStream.Create;
  try
    HttpsClient.OutputStream := Stream;
    HttpsClient.Post(edURL.Text, Request.Text);
...


the Request.Text is the SOAP-XML.

best regards
Toni
Also by EldoS: Solid File System
A virtual file system that offers a feature-rich storage for application documents and data with built-in compression and encryption.

Reply

Statistics

Topic viewed 2391 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!