Try OpenEdge Now
skip to main content
Web Services
Developing a Java Client to Consume OpenEdge SOAP Web Services : ProDataSet parameters in Java Web service clients : DATASET (static ProDataSet) parameters
 

DATASET (static ProDataSet) parameters

In Java, the client interface for a DATASET parameter:
*Represents a DATASET object as arrays of the constituent temp-tables' row objects. For example:
public class DsCustOrd implements java.io.Serializable {
    private CustOrders.CustOrders.DsCustOrdTtCust[] ttCust;
    private CustOrders.CustOrders.DsCustOrdTtOrder[] ttOrder;
...
}
*Represents an output DATASET parameter using an array holder class. For example:
public final class DsCustOrdHolder implements
                                   javax.xml.rpc.holders.Holder {
    public CustOrders.CustOrders.DsCustOrd value;
    public DsCustOrdHolder() {
    }
    public DsCustOrdHolder(CustOrders.CustOrders.DsCustOrd value) {
        this.value = value;
    }
}
*Represents a NESTED DATA-RELATION by embedding an array of the child temp-table's row objects in the parent temp-table definition. For example:
public class DsCustOrdTtOrder implements java.io.Serializable {
    private java.lang.Integer orderNum;
    private java.lang.Integer custNum;
    private CustOrders.CustOrders.DsCustOrdTtOrderTtOrderLine[]
        ttOrderLine;
...
}
The following Java application is an example of handling the DsCustOrd parameter in a Java client:
Table 56. Sample Java application for getCustOrders
import java.net.URL;
import javax.xml.rpc.holders.*;

import CustOrders.*;
import CustOrders.CustOrders.*;
import CustOrders.CustOrders.holders.*;
public class CustOrders {

  public static void main(String[] args) {

    int iCustNum;
    CustOrdersObjStub appobj = null;

    try
    {
      CustOrdersService ws = new CustOrdersServiceLocator();

      URL connectURL = new java.net.URL("http://localhost:8080/wsa/wsa1");

      appobj = (CustOrdersObjStub)ws.getCustOrdersObj(connectURL);

      iCustNum = 1;
      StringHolder result = new StringHolder();
      DsCustOrdHolder dsCustOrdH = new DsCustOrdHolder();

      //call getCustOrders on Web service
      appobj.getCustOrders(iCustNum, result, dsCustOrdH);

      DsCustOrd dsCustOrd = dsCustOrdH.value;
      //print out ttCust records
      DsCustOrdTtCust[] ttCust = dsCustOrd.getTtCust();
      for (int i = 0; i< ttCust.length; i++)
      {
        System.out.println("CustNum: " + ttCust[i].getCustNum());
        System.out.println("Name: " + ttCust[i].getName());
      }

      //print out ttOrder records
      DsCustOrdTtOrder ttOrder[] = dsCustOrd.getTtOrder();
      for (int i = 0; i < ttOrder.length; i++)
      {
        System.out.println("OrderNum: " + ttOrder[i].getOrderNum());
        System.out.println("CustNum: " + ttOrder[i].getCustNum());
      // get nested ttOrderLine records
      DsCustOrdTtOrderTtOrderLine[] ttOrderLine =
                                               ttOrder[i].getTtOrderLine();
      for (int j = 0; j < ttOrderLine.length; j++)
      {
        System.out.println("OrderNum: " + ttOrderLine[j].getOrderNum());
        System.out.println("LineNum: " + ttOrderLine[j].getLineNum());
      }
    }
  } catch (Exception e){
    System.out.println("CAUGHT EXCEPTION - printing stack trace");
    System.out.println(e.toString());
    e.printStackTrace();
    }
  }
}
* Before-image data