Java Code Examples for org.apache.camel.dataformat.soap.SoapJaxbDataFormat#setContextPath()
The following examples show how to use
org.apache.camel.dataformat.soap.SoapJaxbDataFormat#setContextPath() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SOAPIntegrationTest.java From wildfly-camel with Apache License 2.0 | 6 votes |
@Test public void testSoapMarshal() throws Exception { final SoapJaxbDataFormat format = new SoapJaxbDataFormat(); format.setContextPath("org.wildfly.camel.test.jaxb.model"); CamelContext camelctx = new DefaultCamelContext(); camelctx.addRoutes(new RouteBuilder() { @Override public void configure() throws Exception { from("direct:start") .marshal(format); } }); camelctx.start(); try (InputStream input = getClass().getResourceAsStream("/envelope.xml")) { String expected = XMLUtils.compactXML(input); ProducerTemplate producer = camelctx.createProducerTemplate(); Customer customer = new Customer("John", "Doe"); String customerXML = producer.requestBody("direct:start", customer, String.class); Assert.assertEquals(expected, XMLUtils.compactXML(customerXML)); } finally { camelctx.close(); } }
Example 2
Source File: SOAPIntegrationTest.java From wildfly-camel with Apache License 2.0 | 6 votes |
@Test public void testSoapUnmarshal() throws Exception { final SoapJaxbDataFormat format = new SoapJaxbDataFormat(); format.setContextPath("org.wildfly.camel.test.jaxb.model"); CamelContext camelctx = new DefaultCamelContext(); camelctx.addRoutes(new RouteBuilder() { @Override public void configure() throws Exception { from("direct:start") .unmarshal(format); } }); camelctx.start(); try (InputStream input = getClass().getResourceAsStream("/envelope.xml")) { ProducerTemplate producer = camelctx.createProducerTemplate(); Element response = producer.requestBody("direct:start", input, Element.class); Assert.assertEquals("Customer", response.getLocalName()); } finally { camelctx.close(); } }
Example 3
Source File: SOAPIntegrationTest.java From wildfly-camel with Apache License 2.0 | 6 votes |
@Test public void testSoapV1_2Marshal() throws Exception { final SoapJaxbDataFormat format = new SoapJaxbDataFormat(); format.setContextPath("org.wildfly.camel.test.jaxb.model"); CamelContext camelctx = new DefaultCamelContext(); camelctx.addRoutes(new RouteBuilder() { @Override public void configure() throws Exception { from("direct:start") .marshal(format); } }); camelctx.start(); try (InputStream input = getClass().getResourceAsStream("/envelope-1.2-marshal.xml")) { String expected = camelctx.getTypeConverter().mandatoryConvertTo(String.class, input); ProducerTemplate producer = camelctx.createProducerTemplate(); Customer customer = new Customer("John", "Doe"); String customerXML = producer.requestBody("direct:start", customer, String.class); Assert.assertEquals(expected, XMLUtils.compactXML(customerXML)); } finally { camelctx.close(); } }
Example 4
Source File: SOAPIntegrationTest.java From wildfly-camel with Apache License 2.0 | 6 votes |
@Test public void testSoapV1_2Unmarshal() throws Exception { final SoapJaxbDataFormat format = new SoapJaxbDataFormat(); format.setContextPath("org.wildfly.camel.test.jaxb.model"); format.setVersion("1.2"); CamelContext camelctx = new DefaultCamelContext(); camelctx.addRoutes(new RouteBuilder() { @Override public void configure() throws Exception { from("direct:start") .unmarshal(format); } }); camelctx.start(); try (InputStream input = getClass().getResourceAsStream("/envelope-1.2-unmarshal.xml")) { ProducerTemplate producer = camelctx.createProducerTemplate(); Element response = producer.requestBody("direct:start", input, Element.class); Assert.assertEquals("Customer", response.getLocalName()); } finally { camelctx.close(); } }