Search in sources :

Example 16 with DatabindingModeFeature

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

the class DeploymentDescriptorParser method createBinding.

/**
 * @param ddBindingId   binding id explicitlyspecified in the DeploymentDescriptor or parameter
 * @param implClass     Endpoint Implementation class
 * @param mtomEnabled   represents mtom-enabled attribute in DD
 * @param mtomThreshold threshold value specified in DD
 * @return is returned with only MTOMFeature set resolving the various precendece rules
 */
private static WSBinding createBinding(String ddBindingId, Class implClass, String mtomEnabled, String mtomThreshold, String dataBindingMode) {
    // Features specified through DD
    WebServiceFeatureList features;
    MTOMFeature mtomfeature = null;
    if (mtomEnabled != null) {
        if (mtomThreshold != null) {
            mtomfeature = new MTOMFeature(Boolean.valueOf(mtomEnabled), Integer.parseInt(mtomThreshold));
        } else {
            mtomfeature = new MTOMFeature(Boolean.valueOf(mtomEnabled));
        }
    }
    BindingID bindingID;
    if (ddBindingId != null) {
        bindingID = BindingID.parse(ddBindingId);
        features = bindingID.createBuiltinFeatureList();
        if (checkMtomConflict(features.get(MTOMFeature.class), mtomfeature)) {
            throw new ServerRtException(ServerMessages.DD_MTOM_CONFLICT(ddBindingId, mtomEnabled));
        }
    } else {
        bindingID = BindingID.parse(implClass);
        // Since bindingID is coming from implclass,
        // mtom through Feature annotation or DD takes precendece
        features = new WebServiceFeatureList();
        if (mtomfeature != null) {
            // this wins over MTOM setting in bindingID
            features.add(mtomfeature);
        }
        features.addAll(bindingID.createBuiltinFeatureList());
    }
    if (dataBindingMode != null) {
        features.add(new DatabindingModeFeature(dataBindingMode));
    }
    return bindingID.createBinding(features.toArray());
}
Also used : MTOMFeature(jakarta.xml.ws.soap.MTOMFeature) DatabindingModeFeature(com.oracle.webservices.api.databinding.DatabindingModeFeature) WebServiceFeatureList(com.sun.xml.ws.binding.WebServiceFeatureList) BindingID(com.sun.xml.ws.api.BindingID) ServerRtException(com.sun.xml.ws.server.ServerRtException)

Example 17 with DatabindingModeFeature

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

the class SDOHRAppServiceTest method testSDO_HRAppService.

public void testSDO_HRAppService() throws Exception {
    Set<SchemaInfo> schemas = SDOUtils.getSchemas(getResource("wsdl/HRAppService.wsdl").getFile());
    DatabindingConfig srvConfig = new DatabindingConfig();
    Class<HRAppService> sei = HRAppService.class;
    Class<HRAppServiceImpl> seb = HRAppServiceImpl.class;
    SDOConfig cSdo = sdoConfig(schemas, false);
    SDOConfig sSdo = sdoConfig(schemas, true);
    srvConfig.setContractClass(sei);
    srvConfig.setEndpointClass(seb);
    DatabindingModeFeature dbm = new DatabindingModeFeature("eclipselink.sdo");
    WebServiceFeature[] features = { dbm };
    srvConfig.setFeatures(features);
    srvConfig.properties().put(SDOContextWrapper.SDO_SCHEMA_INFO, schemas);
    // srvConfig.properties().put(SDOContextWrapper.SDO_SCHEMA_FILE, f);
    srvConfig.properties().put(SDOContextWrapper.SDO_HELPER_CONTEXT_RESOLVER, sSdo.resolver);
    srvConfig.properties().put("com.sun.xml.ws.api.model.SuppressDocLitWrapperGeneration", true);
    DatabindingConfig cliConfig = new DatabindingConfig();
    cliConfig.setContractClass(sei);
    cliConfig.setFeatures(features);
    cliConfig.properties().put(SDOContextWrapper.SDO_SCHEMA_INFO, schemas);
    // cliConfig.properties().put(SDOContextWrapper.SDO_SCHEMA_FILE, f);
    cliConfig.properties().put(SDOContextWrapper.SDO_HELPER_CONTEXT_RESOLVER, cSdo.resolver);
    cliConfig.properties().put("com.sun.xml.ws.api.model.SuppressDocLitWrapperGeneration", true);
    HRAppService proxy = createProxy(sei, srvConfig, cliConfig, debug);
    doTest(proxy, cSdo.context);
}
Also used : DatabindingConfig(com.sun.xml.ws.api.databinding.DatabindingConfig) WebServiceFeature(jakarta.xml.ws.WebServiceFeature) DatabindingModeFeature(com.oracle.webservices.api.databinding.DatabindingModeFeature) SchemaInfo(com.sun.xml.ws.db.sdo.SchemaInfo)

Example 18 with DatabindingModeFeature

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

the class SDOHRAppServiceTest method testSDO_HRAppServiceNoWrapperBug.

