Following imports are required to implement this :
<%@ page import="com.ibm.websphere.sca.ServiceManager" %>
<%@ page import="com.ibm.websphere.sca.Service" %>
<%@ page import="commonj.sdo.DataObject" %>
<%@ page import="com.ibm.websphere.bo.BOFactory" %>
Code snippet :
ServiceManager serviceManager = new ServiceManager();
BOFactory bofactory = (BOFactory) serviceManager.locateService("com/ibm/websphere/bo/BOFactory");
// Create the request DO
DataObject input = bofactory.createByElement("http://WSLib/IProviderSync", "syncOp");
input.setString("in", "My_Input");
// "http://WSLib/IProviderSync" is the namespace of the interface containing "syncOp" operation, // which are going to call through standalone reference.
// "in" is the input name of the operation.
// Send the request
Service service = (Service) serviceManager.locateService("IProviderSyncPartner");
// "IProviderSyncPartner" is the name of the reference partner of the standalone reference.
DataObject output = (DataObject)service.invoke("syncOp", input);
// Get the response
String outputDoTest = output.getString("out");
// "out " is the output name of the operation.
<%@ page import="com.ibm.websphere.sca.ServiceManager" %>
<%@ page import="com.ibm.websphere.sca.Service" %>
<%@ page import="commonj.sdo.DataObject" %>
<%@ page import="com.ibm.websphere.bo.BOFactory" %>
Code snippet :
ServiceManager serviceManager = new ServiceManager();
BOFactory bofactory = (BOFactory) serviceManager.locateService("com/ibm/websphere/bo/BOFactory");
// Create the request DO
DataObject input = bofactory.createByElement("http://WSLib/IProviderSync", "syncOp");
input.setString("in", "My_Input");
// "http://WSLib/IProviderSync" is the namespace of the interface containing "syncOp" operation, // which are going to call through standalone reference.
// "in" is the input name of the operation.
// Send the request
Service service = (Service) serviceManager.locateService("IProviderSyncPartner");
// "IProviderSyncPartner" is the name of the reference partner of the standalone reference.
DataObject output = (DataObject)service.invoke("syncOp", input);
// Get the response
String outputDoTest = output.getString("out");
// "out " is the output name of the operation.
| Interface |
| Standalone reference property |
Note : We should bundle this client app into the EAR which has standalone reference.