Skip to main content

 I have a program Customer Maintenance, in the program I have set a flag to call my javascript to open a new window to my web service (PRTSERVICE).

// Load WSDL 

var wsdUrl = urlPrefix "PRTSERVICE.wsdl";

var xmlHttp = SOAPClient._getXmlHttp();

xmlHttp.open("GET", wsdlUrl, true):

xmlHttp.onreadystatechange = function() {

   If (xmlHttp.readystate == 4){

      SOAPClient_cacheWsdl[soapUrl] = xmlHttp.responseXML;

      var hostname = location.hostname;

      soap - new SOAPClientParameters()*;

      soap.add("logon-user-name", $("#bis-userid).val());

     soap.add("logon-host", hostName);

     SOAPClient.invoke(soapUrl, "logonuser", soap, true, function (r, xml){

      var resp = r["logon-user-result"]; 

      if (resp!= "0"){

       var v = xml.getElementsByTagName("faultstring");

       var str = "Unable to logon!";

      for (var i = 0; i < v.length; i ){

      str = "\\n" v.textContent;

     }

      alert(str);

     return;

    }

    isLoggedOn = true;

}

}

What I see in my logs for the web service:

service   PRTSERVICE-PATH: \\inetput\\wwwroot\\LiantBIS\\MBS\\temp/PRTSERVICE_mark

Service  LOGON Host myhost

Service  LOGON-USER-RESULT 00

XMLEXCHANGE Received exchange reponse form service

BIS      Processing{{ContentType(tex/xml)}} tab

XMLEXCHANGE   NO {{FormActionTarget}} in this exchange, sequence checking suppressed

BIS   Page Rendering Complete: service program remains active, Session remains active!

 

When I change the name for a customer on the Customer Maintenance Screen and click continue, it gives me an error.   

The trace file for Customer Maintenance is showing that a new session started.

 

Here are my srf:

Maintenance.srf

{{ Handler * }}{{//}}

{{ Trace(start, file, dir=C:\\temp)}}{{//}}

{{ContentType(text/html; charset=UTF-8) }}{{//}}

{{ Runpath(bin,..\\common) }}{{//}}

{{ XMLEchange(onExit="Goodbye.srf") }}

 

Webservice.srf

{{ Handler * }}{{//}}

{{ Trace (start,file,dir=C:\\temp) }}{{//}}

{{RunPath(..\\bin;..\\common) }}{{//}}

{{SessionParms(ServiceTimeout=90,InactivityTimeout=90,Scope=ISOLATE,Path="/liantibs/mbs_devel/WebServices/")}}{{//}}

{{StartService(PRTSERVICE) }}{{//}}

{{XMLExchange }}

 

How do I keep the Maintenance Screen at it's current session without losing its connection and starting a new session?

 


#BIS
#RMCOBOL

 I have a program Customer Maintenance, in the program I have set a flag to call my javascript to open a new window to my web service (PRTSERVICE).

// Load WSDL 

var wsdUrl = urlPrefix "PRTSERVICE.wsdl";

var xmlHttp = SOAPClient._getXmlHttp();

xmlHttp.open("GET", wsdlUrl, true):

xmlHttp.onreadystatechange = function() {

   If (xmlHttp.readystate == 4){

      SOAPClient_cacheWsdl[soapUrl] = xmlHttp.responseXML;

      var hostname = location.hostname;

      soap - new SOAPClientParameters()*;

      soap.add("logon-user-name", $("#bis-userid).val());

     soap.add("logon-host", hostName);

     SOAPClient.invoke(soapUrl, "logonuser", soap, true, function (r, xml){

      var resp = r["logon-user-result"]; 

      if (resp!= "0"){

       var v = xml.getElementsByTagName("faultstring");

       var str = "Unable to logon!";

      for (var i = 0; i < v.length; i ){

      str = "\\n" v.textContent;

     }

      alert(str);

     return;

    }

    isLoggedOn = true;

}

}

What I see in my logs for the web service:

service   PRTSERVICE-PATH: \\inetput\\wwwroot\\LiantBIS\\MBS\\temp/PRTSERVICE_mark

Service  LOGON Host myhost

Service  LOGON-USER-RESULT 00

XMLEXCHANGE Received exchange reponse form service

BIS      Processing{{ContentType(tex/xml)}} tab

XMLEXCHANGE   NO {{FormActionTarget}} in this exchange, sequence checking suppressed

BIS   Page Rendering Complete: service program remains active, Session remains active!

 

When I change the name for a customer on the Customer Maintenance Screen and click continue, it gives me an error.   

The trace file for Customer Maintenance is showing that a new session started.

 

Here are my srf:

Maintenance.srf

{{ Handler * }}{{//}}

{{ Trace(start, file, dir=C:\\temp)}}{{//}}

{{ContentType(text/html; charset=UTF-8) }}{{//}}

{{ Runpath(bin,..\\common) }}{{//}}

{{ XMLEchange(onExit="Goodbye.srf") }}

 

Webservice.srf

{{ Handler * }}{{//}}

{{ Trace (start,file,dir=C:\\temp) }}{{//}}

{{RunPath(..\\bin;..\\common) }}{{//}}

{{SessionParms(ServiceTimeout=90,InactivityTimeout=90,Scope=ISOLATE,Path="/liantibs/mbs_devel/WebServices/")}}{{//}}

{{StartService(PRTSERVICE) }}{{//}}

{{XMLExchange }}

 

How do I keep the Maintenance Screen at it's current session without losing its connection and starting a new session?

 


#BIS
#RMCOBOL

I am not a JavaScript expert - actually far from it - but I believe that it is going to be up to your JS client to save the session cookie (which in BIS is named BISKIT) and cause it to be sent with subsequent requests for that session.  The BIS request handler looks for the BISKIT cookie in the incoming request and uses the value to associate the request with an existing session.

That having been said, I would strongly recommend that you use stateless web services to achieve your objectives.  Since your client must be responsible for maintaining the session cookie for a stateful implementation, you might as well rethink your authentication (login) mechanism.  You can authenticate a user on each request, or if your authentication is somehow more complex that username/password you can authenticate the user and provide a token back to the client that must be present in each subsequent request.  If you need further suggestions about how to do this, I will be happy to help.

As far as the actual maintenance program is concerned, you might think that you need to have a session so that you can hold a lock on a record while the user changes the record.  This type of implementation is called pessimistic concurrency, and is quite typical of most RM/COBOL 'green screen' programs that I have seen, because (1) pessimistic concurrency is easier to program for, and (2) it was directly supported by the record locking scheme available in RM/COBOL.

I suggest that you consider optimistic concurrency, where somehow the state of a record (a customer record in your example) is maintained.  This is described in quite a bit of detail in the document Xcentrisity BIS Tutorial that is installed with BIS.  The web service is stateless and can detect that the record the client is trying to update has changed since the record was sent to the client.  This is the optimistic part - normally the record will not have changed and the update changes can be committed to the file.  In the rare situation where two users are working on the same record, one of the users (the last one to submit his changes) is going to get back a status of 'record changed'.

Maintaining a session so you can maintain a record lock is full of traps and nastiness that stateless, optimistic concurrency does not have.  The cost is a slightly more complex client that can respond to an error status of 'record changed' and allow the user to react to the change.


 I have a program Customer Maintenance, in the program I have set a flag to call my javascript to open a new window to my web service (PRTSERVICE).

// Load WSDL 

var wsdUrl = urlPrefix "PRTSERVICE.wsdl";

var xmlHttp = SOAPClient._getXmlHttp();

xmlHttp.open("GET", wsdlUrl, true):

xmlHttp.onreadystatechange = function() {

   If (xmlHttp.readystate == 4){

      SOAPClient_cacheWsdl[soapUrl] = xmlHttp.responseXML;

      var hostname = location.hostname;

      soap - new SOAPClientParameters()*;

      soap.add("logon-user-name", $("#bis-userid).val());

     soap.add("logon-host", hostName);

     SOAPClient.invoke(soapUrl, "logonuser", soap, true, function (r, xml){

      var resp = r["logon-user-result"]; 

      if (resp!= "0"){

       var v = xml.getElementsByTagName("faultstring");

       var str = "Unable to logon!";

      for (var i = 0; i < v.length; i ){

      str = "\\n" v.textContent;

     }

      alert(str);

     return;

    }

    isLoggedOn = true;

}

}

What I see in my logs for the web service:

service   PRTSERVICE-PATH: \\inetput\\wwwroot\\LiantBIS\\MBS\\temp/PRTSERVICE_mark

Service  LOGON Host myhost

Service  LOGON-USER-RESULT 00

XMLEXCHANGE Received exchange reponse form service

BIS      Processing{{ContentType(tex/xml)}} tab

XMLEXCHANGE   NO {{FormActionTarget}} in this exchange, sequence checking suppressed

BIS   Page Rendering Complete: service program remains active, Session remains active!

 

When I change the name for a customer on the Customer Maintenance Screen and click continue, it gives me an error.   

The trace file for Customer Maintenance is showing that a new session started.

 

Here are my srf:

Maintenance.srf

{{ Handler * }}{{//}}

{{ Trace(start, file, dir=C:\\temp)}}{{//}}

{{ContentType(text/html; charset=UTF-8) }}{{//}}

{{ Runpath(bin,..\\common) }}{{//}}

{{ XMLEchange(onExit="Goodbye.srf") }}

 

Webservice.srf

{{ Handler * }}{{//}}

{{ Trace (start,file,dir=C:\\temp) }}{{//}}

{{RunPath(..\\bin;..\\common) }}{{//}}

{{SessionParms(ServiceTimeout=90,InactivityTimeout=90,Scope=ISOLATE,Path="/liantibs/mbs_devel/WebServices/")}}{{//}}

{{StartService(PRTSERVICE) }}{{//}}

{{XMLExchange }}

 

How do I keep the Maintenance Screen at it's current session without losing its connection and starting a new session?

 


#BIS
#RMCOBOL
Javascript scripts normally do not do any cookie management - in fact, their access to cookies is restricted.

For XHR, the CORS specification states that the Javascript host (the browser or other user agent, or whatever else is executing the script) should manage cookies if and only if the request is made with the withCredentials property set to true, and then only if the server agrees to a credentialed exchange. See http://www.w3.org/TR/cors/.

I agree with Tom that stateless (RESTful) requests are preferable, if feasible. They have a number of advantages.