Try OpenEdge Now
skip to main content
Web Services
Creating OpenEdge SOAP Web Services : Sample Code with SOAP Messages for OpenEdge Web Services : Running an internal procedure or user-defined function
 

Running an internal procedure or user-defined function

Methods to run an ABL internal procedure and user-defined function of a persistent procedure (ProcObject) are indistinguishable in client code. These methods:
*Run only in the context of a defining ProcObject
*Require a ProcObject ID in the SOAP request header, which is the object ID of the defining ProcObject
This is the ABL prototype for the sample user-defined function, GetTotalOrdersByNumber( ):

ABL prototype for a user-defined function

/* CustomerOrder.p */

FUNCTION GetTotalOrdersByNumber RETURNS INTEGER
   (Threshold AS DECIMAL):
This is a VB.NET declaration for the ABL user-defined function method, GetTotalOrdersByNumber( ):

VB.NET prototype for an ABL user-defined function method

Public Function GetTotalOrdersByNumber
                   (ByVal Threshold As Decimal) As Integer
The following is a sample method call for the user-defined function method, GetTotalOrdersByNumber, which is an interface method on the sample ProcObject, CustomerOrder:

VB.NET client code of method to run an ABL user-defined function

totNumber = custOrder.GetTotalOrdersByNumber(2150.99)
Note that user-defined function methods return a value whose data type maps to the ABL data type of the user-defined function's return value.
This is a sample Doc/Lit SOAP request that might be generated from invoking the GetTotalOrdersByNumber( ) method to execute the ABL user-defined function, passing in a Threshold order value of 2150.99:

SOAP request for user-defined function method, GetTotalOrdersByNumber

<?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>
    <GetTotalOrdersByNumber xmlns="OrderSvc:CustomerOrder">
      <Threshold>2150.99</Threshold>
    </GetTotalOrdersByNumber>
  </soap:Body>
</soap:Envelope>
Note the object ID for the ProcObject, CustomerOrder, sent to make the request on a method of the ProcObject.
This is the SOAP response returning a function value of 5, which is the total number of orders that satisfy the specified order Threshold value:

SOAP response from calling the GetTotalOrdersByNumber method

<?xml version="1.0" encoding="UTF-8" ?>
<soap:Envelope namespaces defined here...>
  <soap:Body>
    <GetTotalOrdersByNumberResponse xmlns="urn:OrderSvc:CustomerOrder">
      <result>5</result>
    </GetTotalOrdersByNumberResponse>
  </soap:Body>
</soap:Envelope>