Search in sources :

Example 6 with Holder

use of jakarta.xml.ws.Holder in project metro-jax-ws by eclipse-ee4j.

the class SoapMuHeaderTest method testMUHeaderNotInWSDL.

public void testMUHeaderNotInWSDL() {
    Hello_Service service = new Hello_Service();
    Hello port = service.getHelloPort();
    Holder<String> extra = new Holder<String>();
    try {
        port.hello("extraMU", extra);
        fail("MU Exception expected");
    } catch (SOAPFaultException e) {
        assertTrue(e.getFault().getFaultCode().endsWith(":MustUnderstand"));
    }
}
Also used : Hello(client.soap_mu_header.client.Hello) Hello_Service(client.soap_mu_header.client.Hello_Service) Holder(jakarta.xml.ws.Holder) SOAPFaultException(jakarta.xml.ws.soap.SOAPFaultException)

Example 7 with Holder

use of jakarta.xml.ws.Holder in project metro-jax-ws by eclipse-ee4j.

the class HelloLiteralTest method testEchoImageWithInfo.

public void testEchoImageWithInfo() throws Exception {
    String imageType = "image/jpeg";
    Holder<String> outImageType = new Holder<String>();
    Holder<Image> outImage = new Holder<Image>();
    Map<String, DataHandler> att = new HashMap<String, DataHandler>();
    att.put("<abcd@example.org>", new DataHandler(getSource("sample.xml"), "text/xml"));
    ((BindingProvider) port).getRequestContext().put(MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS, att);
    port.echoImageWithInfo(imageType, getImage("vivek.jpg"), outImageType, outImage);
    assertEquals(outImageType.value, imageType);
    assertNotNull(outImage.value);
    assertTrue(AttachmentHelper.compareImages(getImage("vivek.jpg"), outImage.value));
}
Also used : HashMap(java.util.HashMap) Holder(jakarta.xml.ws.Holder) DataHandler(jakarta.activation.DataHandler) Image(java.awt.Image)

Example 8 with Holder

use of jakarta.xml.ws.Holder in project metro-jax-ws by eclipse-ee4j.

the class MtomAppTest method testUpload.

public void testUpload() throws Exception {
    int size = 123 * 1000 * 1000;
    Hello port = new HelloService().getHelloPort(new MTOMFeature());
    Map<String, Object> ctxt = ((BindingProvider) port).getRequestContext();
    // At present, JDK internal property - not supported
    ctxt.put("com.sun.xml.internal.ws.transport.http.client.streaming.chunk.size", 8192);
    // Add this one to run with standalone RI bits
    ctxt.put("com.sun.xml.ws.transport.http.client.streaming.chunk.size", 8192);
    Holder<Integer> total = new Holder<Integer>(size);
    Holder<String> name = new Holder<String>("huge");
    Holder<DataHandler> dh = new Holder<DataHandler>(getDataHandler(total.value));
    port.upload(total, name, dh);
    if (!"hugehuge".equals(name.value)) {
        fail("FAIL: Expecting: hugehuge Got: " + name.value);
    }
    if (!total.value.equals(size + 1)) {
        fail("FAIL: Expecting size: " + (size + 1) + " Got: " + total.value);
    }
    System.out.println("SUCCESS: Got: " + name.value);
    System.out.println("Going to verify DataHandler. This would take some time");
    validateDataHandler(total.value, dh.value);
    System.out.println("SUCCESS: DataHandler is verified");
    if (dh.value instanceof Closeable) {
        System.out.println("Client:Received DH is closeable");
        ((Closeable) dh.value).close();
    }
}
Also used : MTOMFeature(jakarta.xml.ws.soap.MTOMFeature) Holder(jakarta.xml.ws.Holder) Closeable(java.io.Closeable) BindingProvider(jakarta.xml.ws.BindingProvider) DataHandler(jakarta.activation.DataHandler)

Example 9 with Holder

use of jakarta.xml.ws.Holder in project metro-jax-ws by eclipse-ee4j.

the class FiberTest method testStartTubePacketCompletionCallback.