// Bug 14071356
public void testSDO_HRAppServiceNoWrapperBug() throws Exception {
    Set<SchemaInfo> schemas = SDOUtils.getSchemas(getResource("wsdl/HRAppServiceBug.wsdl").getFile());
    DatabindingConfig srvConfig = new DatabindingConfig();
    Class<HRAppServiceNoWrapperBug> sei = HRAppServiceNoWrapperBug.class;
    Class<HRAppServiceImpl> seb = HRAppServiceImpl.class;
    SDOConfig cSdo = sdoConfig(schemas, false);
    SDOConfig sSdo = sdoConfig(schemas, true);
    srvConfig.setContractClass(sei);
    srvConfig.setEndpointClass(seb);
    DatabindingModeFeature dbm = new DatabindingModeFeature("eclipselink.sdo");
    WebServiceFeature[] features = { dbm };
    srvConfig.setFeatures(features);
    srvConfig.properties().put(SDOContextWrapper.SDO_SCHEMA_INFO, schemas);
    // srvConfig.properties().put(SDOContextWrapper.SDO_SCHEMA_FILE, f);
    srvConfig.properties().put(SDOContextWrapper.SDO_HELPER_CONTEXT_RESOLVER, sSdo.resolver);
    srvConfig.properties().put("com.sun.xml.ws.api.model.SuppressDocLitWrapperGeneration", true);
    DatabindingConfig cliConfig = new DatabindingConfig();
    cliConfig.setContractClass(sei);
    cliConfig.setFeatures(features);
    cliConfig.properties().put(SDOContextWrapper.SDO_SCHEMA_INFO, schemas);
    // cliConfig.properties().put(SDOContextWrapper.SDO_SCHEMA_FILE, f);
    cliConfig.properties().put(SDOContextWrapper.SDO_HELPER_CONTEXT_RESOLVER, cSdo.resolver);
    cliConfig.properties().put("com.sun.xml.ws.api.model.SuppressDocLitWrapperGeneration", true);
    HRAppServiceNoWrapperBug proxy = createProxy(sei, srvConfig, cliConfig, true);
    java.math.BigDecimal totalComp = proxy.getTotalComp(new BigInteger("222"));
    assertEquals("222", totalComp.toString());
    totalComp = proxy.getTotalComp(new BigInteger("333"));
    assertEquals("333", totalComp.toString());
}
Also used : DatabindingModeFeature(com.oracle.webservices.api.databinding.DatabindingModeFeature) DatabindingConfig(com.sun.xml.ws.api.databinding.DatabindingConfig) BigDecimal(java.math.BigDecimal) WebServiceFeature(jakarta.xml.ws.WebServiceFeature) BigInteger(java.math.BigInteger) SchemaInfo(com.sun.xml.ws.db.sdo.SchemaInfo)

Example 19 with DatabindingModeFeature

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

the class BasicDatabindingTestBase method testGlobalElementParamXmlBeansTopdown.

/**
 * Test topdown xbean TypedXmlBeansDOC
 */
public void testGlobalElementParamXmlBeansTopdown() throws Exception {
    Class endpointClass = TypedXmlBeansDOCImpl.class;
    Class proxySEIClass = TypedXmlBeansDOC.class;
    DatabindingConfig srvConfig = new DatabindingConfig();
    srvConfig.setEndpointClass(endpointClass);
    DatabindingModeFeature dbf = databindingMode();
    dbf.getProperties().put("com.sun.xml.ws.api.model.DocWrappeeNamespapceQualified", true);
    srvConfig.setMetadataReader(new JWSAnnotationReader());
    WebServiceFeature[] f = { dbf };
    srvConfig.setFeatures(f);
    DatabindingConfig cliConfig = new DatabindingConfig();
    cliConfig.setContractClass(proxySEIClass);
    cliConfig.setFeatures(f);
    cliConfig.setMetadataReader(new JWSAnnotationReader());
    TypedXmlBeansDOC proxy = createProxy(TypedXmlBeansDOC.class, srvConfig, cliConfig, true);
    {
        Holder<Countries> countries = new Holder<Countries>(new Countries());
        countries.value.getCountry().add(countryInfo("1", "banana"));
        countries.value.getCountry().add(countryInfo("2", "apple"));
        countries.value.getCountry().add(countryInfo("3", "peach"));
        proxy.addCountry(countries, countryInfo("x", "foo"));
        assertEquals(4, countries.value.getCountry().size());
    }
    {
        Countries countries = new Countries();
        countries.getCountry().add(countryInfo("1", "banana"));
        countries.getCountry().add(countryInfo("2", "apple"));
        String res = proxy.getCountryName(countries, "hello");
        assertEquals("hello2", res);
    }
}
Also used : DatabindingConfig(com.sun.xml.ws.api.databinding.DatabindingConfig) Countries(com.sun.xml.ws.test.xbeandoc.Countries) Holder(jakarta.xml.ws.Holder) TypedXmlBeansDOCImpl(com.sun.xml.ws.test.xbeandoc.TypedXmlBeansDOCImpl) WebServiceFeature(jakarta.xml.ws.WebServiceFeature) DatabindingModeFeature(com.oracle.webservices.api.databinding.DatabindingModeFeature) TypedXmlBeansDOC(com.sun.xml.ws.test.xbeandoc.TypedXmlBeansDOC)

Example 20 with DatabindingModeFeature

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

the class BasicDatabindingTestBase method testWebParamHolder.

public void testWebParamHolder() throws Exception {
    DatabindingModeFeature dbm = databindingMode();
    WebServiceFeature[] f = { dbm };
    DatabindingConfig cliConfig = new DatabindingConfig();
    cliConfig.setEndpointClass(WebParamHolderSEB.class);
    cliConfig.setFeatures(f);
    Databinding db = (Databinding) factory.createRuntime(cliConfig);
    assertNotNull(db);
}
Also used : DatabindingConfig(com.sun.xml.ws.api.databinding.DatabindingConfig) WebServiceFeature(jakarta.xml.ws.WebServiceFeature) DatabindingModeFeature(com.oracle.webservices.api.databinding.DatabindingModeFeature) Databinding(com.sun.xml.ws.api.databinding.Databinding)

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