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);
}
}
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();
}
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);
}
}
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"));
}
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.
}
}
Aggregations