Search in sources :

Example 1 with AddNumbersServiceImpl

use of com.sun.xml.ws.sdo.test.AddNumbersServiceImpl 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);
}
Also used : HelperContext(commonj.sdo.helper.HelperContext) SDOHelperContext(org.eclipse.persistence.sdo.helper.SDOHelperContext) QName(javax.xml.namespace.QName) AddNumbersServiceImpl(com.sun.xml.ws.sdo.test.AddNumbersServiceImpl) DatabindingModeFeature(com.oracle.webservices.api.databinding.DatabindingModeFeature) AddNumbersPortType(com.sun.xml.ws.sdo.test.AddNumbersPortType) DatabindingConfig(com.sun.xml.ws.api.databinding.DatabindingConfig) WebServiceFeature(jakarta.xml.ws.WebServiceFeature) HelperContextResolver(com.sun.xml.ws.db.sdo.HelperContextResolver) File(java.io.File) Map(java.util.Map) SchemaInfo(com.sun.xml.ws.db.sdo.SchemaInfo)

Aggregations

DatabindingModeFeature (com.oracle.webservices.api.databinding.DatabindingModeFeature)1 DatabindingConfig (com.sun.xml.ws.api.databinding.DatabindingConfig)1 HelperContextResolver (com.sun.xml.ws.db.sdo.HelperContextResolver)1 SchemaInfo (com.sun.xml.ws.db.sdo.SchemaInfo)1 AddNumbersPortType (com.sun.xml.ws.sdo.test.AddNumbersPortType)1 AddNumbersServiceImpl (com.sun.xml.ws.sdo.test.AddNumbersServiceImpl)1 HelperContext (commonj.sdo.helper.HelperContext)1 WebServiceFeature (jakarta.xml.ws.WebServiceFeature)1 File (java.io.File)1 Map (java.util.Map)1 QName (javax.xml.namespace.QName)1 SDOHelperContext (org.eclipse.persistence.sdo.helper.SDOHelperContext)1