Search in sources :

Example 11 with DatabindingModeFeature

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

the class WrapperNSTest method testWrapperNS_JAXBRI.

public void testWrapperNS_JAXBRI() throws Exception {
    Class<?> sei = MyHelloRPC.class;
    DatabindingFactory fac = DatabindingFactory.newInstance();
    Databinding.Builder b = fac.createBuilder(sei, null);
    DatabindingModeFeature dbf = new DatabindingModeFeature("glassfish.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("------------------ glassfish");
        // 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 12 with DatabindingModeFeature

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

the class JAXBRIBasicTest method testHelloEchoInvalidDB.

public void testHelloEchoInvalidDB() throws Exception {
    Class endpointClass = HelloImpl.class;
    Class proxySEIClass = HelloPort.class;
    DatabindingConfig srvConfig = new DatabindingConfig();
    srvConfig.setEndpointClass(endpointClass);
    srvConfig.setMetadataReader(new DummyAnnotations());
    WebServiceFeature[] f = { new DatabindingModeFeature("invalid.db") };
    srvConfig.setFeatures(f);
    DatabindingConfig cliConfig = new DatabindingConfig();
    cliConfig.setMetadataReader(new DummyAnnotations());
    cliConfig.setContractClass(proxySEIClass);
    cliConfig.setFeatures(f);
    try {
        HelloPort hp = createProxy(HelloPort.class, srvConfig, cliConfig, false);
        fail("Expected DatabindingException not thrown");
    } catch (DatabindingException e) {
    // expected exception.
    }
}
Also used : DatabindingException(com.sun.xml.ws.spi.db.DatabindingException) DatabindingConfig(com.sun.xml.ws.api.databinding.DatabindingConfig) DummyAnnotations(com.sun.xml.ws.base.DummyAnnotations) HelloImpl(com.sun.xml.ws.test.HelloImpl) HelloPort(com.sun.xml.ws.test.HelloPort) WebServiceFeature(jakarta.xml.ws.WebServiceFeature) DatabindingModeFeature(com.oracle.webservices.api.databinding.DatabindingModeFeature)

Example 13 with DatabindingModeFeature

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

the class BasicDatabindingTestBase method _testHelloEcho.

protected String _testHelloEcho() throws Exception {
    Class<?> endpointClass = HelloImpl.class;
    Class<?> proxySEIClass = HelloPort.class;
    DatabindingConfig srvConfig = new DatabindingConfig();
    srvConfig.setEndpointClass(endpointClass);
    srvConfig.setMetadataReader(new DummyAnnotations());
    DatabindingModeFeature dbm = databindingMode();
    DatabindingConfig cliConfig = new DatabindingConfig();
    cliConfig.setMetadataReader(new DummyAnnotations());
    cliConfig.setContractClass(proxySEIClass);
    // Honor system property if present, otherwise set feature.
    WebServiceFeature[] f = null;
    String dbProperty = System.getProperty(BindingContextFactory.JAXB_CONTEXT_FACTORY_PROPERTY);
    if (dbProperty == null)
        f = new WebServiceFeature[] { dbm };
    else
        f = new WebServiceFeature[0];
    srvConfig.setFeatures(f);
    cliConfig.setFeatures(f);
    HelloPort hp = createProxy(HelloPort.class, srvConfig, cliConfig, false);
    String req = "testInVM " + dbm.getMode();
    String res = hp.echoS(req);
    assertEquals(req, res);
    return srvConfig.properties().get(BindingContext.class.getName()).getClass().getName();
}
Also used : DatabindingConfig(com.sun.xml.ws.api.databinding.DatabindingConfig) DummyAnnotations(com.sun.xml.ws.base.DummyAnnotations) HelloImpl(com.sun.xml.ws.test.HelloImpl) HelloPort(com.sun.xml.ws.test.HelloPort) WebServiceFeature(jakarta.xml.ws.WebServiceFeature) DatabindingModeFeature(com.oracle.webservices.api.databinding.DatabindingModeFeature) BindingContext(com.sun.xml.ws.spi.db.BindingContext)

Example 14 with DatabindingModeFeature

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

the class EclipselinkJAXBBasicTest method testCollectionMap.

public void testCollectionMap() throws Exception {
    Class<?> endpointClass = CollectionMapImpl.class;
    Class<?> proxySEIClass = CollectionMap.class;
    DatabindingConfig srvConfig = new DatabindingConfig();
    srvConfig.setEndpointClass(endpointClass);
    DatabindingModeFeature dbm = databindingMode();
    WebServiceFeature[] f = { dbm };
    srvConfig.setFeatures(f);
    DatabindingConfig cliConfig = new DatabindingConfig();
    cliConfig.setContractClass(proxySEIClass);
    cliConfig.setFeatures(f);
    CollectionMap p = createProxy(CollectionMap.class, srvConfig, cliConfig, false);
    {
        List<String> req = Arrays.asList("x", "Eclipselink", "parameterized", "List");
        List<String> res = p.echoListOfString(req);
        assertEqualList(req, res);
    }
    {
        Integer[] num = { 123, -456, 789, 0 };
        Map<String, Integer> req = new HashMap<String, Integer>();
        for (Integer i : num) req.put(i.toString(), i);
        Map<Integer, String> res = p.echoMapOfString(req);
        Map<Integer, String> ans = new HashMap<Integer, String>();
        for (Integer i : num) ans.put(i, i.toString());
        assertTrue(equalsMap(ans, res));
    }
}
Also used : CollectionMapImpl(com.sun.xml.ws.test.CollectionMapImpl) DatabindingModeFeature(com.oracle.webservices.api.databinding.DatabindingModeFeature) DatabindingConfig(com.sun.xml.ws.api.databinding.DatabindingConfig) CollectionMap(com.sun.xml.ws.test.CollectionMap) WebServiceFeature(jakarta.xml.ws.WebServiceFeature) List(java.util.List) Map(java.util.Map) HashMap(java.util.HashMap) CollectionMap(com.sun.xml.ws.test.CollectionMap)

Example 15 with DatabindingModeFeature

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

the class WsDatabindingTestBase method createProxy.

public static <T> T createProxy(Class<T> proxySEI, Class<?> endpointClass, String db, boolean debug) throws Exception {
    DatabindingConfig srvConfig = new DatabindingConfig();
    srvConfig.setEndpointClass(endpointClass);
    DatabindingModeFeature dbf = new DatabindingModeFeature(db);
    WebServiceFeatureList wsfeatures = new WebServiceFeatureList(endpointClass);
    WebServiceFeature[] f = { dbf };
    // config.setFeatures(wsfeatures.toArray());
    srvConfig.setFeatures(f);
    DatabindingConfig cliConfig = new DatabindingConfig();
    cliConfig.setContractClass(proxySEI);
    cliConfig.setFeatures(f);
    return createProxy(proxySEI, srvConfig, cliConfig, debug);
}
Also used : DatabindingConfig(com.sun.xml.ws.api.databinding.DatabindingConfig) WebServiceFeature(jakarta.xml.ws.WebServiceFeature) DatabindingModeFeature(com.oracle.webservices.api.databinding.DatabindingModeFeature) WebServiceFeatureList(com.sun.xml.ws.binding.WebServiceFeatureList)

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