Implementing JAX-RPC handlers to access SDO messages

JAX-RPC handlers are invoked during the processing of request and response messages. For messages that are exchanged by using the SOAP protocol, each JAX-RPC handler is passed a SOAP-specific MessageContext object. For other protocols, the IBM web services runtime environment passes a MessageContext object that provides a Service Data Objects view of the message. 「服務資料物件 (SDO)」是一個開放式標準,可讓應用程式以統一方式(如資料圖)來處理不同資料來源的資料。

If the JAX-RPC handler only deals with message context properties, it does not have to be aware of the particular subclass of MessageContext that it is given, because the context property methods are defined by the MessageContext interface itself. If the handler needs to process information contained within the message, it must be coded to work with the required subclasses. Your JAX-RPC handlers should test whether the MessageContext is an instance of the required subclass.

A JAX-RPC handler is given an SDO-specific MessageContext object (an instance of the com.ibm.websphere.webservices.handler.sdo.SDOMessageContext class) rather than the SOAP-specific MessageContext object in the following cases:
  • A JAX-RPC client or outbound invocation from the service integration bus invokes a service by using the EJB binding.
  • A JAX-RPC client is developed against a non-bound WSDL and is retargeted to a destination in the service integration bus.

The SDOMessageContext class provides methods to get and set the com.ibm.websphere.sdo.SDOMessage instance that represents the message that is being processed. The SDOMessage has a method to access the SDO DataGraph object that holds the message content as SDO DataObjects.

A JAX-RPC handler can modify the SDO DataGraph contents, but it cannot change the format or schema of the message.

The following example shows code that can be used to access the SDO DataGraph from the MessageContext object in a JAX-RPC handler handleRequest method:

public boolean handleRequest(MessageContext messageContext) {

		// Convert the MessageContext into an SDOMessageContext
		if( messageContext instanceof SDOMessageContext) {
			SDOMessageContext smc = (SDOMessageContext)messageContext;

			// Retrieve the message
			SDOMessage message = smc.getSDOMessage();
		
			// Get the root object in the SDO DataGraph
			DataGraph graph = message.getDataGraph();
			DataObject content = graph.getRootObject();
		
			// Now do something with the message content.....
		}
		return true;
	}

指出主題類型的圖示 參照主題



時間戳記圖示 前次更新: July 9, 2016 11:12
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=rjw_jaxrpc_sdo
檔名:rjw_jaxrpc_sdo.html