Search in sources :

Example 1 with TypeNameStrategy

use of org.apache.camel.dataformat.soap.name.TypeNameStrategy in project camel by apache.

the class SoapServerTest method createRouteBuilder.

@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {

        String jaxbPackage = GetCustomersByName.class.getPackage().getName();

        @Override
        public void configure() throws Exception {
            ElementNameStrategy elNameStrat = new TypeNameStrategy();
            SoapJaxbDataFormat soapDataFormat = new SoapJaxbDataFormat(jaxbPackage, elNameStrat);
            CustomerServiceImpl serverBean = new CustomerServiceImpl();
            // 
            from("direct:start").onException(Exception.class).handled(//
            true).marshal(//
            soapDataFormat).end().unmarshal(//
            soapDataFormat).bean(//
            serverBean).marshal(soapDataFormat);
        }
    };
}
Also used : ElementNameStrategy(org.apache.camel.dataformat.soap.name.ElementNameStrategy) RouteBuilder(org.apache.camel.builder.RouteBuilder) TypeNameStrategy(org.apache.camel.dataformat.soap.name.TypeNameStrategy)

Example 2 with TypeNameStrategy

use of org.apache.camel.dataformat.soap.name.TypeNameStrategy in project camel by apache.

the class SoapToSoapDontIgnoreTest method setup.

@BeforeClass
public static void setup() {
    namespacePrefixMap = new HashMap<String, String>();
    namespacePrefixMap.put("http://schemas.xmlsoap.org/soap/envelope/", "soap");
    namespacePrefixMap.put("http://www.w3.org/2001/XMLSchema", "xsd");
    namespacePrefixMap.put("http://www.w3.org/2001/XMLSchema-instance", "xsi");
    namespacePrefixMap.put("http://www.example.com/contact", "cont");
    namespacePrefixMap.put("http://www.example.com/soapheaders", "custom");
    soapjaxbModel = new SoapJaxbDataFormat("com.example.contact:com.example.soapheaders");
    soapjaxbModel.setNamespacePrefix(namespacePrefixMap);
    soapjaxbModel.setPrettyPrint(true);
    soapjaxbModel.setIgnoreUnmarshalledHeaders(false);
    soapjaxbModel.setIgnoreJAXBElement(false);
    soapjaxbModel.setElementNameStrategy(new TypeNameStrategy());
    soapjaxbModelDontIgnoreUnmarshalled = new SoapJaxbDataFormat("com.example.contact:com.example.soapheaders");
    soapjaxbModelDontIgnoreUnmarshalled.setNamespacePrefix(namespacePrefixMap);
    soapjaxbModelDontIgnoreUnmarshalled.setPrettyPrint(true);
    soapjaxbModelDontIgnoreUnmarshalled.setIgnoreUnmarshalledHeaders(false);
    soapjaxbModelDontIgnoreUnmarshalled.setElementNameStrategy(new TypeNameStrategy());
}
Also used : TypeNameStrategy(org.apache.camel.dataformat.soap.name.TypeNameStrategy) BeforeClass(org.junit.BeforeClass)

Example 3 with TypeNameStrategy

use of org.apache.camel.dataformat.soap.name.TypeNameStrategy in project camel by apache.

the class SoapToSoapIgnoreTest method setup.

