EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Put() with Server Response and multiple calls to OnData()

Also by EldoS: BizCrypto
Components for BizTalk® and SQL Server® Integration Services that let you securely store and transfer information in your business automation solutions.
#24382
Posted: 03/30/2013 21:39:06
by Frank Heider (Standard support level)
Joined: 01/27/2011
Posts: 4

Hi, we use Put() from telhttpsclient to talk to our wcf service.

The response always contains a json string. Today it happenend the first time that the string was invalid (cut at some place).
After some search in the forum i found out, that OnData() can be called multiple times until the full stream is transfered.
I think that is our problem because for know we handled always the first call to OnData to proceed with the received content.

Could you please give me hint, how i could know if the last call to ondata happened?

In another thread you write: "Accumulate all OnData and go on if Get() request finishes. Is there something equivalent in Put(). Is there any event which is called when the transfer of the data is complete (like the event in TelHttpsServer).

Do i have to check the content-length in the Server Response (which is unfortunately always -1) or is there any event? OnDocumentEnd() is never called.

I hope you can help me.

Thanks Frank
#24384
Posted: 03/31/2013 03:24:27
by Eugene Mayevski (EldoS Corp.)

Indeed the data can come in multiple pieces and you can get many OnData events.

Put (as well as other TElHTTPSClient methods) is a synchronous method, i.e. it returns when the connection is closed or when the operation is executed.

You don't need to know in OnData event handler, if the connection is closed. You learn this on the next line after Put call. IF (and only IF) Put never returns, then we need to dig deeper into the problem.


Sincerely yours
Eugene Mayevski
#24397
Posted: 03/31/2013 12:26:58
by Frank Heider (Standard support level)
Joined: 01/27/2011
Posts: 4

Thanks Eugene for your quick response.

Ok i missunderstood the handling with the synchronous execution.
I changed my code now to accumulate the received data in OnData() and tried to work with the accumulated data after put execution returned (the next line you suggested before), but put() needs a very long time to go on after a successfull execution. It does not return immediately after all OnData() calls where finished.

Is this because of my evaluation license?

Thanks
#24398
Posted: 03/31/2013 12:33:59
by Eugene Mayevski (EldoS Corp.)

There can be several reasons:

1) evaluation license, which imposes certain delays (you can request a trial key that removes speed restrictions, though the key will be issued only tomorrow)

2) the server is not properly set up. What you can do is disable keep-alives (by setting PreferKeepAlive property to false) and check if this changes anything. Some servers use keep-alive even when the size of the data is not known. In this case the client doesn't know when to stop the transfer.


Sincerely yours
Eugene Mayevski
#24399
Posted: 03/31/2013 12:48:23
by Frank Heider (Standard support level)
Joined: 01/27/2011
Posts: 4

1) We already bought the license last week, so it isn´t necessary to release another trial

2) i will try this, first shot doesn´t seem to work. i´ll check the wcf server service.

Thanks for the quick response
Frank
#24400
Posted: 03/31/2013 13:05:39
by Eugene Mayevski (EldoS Corp.)

Quote
Frank Heider wrote:
We already bought the license last week, so it isn´t necessary to release another trial


If you have a license, please link the license ticket to your user account. The ticket itself and the procedure of its use are specified in the registration e-mail that was sent to you upon license purchase. If you don't have the license ticket, please contact the person from which you have obtained the license key (the one in your source code) for a license ticket.

NOTE: please don't post license keys and license tickets to the forum. If you need to clarify something about your license, please use HelpDesk ( http://www.eldos.com/helpdesk/ ).

Quote
Frank Heider wrote:
2) i will try this, first shot doesn´t seem to work. i´ll check the wcf server service.


Do you mean that disabling keep-alives didn't help and the connection remained active for some time after the data were provided? This can happen if the data generator didn't indicate the end of the data in any way so the server didn't know that it had to close connection. This is a server-side issue most likely.


Sincerely yours
Eugene Mayevski
#24423
Posted: 04/03/2013 06:09:49
by Frank Heider (Standard support level)
Joined: 01/27/2011
Posts: 4

I was on easter holiday and the licence key and email with the procedura wasn´t available to me at home.

I have added the real license now, but that has not helped at all.

Put() still waits ca. 30 sec before it goes on. OnData() is no longer called during this time.

I set "httpsClient.PreferKeepAlive = false;" which has not changed anything. Still waiting.

Our WCF Webservice on server side responses a json serialized object as stream. I can´t tell you what the wcf magic does in backround.

The service itself is configured with webhttpbinding and TransferMode = Streamed

On Clientside i collect all byte[] together in onData, nothing more. Than i wait for the returning put() to go on with the previously collected data.

How could i inform anyone client or server about the finished transfer?
What do you mean with
Quote
the data generator didn't indicate the end of the data


Thank you
#24424
Posted: 04/03/2013 06:14:51
by Eugene Mayevski (EldoS Corp.)

From your description it seems that the server does not close connection after sending the data but waits for something (I can only guess what). 30 seconds sounds like a server-side timeout for me - "if the request handler didn't pass any data for 30 seconds, shutdown the connection".

One more thing to check - please set HTTP version to 1.0 in properties. Servers behave differently depending on HTTP version set.


Sincerely yours
Eugene Mayevski
Also by EldoS: BizCrypto
Components for BizTalk® and SQL Server® Integration Services that let you securely store and transfer information in your business automation solutions.

Reply

Statistics

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