Search in sources :

Example 6 with DatabindingModeFeature

use of com.oracle.webservices.api.databinding.DatabindingModeFeature in project metro-jax-ws by eclipse-ee4j.

the class SDORuntimeBasicTest method testEchoSDO_DocLitWrapNoWrapper.

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

        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);
    srvConfig.properties().put("com.sun.xml.ws.api.model.SuppressDocLitWrapperGeneration", true);
    DatabindingConfig cliConfig = new DatabindingConfig();
    // SDODatabindingContext.getLocalHelperContext();
    final HelperContext chc = SDOHelperContext.getHelperContext("client");
    HelperContextResolver chcr = new HelperContextResolver() {

        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);
    cliConfig.properties().put("com.sun.xml.ws.api.model.SuppressDocLitWrapperGeneration", true);
    HelloSDO_DocLitWrap proxy = createProxy(sei, srvConfig, cliConfig, false);
    SDOUtils.defineSchema(chc, f);
    String s = "Gigi";
    int i = 20;
    MySDO mySDO = createMySDO(chc, s, i);
    assertEquals(s, proxy.returnS(mySDO));
    assertEquals(i, proxy.returnI(mySDO));
    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"));
    {
        MySDO[] a = { createMySDO(chc, "a", 1), createMySDO(chc, "b", 2), createMySDO(chc, "c", 3) };
        List<MySDO> lreq = Arrays.asList(a);
        List<String> lres = proxy.testList1(lreq);
        assertEquals(lres.size(), lreq.size());
    }
    {
        MySDO[] a = { createMySDO(chc, "a", 1), createMySDO(chc, "b", 2), createMySDO(chc, "c", 3) };
        List<String> l1 = Arrays.asList(new String[] { "w", "x", "y", "z" });
        List<MySDO> l2 = Arrays.asList(a);
        List<String> lres = proxy.testList2(l1, l2);
        assertEquals(lres.size(), l1.size() + l2.size());
    }
    {
        MySDO[] a = { createMySDO(chc, "g", 5), createMySDO(chc, "j", 6), createMySDO(chc, "k", 7), createMySDO(chc, "l", 8), createMySDO(chc, "h", 9) };
        String[] res = proxy.arrayList01(a);
        assertEquals(res.length, a.length);
    }
}
Also used : 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) HelloSDO_DocLitWrapImpl(com.sun.xml.ws.sdo.test.HelloSDO_DocLitWrapImpl) DatabindingConfig(com.sun.xml.ws.api.databinding.DatabindingConfig) HelloSDO_DocLitWrap(com.sun.xml.ws.sdo.test.HelloSDO_DocLitWrap) WebServiceFeature(jakarta.xml.ws.WebServiceFeature) List(java.util.List) HelperContextResolver(com.sun.xml.ws.db.sdo.HelperContextResolver) Map(java.util.Map) File(java.io.File) SchemaInfo(com.sun.xml.ws.db.sdo.SchemaInfo)

Example 7 with DatabindingModeFeature

use of com.oracle.webservices.api.databinding.DatabindingModeFeature in project metro-jax-ws by eclipse-ee4j.

the class JAXBWrapperAccessorTest method testDatabindingCreation.

public void testDatabindingCreation() {
    Class<?> sei = DocServicePortType.class;
    DatabindingFactory fac = DatabindingFactory.newInstance();
    Databinding.Builder b = fac.createBuilder(sei, null);
    DatabindingModeFeature dbf = new DatabindingModeFeature("eclipselink.jaxb");
    WebServiceFeature[] f = { dbf };
    b.feature(f);
    String ns = "http://performance.bea.com";
    b.serviceName(new QName(ns, "DocService"));
    b.portName(new QName(ns, "DocServicePortTypePort"));
    assertNotNull(b.build());
}
Also used : DatabindingFactory(com.oracle.webservices.api.databinding.DatabindingFactory) QName(javax.xml.namespace.QName) WebServiceFeature(jakarta.xml.ws.WebServiceFeature) DatabindingModeFeature(com.oracle.webservices.api.databinding.DatabindingModeFeature) Databinding(com.oracle.webservices.api.databinding.Databinding)

Example 8 with DatabindingModeFeature

use of com.oracle.webservices.api.databinding.DatabindingModeFeature in project metro-jax-ws by eclipse-ee4j.

the class JAXBWrapperAccessorTest method testDatabindingModeAnnotationToFeature.

public void testDatabindingModeAnnotationToFeature() throws Exception {
    DatabindingMode a = SEB.class.getAnnotation(DatabindingMode.class);
    DatabindingModeFeature f = (DatabindingModeFeature) WebServiceFeatureList.getFeature(a);
    assertEquals(f.getMode(), a.value());
}
Also used : DatabindingMode(com.oracle.webservices.api.databinding.DatabindingMode) DatabindingModeFeature(com.oracle.webservices.api.databinding.DatabindingModeFeature)

Example 9 with DatabindingModeFeature

use of com.oracle.webservices.api.databinding.DatabindingModeFeature in project metro-jax-ws by eclipse-ee4j.

the class WrapperNSTest method testWrapperNS.

