Try OpenEdge Now
skip to main content
Web Services
Creating OpenEdge SOAP Web Services : Sample Code with SOAP Messages for OpenEdge Web Services : Consuming a session-managed Web service

Consuming a session-managed Web service

To access a session-managed Web service, you maintain connection context by passing object ID's associated with each request.
To begin using a session-managed Web service:
1. Instantiate (create) the AppObject as appropriate for the client platform.
2. Connect to an AppServer by calling the connect method on the AppObject before calling any other Web Service (AppObject) method.
3. Obtain the AppObject ID value from the SOAP response header for the connect method and use it for all subsequent calls to methods on the session-managed AppObject.
4. Invoke any available methods on the AppObject, as required.
5. Ensure that the last method you invoke on the AppObject is the object's release method. For more information, see Releasing an object.
As with other Open Clients, there is no ABL involved in implementing the connect method on an AppObject. For Web services, however, the operation is an object method that is required by the WSA.
This is a VB.NET declaration for an AppObject connect method, Connect_OrderInfo( ):

VB.NET prototype for an AppObject Connect_Object method

Public Sub Connect_OrderInfo(
              ByVal userId As String,
              ByVal password As String,
              ByVal appServerInfo As String)
Note: For more information on the parameters to this method, see the sections on connecting to an AppServer in OpenEdge Development: Open Client Introduction and Programming. Note that there is no AppServer URL parameter. For a Web service (unlike other Open Client applications), the deployer manages the AppServer connection information for each Web service through the WSA instance where the Web service is deployed. Each deployed Web service has writable properties to specify this information. For more information, see the sections on Web service deployment in OpenEdge Application Server: Administration.
When the client executes the connect method, the SOAP response message contains a SOAP header with the AppObject ID. You must send this AppObject ID in the SOAP header of the request message for every subsequent method call on the AppObject. How you handle the SOAP header and AppObject ID depends on your client type. For some clients, such as .NET, this process is automated. For other clients, such as ABL and Java, you need to create the code to handle this yourself. For more information on handling SOAP headers and object IDs, see Handling SOAP Message Headers in ABL and Developing a Java Client to Consume OpenEdge SOAP Web Services.
This is a sample instantiation and invocation of the connect method on the OrderInfo AppObject:

VB.NET client code for the connect method on AppObject, OrderInfo

webService = New OrderSvc.OrderInfoObj( )
webService.Connect_OrderInfo( "", "", "" )
This is a sample Doc/Lit SOAP request message that might be generated from invoking the Connect_OrderInfo( ) method, as in the example:

SOAP connect request for AppObject, OrderInfo

<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope namespaces defined here...>
    <Connect_OrderInfo xmlns="urn:OrderSvc:OrderInfo">
<userId />
 <password />
     <appServerInfo />
Note the data for the request highlighted in the example for parameters passed as empty strings.
This is a sample Doc/Lit SOAP response that might be generated by the WSA as a response to the Connect_OrderInfo( ) method:

SOAP response to OrderInfo AppObject connect request

<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope namespaces defined here...>
  <OrderInfoID xmlns="urn:OrderSvc:OrderInfo">
  <Connect_OrderInfoResponse xmlns="urn:OrderSvc:OrderInfo" />
Note the value for the returned AppObject ID, OrderInfo, highlighted in the example. Thus, the SOAP response header returns the following AppObject ID contained in the OrderInfoID element: