Search in sources :

Example 1 with Hello

use of org.apache.camel.cxf.mtom_feature.Hello in project camel by apache.

the class CxfMtomRouterRawModeTest method getPort.

@Override
protected Hello getPort() {
    URL wsdl = getClass().getResource("/mtom.wsdl");
    assertNotNull("WSDL is null", wsdl);
    HelloService service = new HelloService(wsdl, HelloService.SERVICE);
    assertNotNull("Service is null ", service);
    Hello port = service.getHelloPort();
    ((BindingProvider) port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:" + port1 + "/CxfMtomRouterRawModeTest/jaxws-mtom/hello");
    return port;
}
Also used : Hello(org.apache.camel.cxf.mtom_feature.Hello) HelloService(org.apache.camel.cxf.mtom_feature.HelloService) URL(java.net.URL)

Example 2 with Hello

use of org.apache.camel.cxf.mtom_feature.Hello in project camel by apache.

the class CxfMtomConsumerTest method testInvokingService.

@Test
public void testInvokingService() throws Exception {
    if (MtomTestHelper.isAwtHeadless(null, log)) {
        return;
    }
    Holder<byte[]> photo = new Holder<byte[]>("RequestFromCXF".getBytes("UTF-8"));
    Holder<Image> image = new Holder<Image>(getImage("/java.jpg"));
    Hello port = getPort();
    SOAPBinding binding = (SOAPBinding) ((BindingProvider) port).getBinding();
    binding.setMTOMEnabled(true);
    port.detail(photo, image);
    assertEquals("ResponseFromCamel", new String(photo.value, "UTF-8"));
    assertNotNull(image.value);
}
Also used : Hello(org.apache.camel.cxf.mtom_feature.Hello) Holder(javax.xml.ws.Holder) SOAPBinding(javax.xml.ws.soap.SOAPBinding) Image(java.awt.Image) Test(org.junit.Test)

Example 3 with Hello

use of org.apache.camel.cxf.mtom_feature.Hello in project camel by apache.

the class CxfMtomRouterCxfMessageModeTest method getPort.

@Override
protected Hello getPort() {
    URL wsdl = getClass().getResource("/mtom.wsdl");
    assertNotNull("WSDL is null", wsdl);
    HelloService service = new HelloService(wsdl, HelloService.SERVICE);
    assertNotNull("Service is null ", service);
    Hello port = service.getHelloPort();
    ((BindingProvider) port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:" + port1 + "/CxfMtomRouterCxfMessageModeTest/jaxws-mtom/hello");
    return port;
}
Also used : Hello(org.apache.camel.cxf.mtom_feature.Hello) HelloService(org.apache.camel.cxf.mtom_feature.HelloService) URL(java.net.URL)

Example 4 with Hello

use of org.apache.camel.cxf.mtom_feature.Hello in project camel by apache.

the class CxfMtomRouterPayloadModeTest method getPort.

protected Hello getPort() {
    URL wsdl = getClass().getResource("/mtom.wsdl");
    assertNotNull("WSDL is null", wsdl);
    HelloService service = new HelloService(wsdl, HelloService.SERVICE);
    assertNotNull("Service is null ", service);
    Hello port = service.getHelloPort();
    ((BindingProvider) port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:" + port1 + "/CxfMtomRouterPayloadModeTest/jaxws-mtom/hello");
    return port;
}
Also used : Hello(org.apache.camel.cxf.mtom_feature.Hello) HelloService(org.apache.camel.cxf.mtom_feature.HelloService) URL(java.net.URL)

Example 5 with Hello

use of org.apache.camel.cxf.mtom_feature.Hello in project camel by apache.

the class CxfMtomRouterPayloadModeTest method testInvokingServiceFromCXFClient.

@Test
public void testInvokingServiceFromCXFClient() throws Exception {
    if (MtomTestHelper.isAwtHeadless(logger, null)) {
        return;
    }
    Holder<byte[]> photo = new Holder<byte[]>(MtomTestHelper.REQ_PHOTO_DATA);
    Holder<Image> image = new Holder<Image>(getImage("/java.jpg"));
    Hello port = getPort();
    SOAPBinding binding = (SOAPBinding) ((BindingProvider) port).getBinding();
    binding.setMTOMEnabled(true);
    port.detail(photo, image);
    MtomTestHelper.assertEquals(MtomTestHelper.RESP_PHOTO_DATA, photo.value);
    Assert.assertNotNull(image.value);
    if (image.value instanceof BufferedImage) {
        Assert.assertEquals(560, ((BufferedImage) image.value).getWidth());
        Assert.assertEquals(300, ((BufferedImage) image.value).getHeight());
    }
}
Also used : Hello(org.apache.camel.cxf.mtom_feature.Hello) Holder(javax.xml.ws.Holder) SOAPBinding(javax.xml.ws.soap.SOAPBinding) Image(java.awt.Image) BufferedImage(java.awt.image.BufferedImage) BufferedImage(java.awt.image.BufferedImage) Test(org.junit.Test)

Aggregations

Hello (org.apache.camel.cxf.mtom_feature.Hello)7 URL (java.net.URL)5 HelloService (org.apache.camel.cxf.mtom_feature.HelloService)4 Image (java.awt.Image)2 Holder (javax.xml.ws.Holder)2 SOAPBinding (javax.xml.ws.soap.SOAPBinding)2 Test (org.junit.Test)2 BufferedImage (java.awt.image.BufferedImage)1 HelloService12 (org.apache.camel.cxf.mtom_feature.HelloService12)1