Search in sources :

Example 11 with BindingImpl

use of com.sun.xml.ws.binding.BindingImpl in project metro-jax-ws by eclipse-ee4j.

the class AddNumbersClient method testReplyToRefpsWithWSDL.

public void testReplyToRefpsWithWSDL() throws Exception {
    MemberSubmissionAddressingFeature addressingFeature = new MemberSubmissionAddressingFeature(false);
    WebServiceFeature[] features = new WebServiceFeature[] { addressingFeature };
    Dispatch dispatch = createDispatchWithWSDL(features);
    BindingImpl binding = (BindingImpl) dispatch.getBinding();
    boolean enabled = AddressingVersion.isEnabled(binding);
    assertTrue(enabled);
    SOAPMessage response = WsaUtils.invoke(dispatch, WsaUtils.REPLY_TO_REFPS_MESSAGE, WsaUtils.S11_NS, WsaUtils.W3C_WSA_NS, getAddress(), W3CAddressingConstants.WSA_ANONYMOUS_ADDRESS, CORRECT_ACTION);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    response.writeTo(baos);
    assertXpathExists(REPLY_TO_REFPS, baos.toString());
    assertXpathEvaluatesTo(REPLY_TO_REFPS_VALUE, baos.toString(), "Key#123456789");
    assertXpathExists(REPLY_TO_REFPS_ISREFP, baos.toString());
}
Also used : BindingImpl(com.sun.xml.ws.binding.BindingImpl) WebServiceFeature(jakarta.xml.ws.WebServiceFeature) Dispatch(jakarta.xml.ws.Dispatch) ByteArrayOutputStream(java.io.ByteArrayOutputStream) MemberSubmissionAddressingFeature(com.sun.xml.ws.developer.MemberSubmissionAddressingFeature) SOAPMessage(jakarta.xml.soap.SOAPMessage)

Example 12 with BindingImpl

use of com.sun.xml.ws.binding.BindingImpl in project metro-jax-ws by eclipse-ee4j.

the class AddNumbersClient method testMissingActionWithWSDL.

public void testMissingActionWithWSDL() throws Exception {
    try {
        WebServiceFeature[] features = new WebServiceFeature[] { new AddressingFeature(false) };
        Dispatch dispatch = createDispatchWithWSDL(features);
        BindingImpl binding = (BindingImpl) dispatch.getBinding();
        AddressingVersion addressingVersion = AddressingVersion.fromBinding(binding);
        System.out.println("Addressing version is " + addressingVersion);
        assertFalse(AddressingVersion.isEnabled(binding));
        WsaUtils.invoke(dispatch, WsaUtils.MISSING_ACTION_MESSAGE, WsaUtils.S11_NS, WsaUtils.W3C_WSA_NS, getAddress(), W3CAddressingConstants.WSA_ANONYMOUS_ADDRESS);
        fail("SOAPFaultException must be thrown");
    } catch (SOAPFaultException sfe) {
        assertFault(sfe, W3CAddressingConstants.MAP_REQUIRED_QNAME);
    }
}
Also used : BindingImpl(com.sun.xml.ws.binding.BindingImpl) AddressingFeature(jakarta.xml.ws.soap.AddressingFeature) MemberSubmissionAddressingFeature(com.sun.xml.ws.developer.MemberSubmissionAddressingFeature) AddressingVersion(com.sun.xml.ws.api.addressing.AddressingVersion) WebServiceFeature(jakarta.xml.ws.WebServiceFeature) Dispatch(jakarta.xml.ws.Dispatch) SOAPFaultException(jakarta.xml.ws.soap.SOAPFaultException)

Example 13 with BindingImpl

use of com.sun.xml.ws.binding.BindingImpl in project metro-jax-ws by eclipse-ee4j.

the class CharactersTest method handleCharacters.

private void handleCharacters(int size) throws Exception {
    BindingID bid = BindingID.parse(SOAPBinding.SOAP11HTTP_MTOM_BINDING);
    BindingImpl binding = (BindingImpl) bid.createBinding();
    Codec codec = binding.createCodec();
    TestMessage msg = new TestMessage(size);
    Packet packet = new Packet();
    codec.decode(msg.getInputStream(), msg.getContentType(), packet);
    ByteArrayOutputStream bout = new ByteArrayOutputStream();
    XMLStreamWriter sw = XMLStreamWriterFactory.create(bout);
    packet.getMessage().writeTo(sw);
    sw.close();
    InputStream in = new ByteArrayInputStream(bout.toByteArray());
    XMLStreamReader sr = XMLStreamReaderFactory.create(null, in, true);
    while (sr.hasNext()) {
        sr.next();
        if (sr.getEventType() == XMLStreamReader.START_ELEMENT && sr.getLocalName().equals("doc1")) {
            assertEquals(msg.getEncodedText(), sr.getElementText().trim());
        }
    }
}
Also used : BindingImpl(com.sun.xml.ws.binding.BindingImpl) Packet(com.sun.xml.ws.api.message.Packet) Codec(com.sun.xml.ws.api.pipe.Codec) XMLStreamReader(javax.xml.stream.XMLStreamReader) ByteArrayInputStream(java.io.ByteArrayInputStream) XMLStreamWriter(javax.xml.stream.XMLStreamWriter) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) BindingID(com.sun.xml.ws.api.BindingID)

Example 14 with BindingImpl

use of com.sun.xml.ws.binding.BindingImpl in project metro-jax-ws by eclipse-ee4j.

the class NonAnonymousResponseProcessor method process.

/**
 * Send a response to a non-anonymous address. Also closes the transport back channel
 * of {@link Packet} if it's not closed already.
 *
 * @param packet
 *      The response from our server, which will be delivered to the destination.
 * @return The response packet that should be used to complete the tubeline response processing
 */
public Packet process(Packet packet) {
    Fiber.CompletionCallback fiberCallback = null;
    Fiber currentFiber = Fiber.getCurrentIfSet();
    if (currentFiber != null) {
        // Link completion of the current fiber to the new fiber that will
        // deliver the async response. This allows access to the response
        // packet that may be generated by sending a new message for the
        // current async response.
        final Fiber.CompletionCallback currentFiberCallback = currentFiber.getCompletionCallback();
        if (currentFiberCallback != null) {
            fiberCallback = new Fiber.CompletionCallback() {

                public void onCompletion(@NotNull Packet response) {
                    currentFiberCallback.onCompletion(response);
                }

                public void onCompletion(@NotNull Throwable error) {
                    currentFiberCallback.onCompletion(error);
                }
            };
            currentFiber.setCompletionCallback(null);
        }
    }
    // we need to assemble a pipeline to talk to this endpoint.
    WSEndpoint<?> endpoint = packet.endpoint;
    WSBinding binding = endpoint.getBinding();
    Tube transport = TransportTubeFactory.create(Thread.currentThread().getContextClassLoader(), new ClientTubeAssemblerContext(packet.endpointAddress, endpoint.getPort(), (WSService) null, binding, endpoint.getContainer(), ((BindingImpl) binding).createCodec(), null, null));
    Fiber fiber = endpoint.getEngine().createFiber();
    fiber.start(transport, packet, fiberCallback);
    // then we'll proceed the rest like one-way.
    Packet copy = packet.copy(false);
    copy.endpointAddress = null;
    return copy;
}
Also used : Packet(com.sun.xml.ws.api.message.Packet) WSBinding(com.sun.xml.ws.api.WSBinding) BindingImpl(com.sun.xml.ws.binding.BindingImpl) Tube(com.sun.xml.ws.api.pipe.Tube) WSService(com.sun.xml.ws.api.WSService) Fiber(com.sun.xml.ws.api.pipe.Fiber) ClientTubeAssemblerContext(com.sun.xml.ws.api.pipe.ClientTubeAssemblerContext)

Example 15 with BindingImpl

use of com.sun.xml.ws.binding.BindingImpl in project metro-jax-ws by eclipse-ee4j.

the class SEIPortInfoTest method testCreateBindingWSFList.

public void testCreateBindingWSFList() throws MalformedURLException {
    SEIPortInfo seiPortInfo = createSEIPortInfo();
    BindingImpl b = seiPortInfo.createBinding(new WebServiceFeatureList(), PORT_INTERFACE);
    boolean understands = ((SOAPBindingImpl) b).understandsHeader(EXTRA_HEADER);
    assertTrue("header " + EXTRA_HEADER + " must be understood", understands);
}
Also used : BindingImpl(com.sun.xml.ws.binding.BindingImpl) SOAPBindingImpl(com.sun.xml.ws.binding.SOAPBindingImpl) SOAPBindingImpl(com.sun.xml.ws.binding.SOAPBindingImpl) WebServiceFeatureList(com.sun.xml.ws.binding.WebServiceFeatureList)

Aggregations

BindingImpl (com.sun.xml.ws.binding.BindingImpl)21 WebServiceFeature (jakarta.xml.ws.WebServiceFeature)6 HandlerConfiguration (com.sun.xml.ws.client.HandlerConfiguration)5 Dispatch (jakarta.xml.ws.Dispatch)4 SOAPBindingImpl (com.sun.xml.ws.binding.SOAPBindingImpl)3 MemberSubmissionAddressingFeature (com.sun.xml.ws.developer.MemberSubmissionAddressingFeature)3 AddressingFeature (jakarta.xml.ws.soap.AddressingFeature)3 SOAPFaultException (jakarta.xml.ws.soap.SOAPFaultException)3 BindingID (com.sun.xml.ws.api.BindingID)2 ComponentFeature (com.sun.xml.ws.api.ComponentFeature)2 ComponentsFeature (com.sun.xml.ws.api.ComponentsFeature)2 MessageHandler (com.sun.xml.ws.api.handler.MessageHandler)2 Packet (com.sun.xml.ws.api.message.Packet)2 ClientTubeAssemblerContext (com.sun.xml.ws.api.pipe.ClientTubeAssemblerContext)2 WebServiceFeatureList (com.sun.xml.ws.binding.WebServiceFeatureList)2 RespectBindingFeature (jakarta.xml.ws.RespectBindingFeature)2 WebServiceException (jakarta.xml.ws.WebServiceException)2 SOAPHandler (jakarta.xml.ws.handler.soap.SOAPHandler)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 WSBinding (com.sun.xml.ws.api.WSBinding)1