Search in sources :

Example 16 with WebServiceFeature

use of jakarta.xml.ws.WebServiceFeature 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 17 with WebServiceFeature

use of jakarta.xml.ws.WebServiceFeature 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)

Example 18 with WebServiceFeature

use of jakarta.xml.ws.WebServiceFeature 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 19 with WebServiceFeature

use of jakarta.xml.ws.WebServiceFeature in project metro-jax-ws by eclipse-ee4j.

the class JAXBRIBasicTest method testHelloEchoNoMode.

public void testHelloEchoNoMode() throws Exception {
    Class endpointClass = HelloImpl.class;
    Class proxySEIClass = HelloPort.class;
    DatabindingConfig srvConfig = new DatabindingConfig();
    srvConfig.setEndpointClass(endpointClass);
    srvConfig.setMetadataReader(new DummyAnnotations());
    WebServiceFeature[] f = {};
    srvConfig.setFeatures(f);
    DatabindingConfig cliConfig = new DatabindingConfig();
    cliConfig.setMetadataReader(new DummyAnnotations());
    cliConfig.setContractClass(proxySEIClass);
    cliConfig.setFeatures(f);
    HelloPort hp = createProxy(HelloPort.class, srvConfig, cliConfig, false);
    String req = "testInVM " + databindingMode().getMode();
    String res = hp.echoS(req);
    assertEquals(req, res);
    String wrapperName = srvConfig.properties().get(BindingContext.class.getName()).getClass().getName();
    assertTrue("Wrapper: " + wrapperName, wrapperName != null && wrapperName.endsWith("JAXBRIContextWrapper"));
}
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) BindingContext(com.sun.xml.ws.spi.db.BindingContext)

Example 20 with WebServiceFeature

use of jakarta.xml.ws.WebServiceFeature 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)

Aggregations

WebServiceFeature (jakarta.xml.ws.WebServiceFeature)52 DatabindingModeFeature (com.oracle.webservices.api.databinding.DatabindingModeFeature)19 DatabindingConfig (com.sun.xml.ws.api.databinding.DatabindingConfig)19 QName (javax.xml.namespace.QName)13 BindingImpl (com.sun.xml.ws.binding.BindingImpl)6 SchemaInfo (com.sun.xml.ws.db.sdo.SchemaInfo)6 SOAPMessage (jakarta.xml.soap.SOAPMessage)6 File (java.io.File)6 Method (java.lang.reflect.Method)6 Map (java.util.Map)6 WSDLPort (com.sun.xml.ws.api.model.wsdl.WSDLPort)5 MTOMFeature (jakarta.xml.ws.soap.MTOMFeature)5 HashMap (java.util.HashMap)5 Databinding (com.oracle.webservices.api.databinding.Databinding)4 DatabindingFactory (com.oracle.webservices.api.databinding.DatabindingFactory)4 JavaCallInfo (com.oracle.webservices.api.databinding.JavaCallInfo)4 ImpliesWebServiceFeature (com.sun.xml.ws.api.ImpliesWebServiceFeature)4 MemberSubmissionAddressingFeature (com.sun.xml.ws.developer.MemberSubmissionAddressingFeature)4 BindingContext (com.sun.xml.ws.spi.db.BindingContext)4 HelperContext (commonj.sdo.helper.HelperContext)4