Try OpenEdge Now
skip to main content
Web Services
Developing a Java Client to Consume OpenEdge SOAP Web Services : Developing the Axis client application : Setting up the PscObjectIDHandler objects
 

Setting up the PscObjectIDHandler objects

After you have completed the Web service object setup (see Setting up the Web service objects) that creates the OrderInfoObjStub and CustomerOrderObjStub objects, you can create and register the PscObjectIDHandler and HandlerControlBlock objects for both the OrderInfo and CustomerOrder Open Client objects.
The following steps create and register a unique handler for each Open Client object so it can automatically insert its corresponding object ID into outgoing SOAP requests without intervention by the client application.
To create and register a unique handler for each Open Client object:
1. Set the <portType> element name specified in the WSDL for the OrderInfoObjStub so a PscObjectIDHandler can be bound to it. For example:
orderInfo.setPortName("OrderInfoPort");
Note: Apache Axis does not automatically obtain the <portType> element name from the WSDL document when it generates the client interface classes.
2. Set the <portType> element name specified in the WSDL for the CustomerOrderObjStub so a PscObjectIDHandler can be bound to it. For example:
custOrder.setPortName("CustomerOrderPort");
Note: Apache Axis does not automatically obtain the <portType> element name from the WSDL document when it generates the client interface classes.
3. Declare the Open Client object names that the PscObjectIDHandler objects will use to scan for object IDs in SOAP response headers returned from the WSA. For example:
String[] orderInfoObjectNames =
              new String[] { "OrderInfo", "CustomerOrder" };
Note: Both the "OrderInfo" and "CustomerOrder" object names are included because the object IDs for both are returned from factory methods contained in the OrderInfo AppObject.
4. Call the PscObjectIDHandler built-in factory method to create and register a PscObjectIDHandler object for the "OrderInfoPort" <portType> element. The handler is set to scan for and record the object ID values for the OrderInfo and CustomerOrder Open Client objects. This automatically creates and binds a HandlerControlBlock object to the PscObjectIDHandler object, returning a reference for it to the client application, as shown:
HandlerControlBlock orderInfoControlBlock = null;

orderInfoControlBlock =
    PscObjectIDHandler.registerObjectIDHandler(
        service,
        orderInfoObjectNames,
        "",
        "OrderInfoPort",
        debugHandler );
5. Call the PscObjectIDHandler built-in factory method to create and register a PscObjectIDHandler object for the "CustomerOrderPort" <portType> element. The handler is set to scan for and record the object ID values for the OrderInfo and CustomerOrder Open Client objects. This automatically creates and binds a HandlerControlBlock object to the PscObjectIDHandler object, returning a reference for it to the client application, as shown:
HandlerControlBlock custOrderControlBlock = null;

custOrderControlBlock =
    PscObjectIDHandler.registerObjectIDHandler(
        service,
        orderInfoObjectNames,
        "",
        "CustomerOrderPort",
        debugHandler );