use of com.sun.xml.ws.sdo.test.AddNumbersPortType in project metro-jax-ws by eclipse-ee4j.
the class SDORuntimeBasicTest method testAddNumbers.
public void testAddNumbers() throws Exception {
DatabindingConfig srvConfig = new DatabindingConfig();
File f = getSchema("AddNumbers.xsd");
Class<AddNumbersPortType> sei = AddNumbersPortType.class;
Class<AddNumbersServiceImpl> seb = AddNumbersServiceImpl.class;
// SDODatabindingContext.getLocalHelperContext();
final HelperContext chc = SDOHelperContext.getHelperContext("client");
HelperContextResolver chcr = new HelperContextResolver() {
// @Override
public HelperContext getHelperContext(boolean isClient, QName serviceName, Map<String, Object> properties) {
return chc;
}
};
SDOUtils.defineSchema(chc, f);
Set<SchemaInfo> schemas = SDOUtils.getSchemas(f);
final HelperContext shc = SDOHelperContext.getHelperContext("server");
HelperContextResolver shcr = new HelperContextResolver() {
// @Override
public HelperContext getHelperContext(boolean isClient, QName serviceName, Map<String, Object> properties) {
return shc;
}
};
srvConfig.setEndpointClass(seb);
DatabindingModeFeature dbm = databindingMode();
WebServiceFeature[] features = { dbm };
srvConfig.setFeatures(features);
srvConfig.properties().put(SDOContextWrapper.SDO_SCHEMA_INFO, schemas);
// srvConfig.properties().put(SDOContextWrapper.SDO_SCHEMA_FILE, f);
srvConfig.properties().put(SDOContextWrapper.SDO_HELPER_CONTEXT_RESOLVER, shcr);
DatabindingConfig cliConfig = new DatabindingConfig();
cliConfig.setContractClass(sei);
cliConfig.setFeatures(features);
cliConfig.properties().put(SDOContextWrapper.SDO_SCHEMA_INFO, schemas);
// cliConfig.properties().put(SDOContextWrapper.SDO_SCHEMA_FILE, f);
cliConfig.properties().put(SDOContextWrapper.SDO_HELPER_CONTEXT_RESOLVER, chcr);
AddNumbersPortType proxy = createProxy(sei, srvConfig, cliConfig, false);
Object obj = proxy.addNumbers(4, -83);
assertTrue(obj instanceof Integer);
Integer resp = (Integer) obj;
assertEquals(Integer.valueOf(-79), resp);
}
Aggregations