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