Package com.sun.xml.ws.api.addressing

Examples of com.sun.xml.ws.api.addressing.WSEndpointReference


    public @NotNull NextAction processResponse(Packet response) {
        Message msg = response.getMessage();
        if (msg ==null)
            return doReturnWith(response)// one way message. Nothing to see here. Move on.

        WSEndpointReference target = msg.isFault()?faultTo:replyTo;

        if(target.isAnonymous() || isAnonymousRequired )
            // the response will go back the back channel. most common case
            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);
        }
View Full Code Here


            return;

        HeaderList hl = responsePacket.getMessage().getHeaders();

        // wsa:To
        WSEndpointReference replyTo;
        try {
        replyTo = message.getHeaders().getReplyTo(av, sv);
        if (replyTo != null)
            hl.add(new StringHeader(av.toTag, replyTo.getAddress()));
        } catch (InvalidAddressingHeaderException e) {
            replyTo = null;
        }

        // wsa:Action, add if the message doesn't already contain it,
        // generally true for SEI case where there is SEIModel or WSDLModel
        //           false for Provider with no wsdl, Expects User to set the coresponding header on the Message.
        if(responsePacket.getMessage().getHeaders().getAction(av,sv) == null) {
            //wsa:Action header is not set in the message, so use the wsa:Action  passed as the parameter.
            hl.add(new StringHeader(av.actionTag, action));
        }

        // wsa:MessageID
        hl.add(new StringHeader(av.messageIDTag, responsePacket.getMessage().getID(av, sv)));

        // wsa:RelatesTo
        String mid = getMessage().getHeaders().getMessageID(av,sv);
        if (mid != null)
            hl.add(new RelatesToHeader(av.relatesToTag, mid));

        // populate reference parameters
        WSEndpointReference refpEPR;
        if (responsePacket.getMessage().isFault()) {
            // choose FaultTo
            refpEPR = message.getHeaders().getFaultTo(av, sv);

            // if FaultTo is null, then use ReplyTo
            if (refpEPR == null)
                refpEPR = replyTo;
        } else {
            // choose ReplyTo
            refpEPR = replyTo;
        }
        if (refpEPR != null) {
            refpEPR.addReferenceParameters(hl);
        }
    }
View Full Code Here

        fillCommonAddressingHeaders(packet, av, sv, action);

        // wsa:ReplyTo
        // null or "true" is equivalent to request/response MEP
        if (!oneway) {
            WSEndpointReference epr = av.anonymousEpr;
            add(epr.createHeader(av.replyToTag));

            // wsa:MessageID
            Header h = new StringHeader(av.messageIDTag, packet.getMessage().getID(av, sv));
            add(h);
        }
View Full Code Here

        Map<QName, WSEndpointReference.EPRExtension> eprExtensions = new HashMap<QName, WSEndpointReference.EPRExtension>();
        try {
            if (port != null) {
                //gather EPR extrensions from WSDL Model
                WSEndpointReference wsdlEpr = ((WSDLPortImpl) port).getEPR();
                if (wsdlEpr != null) {
                    for (WSEndpointReference.EPRExtension extnEl : wsdlEpr.getEPRExtensions()) {
                        eprExtensions.put(extnEl.getQName(), extnEl);
                    }
                }
            }
View Full Code Here

        if (port != null) {
            portType = port.getBinding().getPortTypeName();
        }

        AddressingVersion av = AddressingVersion.fromSpecClass(clazz);
        return new WSEndpointReference(
                    av, address, serviceName, portName, portType, metadata, wsdlAddress, referenceParameters,endpointReferenceExtensions.values(), null).toSpec(clazz);

    }
View Full Code Here

                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 = new WSServiceDelegate(metadata.getWsdlSource(), metadata.getServiceName(), Service.class);
        else
            throw new WebServiceException("WSDL metadata is missing in EPR");
