Try OpenEdge Now
skip to main content
Web Services
Creating OpenEdge SOAP Web Services : Sample Code with SOAP Messages for OpenEdge Web Services : Creating and using a ProcObject : ProcObject class factory methods
 
ProcObject class factory methods
This is the ABL prototype for the persistent procedure that runs for the sample ProcObject class factory method, CreatePO_CustomerOrder( ):

ABL prototype for a persistent procedure to implement a ProcObject

/* CustomerOrder.p */

DEFINE INPUT PARAMETER custNum AS INTEGER.
Note: The parameter list for the persistent procedure that runs for the ProcObject class factory method is AppServer application dependent, and is the basis for creating the parameter list of the ProcObject class factory method. A persistent procedure can also be specified in ProxyGen to return a string value using the ABL RETURN statement.
This is a VB.NET declaration for the ProcObject class factory method, CreatePO_CustomerOrder( ):

VB.NET prototype for the ProcObject CreatePO_CustomerOrder method

Public Function CreatePO_CustomerOrder
       (ByVal custNum As Integer) As String
Note: This method maps to a persistent procedure that has been specified to return the string from the ABL RETURN-VALUE function.
The following code snippet:
1. Instantiates the ProcObject on the client, enabling access to its methods.
2. Calls the CreatePO_CustomerOrder( ) method on the AppObject, webService, to create the ProcObject, CustomerOrder, on the WSA and run CustomerOrder.p persistently.
3. Copies the ProcObject ID to the ProcObject from the AppObject (webService) that creates the ProcObject.

VB.NET client code to create the ProcObject, CustomerOrder

custOrder = New OrderSvc.CustomerOrderObj( )
custName = webService.CreatePO_CustomerOrder(3)
custOrder.CustomerOrderIDValue = webService.CustomerOrderIDValue
This is a Doc/Lit SOAP request generated by invoking the CreatePO_CustomerOrder( ) method to create the ProcObject, passing in a custNum value of 3:

SOAP request to create ProcObject, CustomerOrder

<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope namespaces defined here...>
  <soap:Header>
    <OrderInfoID xmlns="urn:OrderSvc:OrderInfo">
      <UUID>2e62cab6b81150d5:167f64e:f295e997b0:-8000;
            <OrderInfo|PX-000001|AO>;M/IryPm3piDcF/W5DsH4GA==</UUID>
    </OrderInfoID>
  </soap:Header>
  <soap:Body>
    <CreatePO_CustomerOrder xmlns="urn:OrderSvc:OrderInfo">
      <custNum>3</custNum>
    </CreatePO_CustomerOrder>
  </soap:Body>
</soap:Envelope>
Note the value for the request highlighted in the example, especially the AppObject ID sent for the AppObject, OrderInfo, which is the parent of the ProcObject being created for customer number 3.
This is a sample Doc/Lit SOAP response that is generated by the WSA from this invocation of the CreatePO_CustomerOrder( ) method:

SOAP response from creating ProcObject, CustomerOrder

<?xml version="1.0" encoding="UTF-8" ?>
<soap:Envelope namespaces defined here...>
  <soap:Header>
    <CustomerOrderID xmlns="urn:OrderSvc:CustomerOrder">
      <UUID>2e62cab6b81150d5:167f64e:f295e997b0:-8000;
            <OrderInfo|PX-000002|PO>;G1Vc/vmohvLnwxQQXwA6Cg==</UUID>
    </CustomerOrderID>  </soap:Header>
  <soap:Body>
    <CreatePO_CustomerOrderResponse xmlns="urn:OrderSvc:OrderInfo">
      <result>Hoops</result>
    </CreatePO_CustomerOrderResponse>
  </soap:Body>
</soap:Envelope>
Note the value returned for the CustomerOrder ProcObject ID highlighted in the example. The Web service returns this ProcObject ID even if it is session free, to allow the ProcObject to access its own AppServer session context.
Thus, the SOAP response header returns the following ProcObject ID contained in the CustomerOrderID element:
2e62cab6b81150d5:167f64e:f295e997b0:-8000;<OrderInfo|PX-000002|PO>;G1Vc/vmoh
vLnwxQQXwA6Cg==
Finally, note the ABL RETURN-VALUE result, returned from running the persistent procedure, which returns the customer name, "Hoops".