Search in sources :

Example 1 with Hello

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

the class MTOMBindingTypeTest method testEcho.

@Test
@org.junit.Ignore
public void testEcho() throws Exception {
    byte[] bytes = ImageHelper.getImageBytes(getImage("/java.jpg"), "image/jpeg");
    Holder<byte[]> image = new Holder<>(bytes);
    Hello port = getPort();
    SOAPBinding binding = (SOAPBinding) ((BindingProvider) port).getBinding();
    binding.setMTOMEnabled(true);
    port.echoData(image);
    assertNotNull(image);
}
Also used : Hello(org.apache.cxf.systest.mtom_feature.Hello) Holder(javax.xml.ws.Holder) SOAPBinding(javax.xml.ws.soap.SOAPBinding) Test(org.junit.Test)

Example 2 with Hello

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

the class MTOMBindingTypeTest method getPort.

private Hello getPort() {
    URL wsdl = getClass().getResource("/wsdl_systest/mtom.wsdl");
    assertNotNull("WSDL is null", wsdl);
    HelloService service = new HelloService(wsdl, serviceName);
    assertNotNull("Service is null ", service);
    Hello hello = service.getHelloPort();
    try {
        updateAddressPort(hello, PORT);
    } catch (Exception ex) {
    // ignore
    }
    return hello;
}
Also used : Hello(org.apache.cxf.systest.mtom_feature.Hello) HelloService(org.apache.cxf.systest.mtom_feature.HelloService) URL(java.net.URL)

Example 3 with Hello

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

the class MTOMBindingTypeTest method testDetail.

@Test
public void testDetail() throws Exception {
    ByteArrayOutputStream input = setupInLogging();
    ByteArrayOutputStream output = setupOutLogging();
    Holder<byte[]> photo = new Holder<>("CXF".getBytes());
    Holder<Image> image = new Holder<>(getImage("/java.jpg"));
    Hello port = getPort();
    SOAPBinding binding = (SOAPBinding) ((BindingProvider) port).getBinding();
    binding.setMTOMEnabled(true);
    port.detail(photo, image);
    String expected = "<xop:Include ";
    assertTrue(output.toString().indexOf(expected) != -1);
    assertTrue(input.toString().indexOf(expected) != -1);
    assertEquals("CXF", new String(photo.value));
    assertNotNull(image.value);
}
Also used : Hello(org.apache.cxf.systest.mtom_feature.Hello) Holder(javax.xml.ws.Holder) SOAPBinding(javax.xml.ws.soap.SOAPBinding) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Image(java.awt.Image) Test(org.junit.Test)

Aggregations

Hello (org.apache.cxf.systest.mtom_feature.Hello)3 Holder (javax.xml.ws.Holder)2 SOAPBinding (javax.xml.ws.soap.SOAPBinding)2 Test (org.junit.Test)2 Image (java.awt.Image)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 URL (java.net.URL)1 HelloService (org.apache.cxf.systest.mtom_feature.HelloService)1