View Full Code Here

                }
            } catch (Exception e) {
                throw new IllegalStateException(ProviderApiMessages.ERROR_WSDL(wsdlDocumentLocation),e);
            }
        }
        return new WSEndpointReference(
            AddressingVersion.fromSpecClass(W3CEndpointReference.class),
            address, serviceName, portName, interfaceName, metadata, wsdlDocumentLocation, wsdlTargetNamespace,referenceParameters, elements, attributes).toSpec(W3CEndpointReference.class);

    }
View Full Code Here

    /**
     * Default implementation that copies the infoset. Not terribly efficient.
     */
    public WSEndpointReference readAsEPR(AddressingVersion expected) throws XMLStreamException {
        XMLStreamReader xsr = readHeader();
        WSEndpointReference epr = new WSEndpointReference(xsr, expected);
        XMLStreamReaderFactory.recycle(xsr);
        return epr;
    }
View Full Code Here

     * This is the most common implementation on which {@link Header#readAsEPR(AddressingVersion)}
     * is invoked on.
     */
    @Override @NotNull
    public WSEndpointReference readAsEPR(AddressingVersion expected) throws XMLStreamException {
        return new WSEndpointReference(_mark,expected);
    }
View Full Code Here

        MessageHeaders hl = responsePacket.getMessage().getHeaders();

        WsaPropertyBag wpb = getSatellite(WsaPropertyBag.class);
        Message msg = getMessage();
        // wsa:To
        WSEndpointReference replyTo = null;
        Header replyToFromRequestMsg = AddressingUtils.getFirstHeader(msg.getHeaders(), av.replyToTag, true, sv);
        Header replyToFromResponseMsg = hl.get(av.toTag, false);
        boolean replaceToTag = true;
        try{
            if (replyToFromRequestMsg != null){
                replyTo = replyToFromRequestMsg.readAsEPR(av);
            }
            if (replyToFromResponseMsg != null && replyTo == null) {
                replaceToTag = false;
            }
        } catch (XMLStreamException e) {
            throw new WebServiceException(AddressingMessages.REPLY_TO_CANNOT_PARSE(), e);
        }
        if (replyTo == null) {
            replyTo = AddressingUtils.getReplyTo(msg.getHeaders(), av, sv);
        }

        // wsa:Action, add if the message doesn't already contain it,
        // generally true for SEI case where there is SEIModel or WSDLModel
        //           false for Provider with no wsdl, Expects User to set the coresponding header on the Message.
        if (AddressingUtils.getAction(responsePacket.getMessage().getHeaders(), av, sv) == null) {
            //wsa:Action header is not set in the message, so use the wsa:Action  passed as the parameter.
            hl.add(new StringHeader(av.actionTag, action, sv, mustUnderstand));
        }

        // wsa:MessageID
        if (responsePacket.getMessage().getHeaders().get(av.messageIDTag, false) == null) {
            // if header doesn't exist, method getID creates a new random id
            String newID = Message.generateMessageID();
            hl.add(new StringHeader(av.messageIDTag, newID));
        }

        // wsa:RelatesTo
        String mid = null;
        if (wpb != null) {
            mid = wpb.getMessageID();
        }
        if (mid == null) {
            mid = AddressingUtils.getMessageID(msg.getHeaders(), av, sv);
        }
        if (mid != null) {
            hl.addOrReplace(new RelatesToHeader(av.relatesToTag, mid));
        }
   

        // populate reference parameters
        WSEndpointReference refpEPR = null;
        if (responsePacket.getMessage().isFault()) {
            // choose FaultTo
            if (wpb != null) {
                refpEPR = wpb.getFaultToFromRequest();
            }
            if (refpEPR == null) {
                refpEPR = AddressingUtils.getFaultTo(msg.getHeaders(), av, sv);
            }
            // if FaultTo is null, then use ReplyTo
            if (refpEPR == null) {
                refpEPR = replyTo;
            }
        } else {
            // choose ReplyTo
            refpEPR = replyTo;
        }
        if (replaceToTag && refpEPR != null) {
            hl.addOrReplace(new StringHeader(av.toTag, refpEPR.getAddress()));
            refpEPR.addReferenceParametersToList(hl);
        }
    }
View Full Code Here

TOP

Related Classes of com.sun.xml.ws.api.addressing.WSEndpointReference

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.