Try OpenEdge Now
skip to main content
Web Services
Creating OpenEdge SOAP Web Services : Sample Code with SOAP Messages for OpenEdge Web Services : Passing static and dynamic temp-table parameters : Invoking a method with a TABLE parameter
 
Invoking a method with a TABLE parameter
To invoke a method that passes a TABLE parameter, the client application typically must:
*Create rows using the interface object that represents the TABLE row
*Insert the rows in an array that represents the TABLE parameter
This is the ABL prototype for a sample method, staticTT( ), that passes a TABLE parameter:

ABL prototype that passes a TABLE parameter

/* staticTT.p */

DEFINE INPUT-OUTPUT PARAMETER TABLE FOR ttEmp.
This is the declaration for a VB.NET client interface method, staticTT( ), which has a TABLE parameter, ttEmp, passed as the class, staticTT_ttEmpRow:

VB.NET declaration of interface method passing static TEMP-TABLE, ttEmp

Public Class staticTT_ttEmpRow    Public Name As String
    Public Number As Integer
End Class

Public Sub staticTT(ByRef ttEmp( ) As staticTT_ttEmpRow)
The following client code defines a two row array (myTempTable) according to a defined schema (staticTT_ttEmpRow), then defines and creates two rows assigned with values. It then initializes the array (as TABLE, ttEmp) with the two rows and passes it to the staticTT( ) interface method, which passes the TABLE to the Web service:

VB.NET client code passing TABLE, ttEmp, to an interface method

Dim myTempTable(1) as webService.staticTT_ttEmpRow
Dim myRow1 as webService.staticTT_ttEmpRow =
                             New webService.staticTT_ttEmpRow( )
Dim myRow2 as webService.staticTT_ttEmpRow =
                             New webService.staticTT_ttEmpRow( )

myRow1.Name = "Fred"
myRow1.Number = 1
myRow2.Name = "Barney"
myRow2.Number = 2

myTempTable(0) = myRow1
myTempTable(1) = myRow2

webService.staticTT(myTempTable)
The following is a Doc/Lit SOAP message that this call to staticTT( ) might send:

Doc/Lit SOAP request to pass a TABLE parameter

<?xml version="1.0" encoding="utf-8" ?>
  <soap:Envelope namespaces defined here...>
    <soap:Header>
      <EmployeeID xmlns="urn:EmployeeSrvc:Employee">
        <UUID>2e62cab6b81150d5:-1380e8e:f27fb934f4:
        -8000;<Employee|PX-000004|AO>;5REiR9inxXQi4s6ghRWkfg==</UUID>
      </EmployeeID>
    </soap:Header>
    <soap:Body>
      <staticTT xmlns="urn:EmployeeSrvc:Employee">
        <ttEmp>
          <ttEmpRow>
            <Name>Fred</Name>
            <Number>1</Number>
          </ttEmpRow>
          <ttEmpRow>
            <Name>Barney</Name>
            <Number>2</Number>
          </ttEmpRow>
        </ttEmp>
      </staticTT>
    </soap:Body>
  </soap:Envelope>
Note: The staticTT( ) method must send the object ID for the Employee AppObject in the SOAP request header because staticTT( ) is a method on the session-managed AppObject.
As a point of comparison, the following is a RPC/Encoded SOAP message that this call to staticTT( ) might send:

RPC/Encoded SOAP request to pass a TABLE parameter

<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope namespaces defined here...>
  <soap:Header>
    <q1:EmployeeID id="h_id1" xmlns:q1="urn:EmployeeSrvc:Employee">
      <UUID xsi:type="xsd:string">2e62cab6b81150d5:-1380e8e:f27fb934f4:
      -8000;<Employee|PX-000004|AO>;5REiR9inxXQi4s6ghRWkfg==</UUID>
    </q1:EmployeeID>
  </soap:Header>
  <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <q1:staticTT xmlns:q1="urn:EmployeeSrvc:Employee">
      <ttEmp href="#id1" />
    </q1:staticTT>
    <soapenc:Array id="id1" xmlns:q2="urn:EmployeeSrvc:Employee"
          soapenc:arrayType="q2:staticTT_ttEmpRow[2]">
      <Item href="#id2" />
      <Item href="#id3" />
    </soapenc:Array>
    <q3:staticTT_ttEmpRow id="id2" xsi:type="q3:staticTT_ttEmpRow"
          xmlns:q3="urn:EmployeeSrvc:Employee">
      <Name xsi:type="xsd:string">Fred</Name>
      <Number xsi:type="xsd:int">1</Number>
    </q3:staticTT_ttEmpRow>
     <q4:staticTT_ttEmpRow id="id3" xsi:type="q4:staticTT_ttEmpRow"
          xmlns:q4="urn:EmployeeSrvc:Employee">
      <Name xsi:type="xsd:string">Barney</Name>
      <Number xsi:type="xsd:int">2</Number>
    </q4:staticTT_ttEmpRow>
  </soap:Body>
</soap:Envelope>
Note: The staticTT( ) method must send the object ID for the Employee AppObject in the SOAP request header because staticTT( ) is a method on the session-managed AppObject.