public void testStartTubePacketCompletionCallback() {
    final Holder<Boolean> isInExecutor = new Holder<Boolean>(Boolean.FALSE);
    TestTube testTube = new TestTube() {

        @Override
        @NotNull
        public NextAction processRequest(@NotNull Packet request) {
            isInExecutor.value = executor.isInExecutor();
            return super.processRequest(request);
        }
    };
    Packet request = new Packet();
    SimpleCompletionCallback callback = new SimpleCompletionCallback();
    Fiber fiber = engine.createFiber();
    assertNotNull(fiber);
    fiber.start(testTube, request, callback);
    assertEquals(request, callback.response);
    assertNull(callback.error);
    List<TubeCall> calls = testTube.getCalls();
    assertNotNull(calls);
    assertEquals(1, calls.size());
    TubeCall firstCall = calls.get(0);
    assertNotNull(firstCall);
    assertEquals(TubeCallType.REQUEST, firstCall.callType);
    assertEquals(testContainer, firstCall.container);
    assertTrue(isInExecutor.value);
}
Also used : Packet(com.sun.xml.ws.api.message.Packet) TestTube(com.sun.xml.ws.api.pipe.EngineTest.TestTube) Holder(jakarta.xml.ws.Holder) TubeCall(com.sun.xml.ws.api.pipe.EngineTest.TubeCall) SimpleCompletionCallback(com.sun.xml.ws.api.pipe.EngineTest.SimpleCompletionCallback) NotNull(com.sun.istack.NotNull)

Example 10 with Holder

use of jakarta.xml.ws.Holder in project metro-jax-ws by eclipse-ee4j.

the class FiberTest method testStartTubePacketCompletionCallbackBoolean.

public void testStartTubePacketCompletionCallbackBoolean() {
    final Holder<Boolean> isInExecutor = new Holder<Boolean>(Boolean.FALSE);
    TestTube testTube = new TestTube() {

        @Override
        @NotNull
        public NextAction processRequest(@NotNull Packet request) {
            isInExecutor.value = executor.isInExecutor();
            return super.processRequest(request);
        }
    };
    Packet request = new Packet();
    SimpleCompletionCallback callback = new SimpleCompletionCallback();
    Fiber fiber = engine.createFiber();
    assertNotNull(fiber);
    fiber.start(testTube, request, callback, true);
    assertEquals(request, callback.response);
    assertNull(callback.error);
    List<TubeCall> calls = testTube.getCalls();
    assertNotNull(calls);
    assertEquals(1, calls.size());
    TubeCall firstCall = calls.get(0);
    assertNotNull(firstCall);
    assertEquals(TubeCallType.REQUEST, firstCall.callType);
    assertEquals(testContainer, firstCall.container);
    assertFalse(isInExecutor.value);
}
Also used : Packet(com.sun.xml.ws.api.message.Packet) TestTube(com.sun.xml.ws.api.pipe.EngineTest.TestTube) Holder(jakarta.xml.ws.Holder) TubeCall(com.sun.xml.ws.api.pipe.EngineTest.TubeCall) SimpleCompletionCallback(com.sun.xml.ws.api.pipe.EngineTest.SimpleCompletionCallback) NotNull(com.sun.istack.NotNull)

Aggregations

Holder (jakarta.xml.ws.Holder)14 Packet (com.sun.xml.ws.api.message.Packet)3 DataHandler (jakarta.activation.DataHandler)3 Hello (client.soap_mu_header.client.Hello)2 Hello_Service (client.soap_mu_header.client.Hello_Service)2 NotNull (com.sun.istack.NotNull)2 TXWResult (com.sun.xml.txw2.output.TXWResult)2 SimpleCompletionCallback (com.sun.xml.ws.api.pipe.EngineTest.SimpleCompletionCallback)2 TestTube (com.sun.xml.ws.api.pipe.EngineTest.TestTube)2 TubeCall (com.sun.xml.ws.api.pipe.EngineTest.TubeCall)2 BindingProvider (jakarta.xml.ws.BindingProvider)2 WebServiceException (jakarta.xml.ws.WebServiceException)2 MTOMFeature (jakarta.xml.ws.soap.MTOMFeature)2 Result (javax.xml.transform.Result)2 DOMResult (javax.xml.transform.dom.DOMResult)2 SAXResult (javax.xml.transform.sax.SAXResult)2 DatabindingModeFeature (com.oracle.webservices.api.databinding.DatabindingModeFeature)1 XmlSerializer (com.sun.xml.txw2.output.XmlSerializer)1 BindingID (com.sun.xml.ws.api.BindingID)1 ComponentFeature (com.sun.xml.ws.api.ComponentFeature)1