@BeforeClass
public static void setup() {
    namespacePrefixMap = new HashMap<String, String>();
    namespacePrefixMap.put("http://schemas.xmlsoap.org/soap/envelope/", "soap");
    namespacePrefixMap.put("http://www.w3.org/2001/XMLSchema", "xsd");
    namespacePrefixMap.put("http://www.w3.org/2001/XMLSchema-instance", "xsi");
    namespacePrefixMap.put("http://www.example.com/contact", "cont");
    namespacePrefixMap.put("http://www.example.com/soapheaders", "custom");
    soapjaxbModel = new SoapJaxbDataFormat("com.example.contact:com.example.soapheaders");
    soapjaxbModel.setNamespacePrefix(namespacePrefixMap);
    soapjaxbModel.setPrettyPrint(true);
    soapjaxbModel.setIgnoreUnmarshalledHeaders(false);
    soapjaxbModel.setIgnoreJAXBElement(false);
    soapjaxbModel.setElementNameStrategy(new TypeNameStrategy());
    soapjaxbModelIgnoreUnmarshalled = new SoapJaxbDataFormat("com.example.contact:com.example.soapheaders");
    soapjaxbModelIgnoreUnmarshalled.setNamespacePrefix(namespacePrefixMap);
    soapjaxbModelIgnoreUnmarshalled.setPrettyPrint(true);
    soapjaxbModelIgnoreUnmarshalled.setIgnoreUnmarshalledHeaders(true);
    soapjaxbModelIgnoreUnmarshalled.setElementNameStrategy(new TypeNameStrategy());
}
Also used : TypeNameStrategy(org.apache.camel.dataformat.soap.name.TypeNameStrategy) BeforeClass(org.junit.BeforeClass)

Example 4 with TypeNameStrategy

use of org.apache.camel.dataformat.soap.name.TypeNameStrategy in project camel by apache.

the class SoapToSoapSingleDataFormatterTest method setup.

@BeforeClass
public static void setup() {
    namespacePrefixMap = new HashMap<String, String>();
    namespacePrefixMap.put("http://schemas.xmlsoap.org/soap/envelope/", "soap");
    namespacePrefixMap.put("http://www.w3.org/2001/XMLSchema", "xsd");
    namespacePrefixMap.put("http://www.w3.org/2001/XMLSchema-instance", "xsi");
    namespacePrefixMap.put("http://www.example.com/contact", "cont");
    namespacePrefixMap.put("http://www.example.com/soapheaders", "custom");
    soapjaxbModel = new SoapJaxbDataFormat("com.example.contact:com.example.soapheaders");
    soapjaxbModel.setNamespacePrefix(namespacePrefixMap);
    soapjaxbModel.setPrettyPrint(true);
    soapjaxbModel.setIgnoreUnmarshalledHeaders(false);
    soapjaxbModel.setIgnoreJAXBElement(false);
    soapjaxbModel.setElementNameStrategy(new TypeNameStrategy());
}
Also used : TypeNameStrategy(org.apache.camel.dataformat.soap.name.TypeNameStrategy) BeforeClass(org.junit.BeforeClass)

Example 5 with TypeNameStrategy

use of org.apache.camel.dataformat.soap.name.TypeNameStrategy in project camel by apache.

the class TypeNameStrategyTest method testNoPackageInfo.

@Test
public void testNoPackageInfo() {
    TypeNameStrategy strategy = new TypeNameStrategy();
    QName name = strategy.findQNameForSoapActionOrType("", AnnotatedClassWithoutNamespace.class);
    Assert.assertEquals("test", name.getLocalPart());
    Assert.assertEquals("##default", name.getNamespaceURI());
    QName name2 = strategy.findQNameForSoapActionOrType("", AnnotatedClassWithNamespace.class);
    Assert.assertEquals("test", name2.getLocalPart());
    Assert.assertEquals("http://mynamespace", name2.getNamespaceURI());
}
Also used : QName(javax.xml.namespace.QName) TypeNameStrategy(org.apache.camel.dataformat.soap.name.TypeNameStrategy) Test(org.junit.Test)

Aggregations

TypeNameStrategy (org.apache.camel.dataformat.soap.name.TypeNameStrategy)10 ElementNameStrategy (org.apache.camel.dataformat.soap.name.ElementNameStrategy)4 BeforeClass (org.junit.BeforeClass)3 Test (org.junit.Test)3 GetCustomersByName (com.example.customerservice.GetCustomersByName)2 QName (javax.xml.namespace.QName)2 RouteBuilder (org.apache.camel.builder.RouteBuilder)2 SoapJaxbDataFormat (org.apache.camel.dataformat.soap.SoapJaxbDataFormat)1