on 06-29-2005 7:38 PM
I have a windows service, and in the startup parameters I have "-aAPPName -gerddb1 -xsapgw00". Upon the service starting up, it connects to the SAP Gateway like its suppose too. If Gateway is disconnected, either by SMGW or an network issue, the service never knows the gateway connection is gone. How can I monitor this and re-establish the connection? Thanks for any input.
hello guys .. i have used windows 2003 sp1, java 1_4_0_12,oracle 9.2 as my rdbms for my ECC5.0 installation but dont know how to log in to my oracle to try or to execute sql statements???
i wud be soo glad if some one can help me out in this issue....thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This code works when network connection is lost, but it doesnt if SAP shutdown. What I did to handle this was create antoher server on the exception event and replace the old one with the new one and execute the start method. This makes the server try to connect and trigger the event again and again until connection is made (SAP becomes online again). Remember to remove the old server, else you will end with an out of memory error. I also tried to add more servers that means different SAP servers with an array of hosts. On the error event I used the method container to get the server host and remove the old server and add the new one. This might seem to be an old fashion non efficient way, but thats the only thing I could imagine to overcome this issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Forgot to include code... here is the sample of what I did.
public override ActionOnServerException OnServerException ( SAP.Connector.SAPServer server , System.Exception e )
{
Thread.Sleep(5000);
this.AppEventLog = new System.Diagnostics.EventLog();
((System.ComponentModel.ISupportInitialize)
(this.AppEventLog)).BeginInit();
this.AppEventLog.Log = "Application";
this.AppEventLog.Source = "Biztalk SAP MonitorStub";
((System.ComponentModel.ISupportInitialize)
(this.AppEventLog)).EndInit();
host = (SAPInstance) server.Container;
//-abiztalk_monitor_stub -gtvasapdes -xsapgw00
string strConn = "-a" + server.ProgramID + " -g" + server.SAPGatewayHost + " -x" + server.SAPGatewayService;
oNewServer = new IFACServerStub.IFACServerStubImpl(strConn.Split(' '), host);
oNewServer.Start();
host.RemoveSAPServer(server);
return ActionOnServerException.Reconnect;
}
PS .- Dont forget to replace IFACServerStub.IFACServerStubImpl with your own RFC implementation!!!!!
I am having the same issue, but I'm not following why I should create an inherited version of SAPServerHost and override the OnServerException.
How does this reestablish a lost connection? How does it check if the connection was lost?
If possible, please provide an example.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Let me explain the concept a bit: If you have an RFC server application, you will have one or more instances of class(es) inherited from SAPServer. Each of these instances handles a connection to a SAP gateway. You can even have multiple instances to the same - in the sample 3 instances are created.
Now these instances need a place where they live. This place is called SAPServerHost. It forms a "container" for all the SAPServer instances. This container is also notified whenever one of the SAPServer instances gets and exception, e.g. because the connection to the SAP server is lost. This is exactly the moment when OnServerException is called.
On the return of this message you specify, what should happend with the SAPServer instances that had the exception: If it should reconnect or cancel. You can can do anything else you want in this method to handle the error.
So when the connection is lost (OnServerException is called), the server attempts to make the connection again (if you return reconnect).
If this attempt to reconnect fails will the server try again? What is the difference between .Reconnect and .Autoreconnect. Should there be a slight wait betweet reconnect attempts?
Is the following code correct? Am I missing anything? I've omitted the try..catch parts. Thanks.
'In Service1.vb
Public Class MyServerHost
Inherits SAP.connector.SAPServerHost
Public Overrides Function OnServerException(ByVal server As SAP.Connector.SAPServer, ByVal e As System.Exception) As SAP.Connector.ActionOnServerException
Return ActionOnServerException.Reconnect
End Function
Public Sub New()
MyBase.New()
End Sub
End Class
Public Class Serv
Inherits System.ServiceProcess.ServiceBase
Protected Overrides Sub OnStart(ByVal args() As String)
Dim sr As System.IO.StreamReader
sr = System.IO.File.OpenText(ini)
myargs(0) = sr.ReadLine
myargs(1) = sr.ReadLine
myargs(2) = sr.ReadLine
Dim Host As MyServerHost = New MyServerHost
Dim I As Integer
Dim Server As SAPProxy1Impl
Server = New SAPProxy1Impl(myargs, Host)
Host.Start
End Sub
End Class
Your code is correct. The difference between Reconnect and AutoReconnect is exactly the wainting time you mentioned.
"Reconnect" would immediately reconnect, so you would better imlement the waiting in your "OnServerException".
"AutoReconnect" waits for a configurable time. The time (in seconds) can be specified in your condig file as AppSettings entry with key "SAP.Connector.SAPServer.ReconnectInterval".
We had this a couple of time before: Create you own inherited version of SAPServerHost, override OnServerException and return the adequate value.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
My Problem is that SAP connect via RFC to Gateway to my Windows Service to retrieve information. So how to I get this SAPServerHost class to inherit from the original SAPServerHost. My Service is purely a listener.I just have a SapServer proxy class. I start the SAPServerHost from within my Windows Service which is the base class.
Hi,
Derive your own server host class from Superegos and override the function ActionOnServerException somehow like this:
public class MyServerHost:SAPServerHost
{
public override ActionOnServerException OnServerException(SAPServer server, Exception e)
{
...
return ActionOnServerException.Terminate;
}
...
}
Then you can declare a member variable of type MyServerHost in your service class and create a host instance and one or more server instances in InitializeComponent(). You Start the SAP server in the
OnStart() overide of your service class:
protected override void OnStart()
{
...
myHost.Start();
...
}
Regards,
Guangwei Li
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.