use of org.apache.camel.dataformat.soap.SoapJaxbDataFormat in project camel by apache.
the class Soap12MarshalTest method createDataFormat.
/**
* Create data format by using the constructor
*/
protected SoapJaxbDataFormat createDataFormat() {
String jaxbPackage = GetCustomersByName.class.getPackage().getName();
ElementNameStrategy elStrat = new TypeNameStrategy();
SoapJaxbDataFormat answer = new SoapJaxbDataFormat(jaxbPackage, elStrat);
answer.setVersion("1.2");
return answer;
}
use of org.apache.camel.dataformat.soap.SoapJaxbDataFormat in project wildfly-camel by wildfly-extras.
the class SOAPServiceInterfaceStrategyIntegrationTest method testSOAPServiceInterfaceStrategyMarshal.
@Test
public void testSOAPServiceInterfaceStrategyMarshal() throws Exception {
ServiceInterfaceStrategy strategy = new ServiceInterfaceStrategy(CustomerService.class, true);
final SoapJaxbDataFormat format = new SoapJaxbDataFormat("org.wildfly.camel.test.common.types", strategy);
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")) {
Customer customer = new Customer();
customer.setFirstName("Kermit");
customer.setLastName("The Frog");
ProducerTemplate template = camelctx.createProducerTemplate();
String result = template.requestBody("direct:start", customer, String.class);
Assert.assertEquals(XMLUtils.compactXML(input), XMLUtils.compactXML(result));
} finally {
camelctx.stop();
}
}
use of org.apache.camel.dataformat.soap.SoapJaxbDataFormat in project wildfly-camel by wildfly-extras.
the class SOAPIntegrationTest method testSoapMarshal.
@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.stop();
}
}
Aggregations