Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

How can I access this option in the component and change its value?

Posted on 2009-04-23
10
Medium Priority
?
810 Views
Last Modified: 2012-05-06
Dear Friends,

I am having trouble with the timeout of a Soap Connection.  Exploring
Google Groups I have found that TSoapConnection has a property RIO, which
has a HTTPWebNode, which has timeout properties for connect, receive and
send.  But when I try to reference these properties of the SoapConnection,
I find that its read-only RIO property is nil.

I suspect I have run into an area of my ignorance here on invocable
interfaces etc.  Can anyone set me straight on this - how do I get a good
reference to the RIO property, or more broadly how can I set the timeout
for a soap connection?

Thanks,
Alex
0
Comment
Question by:hidrau
  • 6
  • 4
10 Comments
 
LVL 21

Expert Comment

by:developmentguru
ID: 24214457
The PRIO property is not established until you connect.  The TSoapConnection has OnBeforeExecute.  This is passed to the RIO object that is created during connect.  I would start by trying to provide an OnBeforeExecute method on your TSoapConnection and break the code inside that method.  You should find that you have a RIO object at that point.  Let me know if that helps.
0
 
LVL 1

Author Comment

by:hidrau
ID: 24214504
I have inserted this code in the procedure

procedure TFmenu.SoapConnection1BeforeExecute(const MethodName: String;
  var SOAPRequest: WideString);
begin
  SoapConnection1.RIO.HTTPWebNode.ConnectTimeout := 150000;
  SoapConnection1.RIO.HTTPWebNode.SendTimeout    := 150000;
  SoapConnection1.RIO.HTTPWebNode.ReceiveTimeout := 150000;

end;

But I got an exception

I noticed that this timeout is called in this unit SOAPHTTPTrans.pas

There are some options
    { Timeouts }
    if FConnectTimeout > 0 then
      Check(InternetSetOption(Request, INTERNET_OPTION_CONNECT_TIMEOUT, Pointer(@FConnectTimeout), SizeOf(FConnectTimeout)));
    if FSendTimeout > 0 then
      Check(InternetSetOption(Request, INTERNET_OPTION_SEND_TIMEOUT, Pointer(@FSendTimeout), SizeOf(FSendTimeout)));
    if FReceiveTimeout > 0 then
      Check(InternetSetOption(Request, INTERNET_OPTION_RECEIVE_TIMEOUT, Pointer(@FReceiveTimeout), SizeOf(FReceiveTimeout)));

I wonder if I change the value here could it work?


0
 
LVL 1

Author Comment

by:hidrau
ID: 24214804
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:hidrau
ID: 24215457

I haven't had any success yet. I need your help
0
 
LVL 21

Expert Comment

by:developmentguru
ID: 24216035
 There is a simpler way to solve this within your program.  Surround the call with a try-except block and retry a certain number of times if the exception lets you know that it timed out.  Not ideal, but as a last resort it will work.

  The web service you are trying to access, is it public?  Could you give me the details on how you set up your connection so I can debug on my end?

  Without this information the best I can do is tell you to try the AfterConnect event.

  If you want me to try more, give me some more detail.
0
 
LVL 1

Author Comment

by:hidrau
ID: 24216135
Ok, let me explaim:

The webserver is not a public, I created this webserver.

The problem is that my client application execute a store procedure in MS SQL 2005 that takes aproximately 3 minutes to be finished.

This is the problem.

I need to wait until my store procedure to be finished to go on.

0
 
LVL 21

Expert Comment

by:developmentguru
ID: 24216280
Have you tried the AfterConnect event yet?
0
 
LVL 1

Author Comment

by:hidrau
ID: 24216359
I got the same error :((



0
 
LVL 21

Accepted Solution

by:
developmentguru earned 1500 total points
ID: 24217800
I used a different component when I did my web service.  I used the THTTPRIO component directly.  All I had to do was fill in the WSDLLocation property and add the intf file to the uses clause, then make my call.

I used the TSOAPConnection component to connect to my SOAP based web service.  I was able to respond to the AfterConnect event and set the timeout values.

This indicates to me that the connection failed.  Once the connection is made the RIO property is set.  I mention this in an attempt to help you think it through.  Sometimes just knowing it works for someone else you find you start to think down different avenues.  I hope it helps.

By the way I am using Delphi 2007 for my test.  It could be that you are running into a bug that has been fixed in later releases.
unit Unit3;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, DBClient, SOAPConn, StdCtrls, InvokeRegistry, Rio,
  SOAPHTTPClient, WSPolydeckIntfGen;
 
type
  TMyObject = class
  private
  protected
  public
    constructor Create;
  end;
 
  TMyRecType =(rtTypeOne, rtTypeTwo, etTypeThree);
  TMyRecord =
    record
      RecID: Longint;
      RecType: TMyRecType;
      RecData: TMyObject;
    end;
 
  TForm3 = class(TForm)
    SoapConnection1: TSoapConnection;
    Button1: TButton;
    HTTPRIO1: THTTPRIO;
    procedure SoapConnection1AfterConnect(Sender: TObject);
    procedure FormDblClick(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    procedure ParamTest(Rec : TMyRecord);
    { Public declarations }
  end;
 
var
  Form3: TForm3;
 
implementation
 
{$R *.dfm}
 
procedure TForm3.Button1Click(Sender: TObject);
begin
  //Caption := (HTTPRIO1 as IWSPolydeck).DynamicProperty('HomeConnectionString');
  SoapConnection1.Connected := true;
end;
 
procedure TForm3.FormDblClick(Sender: TObject);
var
  Rec : TMyRecord;
 
begin
  FillChar(Rec, SizeOf(Rec), 0);
  ParamTest(Rec);
end;
 
procedure TForm3.ParamTest(Rec: TMyRecord);
begin
  if Assigned(Rec.RecData) then ;
 
end;
 
procedure TForm3.SoapConnection1AfterConnect(Sender: TObject);
begin
  SoapConnection1.RIO.HTTPWebNode.ConnectTimeout := 150000;
  SoapConnection1.RIO.HTTPWebNode.SendTimeout := 150000;
  SoapConnection1.RIO.HTTPWebNode.ReceiveTimeout := 150000;
end;
 
{ TMyObject }
 
constructor TMyObject.Create;
begin
 
end;
 
end.

Open in new window

0
 
LVL 1

Author Closing Comment

by:hidrau
ID: 31573720
thanks
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

575 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question