🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.webservices.soap
4 messages
4 total messages Started by mg Wed, 02 Jul 2008 13:20
C++ builder 6 and web service
#44
Author: mg
Date: Wed, 02 Jul 2008 13:20
16 lines
1397 bytes
Hi,
I've a problem using webservice in my client application.

My program use webservice linked by "WSDL Import" command.

WebService has a function "AddNewPhoto(const TByteDynArray photoStream)" 
that transfer an image (stream of byte) from local pc to
web.

For some reason i receive an error that i can't intercept (using
try..catch); probabily caused by a timeout (the image is not big, less
than 1 MByte).

How i can catch this error or increase time before timeout error?

Thanks
Re: C++ builder 6 and web service
#45
Author: Jean-Marie Babet
Date: Thu, 03 Jul 2008 20:06
41 lines
2490 bytes
Hello Mg,

I'm not sure if the CBuilder 6 version of the component exposed the timeout
properties back then. Basically we use WinInet for the HTTP transport and
the latter has APIs to set the timeout. You may need to change your copy of
SOAPHTTPTrans.pas directly to add this functionality and then build with
that .pas file or with an .obj created from that .pas. The logic must be
added to THTTPReqResp.Send as follows:


Request := nil;
  try
    Request := HttpOpenRequest(FInetConnect, 'POST', PChar(FURLSite), nil,
      nil, Pointer(AcceptTypes), Flags, Integer(Self));
    Check(not Assigned(Request));

   {Here's the code added for timeout support }
    if _ConnectTimeout > 0 then
      Check(not InternetSetOption(Request, INTERNET_OPTION_CONNECT_TIMEOUT,
Pointer(@_ConnectTimeout), SizeOf(_ConnectTimeout)));
    if _SendTimeout > 0 then
      Check(not InternetSetOption(Request, INTERNET_OPTION_SEND_TIMEOUT,
Pointer(@_SendTimeout), SizeOf(_SendTimeout)));
    if _ReceiveTimeout > 0 then
      Check(not InternetSetOption(Request, INTERNET_OPTION_RECEIVE_TIMEOUT,
Pointer(@_ReceiveTimeout), SizeOf(_ReceiveTimeout)));
    {End of code added for timeout support }

    { SOAPAction header }
    ActionHeader:= GetSOAPActionHeader;
    HttpAddRequestHeaders(Request, PChar(ActionHeader),
Length(ActionHeader), HTTP_ADDREQ_FLAG_ADD);


In later versions _ConnectTimeout, _SendTimeout and _ReceiveTimeout are
fields of the class [with the leading '_' as 'F']. In your case you can have
them as global variables that you can set as needed.

Cheers,

Bruneau
Re: C++ builder 6 and web service
#46
Author: max
Date: Fri, 04 Jul 2008 14:44
52 lines
2972 bytes
"Jean-Marie Babet" <bbabet@borland.com> wrote:
>Hello Mg,
>
>I'm not sure if the CBuilder 6 version of the component exposed the timeout
>properties back then. Basically we use WinInet for the HTTP transport and
>the latter has APIs to set the timeout. You may need to change your copy of
>SOAPHTTPTrans.pas directly to add this functionality and then build with
>that .pas file or with an .obj created from that .pas. The logic must be
>added to THTTPReqResp.Send as follows:
>
>
>Request := nil;
>  try
>    Request := HttpOpenRequest(FInetConnect, 'POST', PChar(FURLSite), nil,
>      nil, Pointer(AcceptTypes), Flags, Integer(Self));
>    Check(not Assigned(Request));
>
>   {Here's the code added for timeout support }
>    if _ConnectTimeout > 0 then
>      Check(not InternetSetOption(Request, INTERNET_OPTION_CONNECT_TIMEOUT,
>Pointer(@_ConnectTimeout), SizeOf(_ConnectTimeout)));
>    if _SendTimeout > 0 then
>      Check(not InternetSetOption(Request, INTERNET_OPTION_SEND_TIMEOUT,
>Pointer(@_SendTimeout), SizeOf(_SendTimeout)));
>    if _ReceiveTimeout > 0 then
>      Check(not InternetSetOption(Request, INTERNET_OPTION_RECEIVE_TIMEOUT,
>Pointer(@_ReceiveTimeout), SizeOf(_ReceiveTimeout)));
>    {End of code added for timeout support }
>
>    { SOAPAction header }
>    ActionHeader:= GetSOAPActionHeader;
>    HttpAddRequestHeaders(Request, PChar(ActionHeader),
>Length(ActionHeader), HTTP_ADDREQ_FLAG_ADD);
>
>
>In later versions _ConnectTimeout, _SendTimeout and _ReceiveTimeout are
>fields of the class [with the leading '_' as 'F']. In your case you can have
>them as global variables that you can set as needed.
>
>Cheers,
>
>Bruneau
>
>
Thanks a lot.

I've modified has you say, but some question. 
[1]
You said "...and then build with that .pas file or with an .obj created from that .pas...". What means? I must include that .pas in my project and then build all, or what?
[2]
You said "...In your case you can have them as global variables that you can set as needed...". What means? I must set these variables in file SOAPHTTPTrans.pas before build my project or where?
Re: C++ builder 6 and web service
#48
Author: Jean-Marie Babet
Date: Sun, 13 Jul 2008 19:36
37 lines
2346 bytes
Hello,

> I've modified has you say, but some question.
> [1]
> You said "...and then build with that .pas file or with an .obj created
from that .pas...". What means? I must include that .pas in my project and
then build all, or what?


Yes, you can add the .pas file to your project. This is the fastest
approach. However, if you have lots of projects, it might be easier to
rebuild the .hpp and .obj file after you've applied the change, then insert
the .obj in the .lib. The latter will be useful in cases where you have the
libraries checked in and you want to update everyone.


> [2]
> You said "...In your case you can have them as global variables that you
can set as needed...". What means? I must set these variables in file
SOAPHTTPTrans.pas before build my project or where?

Yes, I was suggesting that you declare the 3 variables [_xxxxTimeout] as
global variables in the interface section of SOAPHTTPTrans.pas. When you
rebuild the file, SOAPHTTPTrans.hpp will contain these 3 variables as
extern. That way your C++ code can set them to something > 0 so the calls to
WinInet are executed at runtime.


Feel free to email me a copy of you SOAPHTTPTrans.pas and I'll be happy to
modify the file to illustrate. I can probably find a copy of CBuilder6
around and rebuild the .hpp and .obj for you too.

Cheers,

Bruneau

PS: I can be reached at bbabet at codegear dot net.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads