Search in sources :

Example 6 with WSEndpointReference

use of com.sun.xml.ws.api.addressing.WSEndpointReference in project metro-jax-ws by eclipse-ee4j.

the class ProviderImpl method getPort.

public <T> T getPort(EndpointReference endpointReference, Class<T> clazz, WebServiceFeature... webServiceFeatures) {
    /*
        final @NotNull MemberSubmissionEndpointReference msepr =
                EndpointReferenceUtil.transform(MemberSubmissionEndpointReference.class, endpointReference);
                WSService service = new WSServiceDelegate(msepr.toWSDLSource(), msepr.serviceName.name, Service.class);
                */
    if (endpointReference == null)
        throw new WebServiceException(ProviderApiMessages.NULL_EPR());
    WSEndpointReference wsepr = new WSEndpointReference(endpointReference);
    WSEndpointReference.Metadata metadata = wsepr.getMetaData();
    WSService service;
    if (metadata.getWsdlSource() != null)
        service = (WSService) createServiceDelegate(metadata.getWsdlSource(), metadata.getServiceName(), Service.class);
    else
        throw new WebServiceException("WSDL metadata is missing in EPR");
    return service.getPort(wsepr, clazz, webServiceFeatures);
}
Also used : WebServiceException(jakarta.xml.ws.WebServiceException) WSService(com.sun.xml.ws.api.WSService) WSEndpointReference(com.sun.xml.ws.api.addressing.WSEndpointReference) WSDLService(com.sun.xml.ws.api.model.wsdl.WSDLService) WSService(com.sun.xml.ws.api.WSService) Service(jakarta.xml.ws.Service)

Example 7 with WSEndpointReference

use of com.sun.xml.ws.api.addressing.WSEndpointReference in project metro-jax-ws by eclipse-ee4j.

the class WsaServerTube method processResponse.

@Override
@NotNull
public NextAction processResponse(Packet response) {
    Message msg = response.getMessage();
    if (msg == null) {
        return doReturnWith(response);
    }
    // one way message. Nothing to see here. Move on.
    String to = AddressingUtils.getTo(msg.getHeaders(), addressingVersion, soapVersion);
    if (to != null) {
        replyTo = faultTo = new WSEndpointReference(to, addressingVersion);
    }
    if (replyTo == null) {
        // This is an async response or we're not processing the response in
        // the same tube instance as we processed the request. Get the ReplyTo
        // now, from the properties we stored into the request packet. We
        // assume anyone that interrupted the request->response flow will have
        // saved the ReplyTo and put it back into the packet for our use.
        replyTo = (WSEndpointReference) response.get(WsaPropertyBag.WSA_REPLYTO_FROM_REQUEST);
    }
    if (faultTo == null) {
        // This is an async response or we're not processing the response in
        // the same tube instance as we processed the request. Get the FaultTo
        // now, from the properties we stored into the request packet. We
        // assume anyone that interrupted the request->response flow will have
        // saved the FaultTo and put it back into the packet for our use.
        faultTo = (WSEndpointReference) response.get(WsaPropertyBag.WSA_FAULTTO_FROM_REQUEST);
    }
    WSEndpointReference target = msg.isFault() ? faultTo : replyTo;
    if (target == null && response.proxy instanceof Stub) {
        target = ((Stub) response.proxy).getWSEndpointReference();
    }
    if (target == null || target.isAnonymous() || isAnonymousRequired) {
        return doReturnWith(response);
    }
    if (target.isNone()) {
        // the caller doesn't want to hear about it, so proceed like one-way
        response.setMessage(null);
        return doReturnWith(response);
    }
    if ((wsdlPort != null) && response.getMessage().isOneWay(wsdlPort)) {
        // one way message but with replyTo. I believe this is a hack for WS-TX - KK.
        LOGGER.fine(AddressingMessages.NON_ANONYMOUS_RESPONSE_ONEWAY());
        return doReturnWith(response);
    }
    // action value.
    if (wbo != null || response.soapAction == null) {
        String action = response.getMessage().isFault() ? helper.getFaultAction(wbo, response) : helper.getOutputAction(wbo);
        // set the SOAPAction, as its got to be same as wsa:Action
        if (response.soapAction == null || (action != null && !action.equals(AddressingVersion.UNSET_OUTPUT_ACTION))) {
            response.soapAction = action;
        }
    }
    response.expectReply = false;
    EndpointAddress adrs;
    try {
        adrs = new EndpointAddress(URI.create(target.getAddress()));
    } catch (NullPointerException | IllegalArgumentException e) {
        throw new WebServiceException(e);
    }
    response.endpointAddress = adrs;
    if (response.isAdapterDeliversNonAnonymousResponse) {
        return doReturnWith(response);
    }
    return doReturnWith(NonAnonymousResponseProcessor.getDefault().process(response));
}
Also used : Message(com.sun.xml.ws.api.message.Message) WebServiceException(jakarta.xml.ws.WebServiceException) WSEndpointReference(com.sun.xml.ws.api.addressing.WSEndpointReference) Stub(com.sun.xml.ws.client.Stub) EndpointAddress(com.sun.xml.ws.api.EndpointAddress) NotNull(com.sun.istack.NotNull)

Example 8 with WSEndpointReference

use of com.sun.xml.ws.api.addressing.WSEndpointReference in project metro-jax-ws by eclipse-ee4j.

the class AddressingUtils method getFaultTo.

public static WSEndpointReference getFaultTo(@NotNull MessageHeaders headers, @NotNull AddressingVersion av, @NotNull SOAPVersion sv) {
    if (av == null) {
        throw new IllegalArgumentException(AddressingMessages.NULL_ADDRESSING_VERSION());
    }
    Header h = getFirstHeader(headers, av.faultToTag, true, sv);
    WSEndpointReference faultTo = null;
    if (h != null) {
        try {
            faultTo = h.readAsEPR(av);
        } catch (XMLStreamException e) {
            throw new WebServiceException(AddressingMessages.FAULT_TO_CANNOT_PARSE(), e);
        }
    }
    return faultTo;
}
Also used : StringHeader(com.sun.xml.ws.message.StringHeader) RelatesToHeader(com.sun.xml.ws.message.RelatesToHeader) XMLStreamException(javax.xml.stream.XMLStreamException) WebServiceException(jakarta.xml.ws.WebServiceException) WSEndpointReference(com.sun.xml.ws.api.addressing.WSEndpointReference)

Example 9 with WSEndpointReference

use of com.sun.xml.ws.api.addressing.WSEndpointReference in project metro-jax-ws by eclipse-ee4j.

the class AddressingUtils method getReplyTo.

public static WSEndpointReference getReplyTo(@NotNull MessageHeaders headers, @NotNull AddressingVersion av, @NotNull SOAPVersion sv) {
    if (av == null) {
        throw new IllegalArgumentException(AddressingMessages.NULL_ADDRESSING_VERSION());
    }
    Header h = getFirstHeader(headers, av.replyToTag, true, sv);
    WSEndpointReference replyTo;
    if (h != null) {
        try {
            replyTo = h.readAsEPR(av);
        } catch (XMLStreamException e) {
            throw new WebServiceException(AddressingMessages.REPLY_TO_CANNOT_PARSE(), e);
        }
    } else {
        replyTo = av.anonymousEpr;
    }
    return replyTo;
}
Also used : StringHeader(com.sun.xml.ws.message.StringHeader) RelatesToHeader(com.sun.xml.ws.message.RelatesToHeader) XMLStreamException(javax.xml.stream.XMLStreamException) WebServiceException(jakarta.xml.ws.WebServiceException) WSEndpointReference(com.sun.xml.ws.api.addressing.WSEndpointReference)

Example 10 with WSEndpointReference

use of com.sun.xml.ws.api.addressing.WSEndpointReference in project metro-jax-ws by eclipse-ee4j.

the class AddressingUtils method fillRequestAddressingHeaders.

public static void fillRequestAddressingHeaders(MessageHeaders headers, Packet packet, AddressingVersion av, SOAPVersion sv, boolean oneway, String action, boolean mustUnderstand) {
    fillCommonAddressingHeaders(headers, packet, av, sv, action, mustUnderstand);
    // null or "true" is equivalent to request/response MEP
    if (!oneway) {
        WSEndpointReference epr = av.anonymousEpr;
        if (headers.get(av.replyToTag, false) == null) {
            headers.add(epr.createHeader(av.replyToTag));
        }
        // wsa:FaultTo
        if (headers.get(av.faultToTag, false) == null) {
            headers.add(epr.createHeader(av.faultToTag));
        }
        // wsa:MessageID
        if (packet.getMessage().getHeaders().get(av.messageIDTag, false) == null) {
            if (headers.get(av.messageIDTag, false) == null) {
                Header h = new StringHeader(av.messageIDTag, Message.generateMessageID());
                headers.add(h);
            }
        }
    }
}
Also used : StringHeader(com.sun.xml.ws.message.StringHeader) StringHeader(com.sun.xml.ws.message.StringHeader) RelatesToHeader(com.sun.xml.ws.message.RelatesToHeader) WSEndpointReference(com.sun.xml.ws.api.addressing.WSEndpointReference)

Aggregations

WSEndpointReference (com.sun.xml.ws.api.addressing.WSEndpointReference)80 QName (javax.xml.namespace.QName)32 Element (org.w3c.dom.Element)17 URL (java.net.URL)16 StreamSource (javax.xml.transform.stream.StreamSource)16 EndpointReference (jakarta.xml.ws.EndpointReference)13 WSBindingProvider (com.sun.xml.ws.developer.WSBindingProvider)11 SAAJMessage (com.sun.xml.ws.message.saaj.SAAJMessage)11 SOAPMessage (jakarta.xml.soap.SOAPMessage)11 Packet (com.sun.xml.ws.api.message.Packet)10 XMLStreamReader (javax.xml.stream.XMLStreamReader)10 Message (com.sun.xml.ws.api.message.Message)9 WebServiceException (jakarta.xml.ws.WebServiceException)9 MemberSubmissionEndpointReference (com.sun.xml.ws.developer.MemberSubmissionEndpointReference)8 ByteArrayInputStream (java.io.ByteArrayInputStream)8 WSDLPort (com.sun.xml.ws.api.model.wsdl.WSDLPort)6 MessageFactory (jakarta.xml.soap.MessageFactory)6 MimeHeaders (jakarta.xml.soap.MimeHeaders)6 Service (jakarta.xml.ws.Service)6 W3CEndpointReference (jakarta.xml.ws.wsaddressing.W3CEndpointReference)6