public void testWrapperNS() throws Exception {
    Class<?> sei = MyHelloRPC.class;
    DatabindingFactory fac = DatabindingFactory.newInstance();
    Databinding.Builder b = fac.createBuilder(sei, null);
    DatabindingModeFeature dbf = new DatabindingModeFeature("eclipselink.jaxb");
    WebServiceFeature[] f = { dbf };
    b.feature(f);
    b.serviceName(new QName("http://echo.org/", "helloService"));
    b.portName(new QName("http://echo.org/", "helloPort"));
    Databinding db = b.build();
    {
        Method method = findMethod(sei, "echoString");
        Object[] args = { "test" };
        JavaCallInfo call = db.createJavaCallInfo(method, args);
        MessageContext mc = db.serializeRequest(call);
        SOAPMessage msg = mc.getSOAPMessage();
        // System.out.println("------------------ eclipselink");
        // msg.writeTo(System.out);
        // System.out.println();
        Node n = msg.getSOAPBody().getChildNodes().item(0);
        // System.out.println("num of attributes is: "+
        // n.getAttributes().getLength());
        assertTrue(n.getAttributes().getLength() == 1);
    }
}
Also used : DatabindingFactory(com.oracle.webservices.api.databinding.DatabindingFactory) QName(javax.xml.namespace.QName) Node(org.w3c.dom.Node) DatabindingModeFeature(com.oracle.webservices.api.databinding.DatabindingModeFeature) Method(java.lang.reflect.Method) SOAPMessage(jakarta.xml.soap.SOAPMessage) Databinding(com.oracle.webservices.api.databinding.Databinding) WebServiceFeature(jakarta.xml.ws.WebServiceFeature) JavaCallInfo(com.oracle.webservices.api.databinding.JavaCallInfo) MessageContext(com.oracle.webservices.api.message.MessageContext)

Example 10 with DatabindingModeFeature

use of com.oracle.webservices.api.databinding.DatabindingModeFeature in project metro-jax-ws by eclipse-ee4j.

the class WrapperNSTest method testGenerateWsdl.

public void testGenerateWsdl() throws Exception {
    Class<?> sei = MyHelloRPC.class;
    DatabindingFactory fac = DatabindingFactory.newInstance();
    Databinding.Builder b = fac.createBuilder(sei, null);
    DatabindingModeFeature dbf = new DatabindingModeFeature("eclipselink.jaxb");
    WebServiceFeature[] f = { dbf };
    DatabindingConfig config = new DatabindingConfig();
    config.setFeatures(f);
    config.setEndpointClass(MyHelloClass.class);
    MappingInfo mi = new MappingInfo();
    mi.setServiceName(new QName("http://echo.org/", "helloService"));
    mi.setPortName(new QName("http://echo.org/", "helloPort"));
    config.setMappingInfo(mi);
    config.setClassLoader(this.getClass().getClassLoader());
    RuntimeModeler rtModeler = new RuntimeModeler(config);
    rtModeler.buildRuntimeModel();
}
Also used : DatabindingConfig(com.sun.xml.ws.api.databinding.DatabindingConfig) DatabindingFactory(com.oracle.webservices.api.databinding.DatabindingFactory) QName(javax.xml.namespace.QName) WebServiceFeature(jakarta.xml.ws.WebServiceFeature) RuntimeModeler(com.sun.xml.ws.model.RuntimeModeler) DatabindingModeFeature(com.oracle.webservices.api.databinding.DatabindingModeFeature) Databinding(com.oracle.webservices.api.databinding.Databinding) MappingInfo(com.sun.xml.ws.api.databinding.MappingInfo)

Aggregations

DatabindingModeFeature (com.oracle.webservices.api.databinding.DatabindingModeFeature)21 WebServiceFeature (jakarta.xml.ws.WebServiceFeature)19 DatabindingConfig (com.sun.xml.ws.api.databinding.DatabindingConfig)15 QName (javax.xml.namespace.QName)7 SchemaInfo (com.sun.xml.ws.db.sdo.SchemaInfo)6 Databinding (com.oracle.webservices.api.databinding.Databinding)4 DatabindingFactory (com.oracle.webservices.api.databinding.DatabindingFactory)4 WebServiceFeatureList (com.sun.xml.ws.binding.WebServiceFeatureList)4 HelperContext (commonj.sdo.helper.HelperContext)4 Map (java.util.Map)4 SDOHelperContext (org.eclipse.persistence.sdo.helper.SDOHelperContext)4 HelperContextResolver (com.sun.xml.ws.db.sdo.HelperContextResolver)3 BindingContext (com.sun.xml.ws.spi.db.BindingContext)3 File (java.io.File)3 List (java.util.List)3 JavaCallInfo (com.oracle.webservices.api.databinding.JavaCallInfo)2 MessageContext (com.oracle.webservices.api.message.MessageContext)2 BindingID (com.sun.xml.ws.api.BindingID)2 DummyAnnotations (com.sun.xml.ws.base.DummyAnnotations)2 MySDO (com.sun.xml.ws.sdo.test.helloSDO.MySDO)2