Search in sources :

Example 1 with HelloSDO_ProxyInterface

use of com.sun.xml.ws.sdo.test.HelloSDO_ProxyInterface in project metro-jax-ws by eclipse-ee4j.

the class SDORuntimeBasicTest method testEchoSDO.

public void testEchoSDO() throws Exception {
    Class<HelloSDO_ProxyInterface> sei = HelloSDO_ProxyInterface.class;
    Class<HelloSDO_ProxyInterfaceImpl> seb = HelloSDO_ProxyInterfaceImpl.class;
    DatabindingConfig srvConfig = new DatabindingConfig();
    final HelperContext shc = SDOHelperContext.getHelperContext("server");
    HelperContextResolver shcr = new HelperContextResolver() {

        // @Override
        public HelperContext getHelperContext(boolean isClient, QName serviceName, Map<String, Object> properties) {
            return shc;
        }
    };
    File f = getSchema("MySDO.xsd");
    Set<SchemaInfo> schemas = SDOUtils.getSchemas(f);
    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_HELPER_CONTEXT_RESOLVER, shcr);
    DatabindingConfig cliConfig = new DatabindingConfig();
    // 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;
        }
    };
    cliConfig.setContractClass(sei);
    cliConfig.setFeatures(features);
    cliConfig.properties().put(SDOContextWrapper.SDO_SCHEMA_INFO, schemas);
    cliConfig.properties().put(SDOContextWrapper.SDO_HELPER_CONTEXT_RESOLVER, chcr);
    HelloSDO_ProxyInterface proxy = createProxy(sei, srvConfig, cliConfig, false);
    SDOUtils.defineSchema(chc, f);
    MySDO mySDO = createMySDO(chc, "Gigi", 20);
    Object obj = proxy.echoSDO(mySDO);
    assertTrue(obj instanceof MySDO);
    mySDO = (MySDO) obj;
    assertEquals(21, mySDO.getIntPart());
    assertEquals("Gary", mySDO.getStringPart());
    String wrapperName = srvConfig.properties().get(BindingContext.class.getName()).getClass().getName();
    assertTrue(wrapperName != null && wrapperName.endsWith("SDOContextWrapper"));
}
Also used : HelloSDO_ProxyInterface(com.sun.xml.ws.sdo.test.HelloSDO_ProxyInterface) HelperContext(commonj.sdo.helper.HelperContext) SDOHelperContext(org.eclipse.persistence.sdo.helper.SDOHelperContext) QName(javax.xml.namespace.QName) MySDO(com.sun.xml.ws.sdo.test.helloSDO.MySDO) DatabindingModeFeature(com.oracle.webservices.api.databinding.DatabindingModeFeature) BindingContext(com.sun.xml.ws.spi.db.BindingContext) DatabindingConfig(com.sun.xml.ws.api.databinding.DatabindingConfig) WebServiceFeature(jakarta.xml.ws.WebServiceFeature) HelperContextResolver(com.sun.xml.ws.db.sdo.HelperContextResolver) Map(java.util.Map) File(java.io.File) HelloSDO_ProxyInterfaceImpl(com.sun.xml.ws.sdo.test.HelloSDO_ProxyInterfaceImpl) 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 HelloSDO_ProxyInterface (com.sun.xml.ws.sdo.test.HelloSDO_ProxyInterface)1 HelloSDO_ProxyInterfaceImpl (com.sun.xml.ws.sdo.test.HelloSDO_ProxyInterfaceImpl)1 MySDO (com.sun.xml.ws.sdo.test.helloSDO.MySDO)1 BindingContext (com.sun.xml.ws.spi.db.BindingContext)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