com.sun.xml.internal.ws.api.addressing.WSEndpointReference Java Examples

The following examples show how to use com.sun.xml.internal.ws.api.addressing.WSEndpointReference. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WSServiceDelegate.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private <T> T createEndpointIFBaseProxy(@Nullable WSEndpointReference epr, QName portName, Class<T> portInterface,
                                        WebServiceFeatureList webServiceFeatures, SEIPortInfo eif) {
    //fail if service doesnt have WSDL
    if (wsdlService == null) {
        throw new WebServiceException(ClientMessages.INVALID_SERVICE_NO_WSDL(serviceName));
    }

    if (wsdlService.get(portName)==null) {
        throw new WebServiceException(
            ClientMessages.INVALID_PORT_NAME(portName,buildWsdlPortNames()));
    }

    BindingImpl binding = eif.createBinding(webServiceFeatures, portInterface);
    InvocationHandler pis = getStubHandler(binding, eif, epr);

    T proxy = createProxy(portInterface, pis);

    if (serviceInterceptor != null) {
        serviceInterceptor.postCreateProxy((WSBindingProvider)proxy, portInterface);
    }
    return proxy;
}
 
Example #2
Source File: AddressingUtils.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #3
Source File: AddressingUtils.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #4
Source File: ProviderImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example #5
Source File: AddressingUtils.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
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);

    // wsa:ReplyTo
    // 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);
            }
        }
    }
}
 
Example #6
Source File: WSServiceDelegate.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private <T> T createEndpointIFBaseProxy(@Nullable WSEndpointReference epr, QName portName, Class<T> portInterface,
                                        WebServiceFeatureList webServiceFeatures, SEIPortInfo eif) {
    //fail if service doesnt have WSDL
    if (wsdlService == null) {
        throw new WebServiceException(ClientMessages.INVALID_SERVICE_NO_WSDL(serviceName));
    }

    if (wsdlService.get(portName)==null) {
        throw new WebServiceException(
            ClientMessages.INVALID_PORT_NAME(portName,buildWsdlPortNames()));
    }

    BindingImpl binding = eif.createBinding(webServiceFeatures, portInterface);
    InvocationHandler pis = getStubHandler(binding, eif, epr);

    T proxy = createProxy(portInterface, pis);

    if (serviceInterceptor != null) {
        serviceInterceptor.postCreateProxy((WSBindingProvider)proxy, portInterface);
    }
    return proxy;
}
 
Example #7
Source File: WsaServerTube.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("ResultOfObjectAllocationIgnored")
private void checkNonAnonymousAddresses(WSEndpointReference replyTo, WSEndpointReference faultTo) {
    if (!replyTo.isAnonymous()) {
        try {
            new EndpointAddress(URI.create(replyTo.getAddress()));
        } catch (Exception e) {
            throw new InvalidAddressingHeaderException(addressingVersion.replyToTag, addressingVersion.invalidAddressTag);
        }
    }
    //for now only validate ReplyTo
    /*
    if (!faultTo.isAnonymous()) {
        try {
            new EndpointAddress(URI.create(faultTo.getAddress()));
        } catch (IllegalArgumentException e) {
            throw new InvalidAddressingHeaderException(addressingVersion.faultToTag, addressingVersion.invalidAddressTag);
        }
    }
    */

}
 
Example #8
Source File: WsaServerTube.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("ResultOfObjectAllocationIgnored")
private void checkNonAnonymousAddresses(WSEndpointReference replyTo, WSEndpointReference faultTo) {
    if (!replyTo.isAnonymous()) {
        try {
            new EndpointAddress(URI.create(replyTo.getAddress()));
        } catch (Exception e) {
            throw new InvalidAddressingHeaderException(addressingVersion.replyToTag, addressingVersion.invalidAddressTag);
        }
    }
    //for now only validate ReplyTo
    /*
    if (!faultTo.isAnonymous()) {
        try {
            new EndpointAddress(URI.create(faultTo.getAddress()));
        } catch (IllegalArgumentException e) {
            throw new InvalidAddressingHeaderException(addressingVersion.faultToTag, addressingVersion.invalidAddressTag);
        }
    }
    */

}
 
Example #9
Source File: WSServiceDelegate.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public <T> Dispatch<T> createDispatch(QName portName, WSEndpointReference wsepr, Class<T> aClass, Service.Mode mode, WebServiceFeatureList features) {
    PortInfo port = safeGetPort(portName);

    ComponentFeature cf = features.get(ComponentFeature.class);
    if (cf != null && !Target.STUB.equals(cf.getTarget())) {
        throw new IllegalArgumentException();
    }
    ComponentsFeature csf = features.get(ComponentsFeature.class);
    if (csf != null) {
        for (ComponentFeature cfi : csf.getComponentFeatures()) {
            if (!Target.STUB.equals(cfi.getTarget()))
                throw new IllegalArgumentException();
        }
    }
    features.addAll(this.features);

    BindingImpl binding = port.createBinding(features, null, null);
    binding.setMode(mode);
    Dispatch<T> dispatch = Stubs.createDispatch(port, this, binding, aClass, mode, wsepr);
    serviceInterceptor.postCreateDispatch((WSBindingProvider) dispatch);
    return dispatch;
}
 
Example #10
Source File: WsaServerTube.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("ResultOfObjectAllocationIgnored")
private void checkNonAnonymousAddresses(WSEndpointReference replyTo, WSEndpointReference faultTo) {
    if (!replyTo.isAnonymous()) {
        try {
            new EndpointAddress(URI.create(replyTo.getAddress()));
        } catch (Exception e) {
            throw new InvalidAddressingHeaderException(addressingVersion.replyToTag, addressingVersion.invalidAddressTag);
        }
    }
    //for now only validate ReplyTo
    /*
    if (!faultTo.isAnonymous()) {
        try {
            new EndpointAddress(URI.create(faultTo.getAddress()));
        } catch (IllegalArgumentException e) {
            throw new InvalidAddressingHeaderException(addressingVersion.faultToTag, addressingVersion.invalidAddressTag);
        }
    }
    */

}
 
Example #11
Source File: AddressingUtils.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example #12
Source File: WSServiceDelegate.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
protected Dispatch<Object> createDispatch(QName portName, WSEndpointReference wsepr, JAXBContext jaxbContext, Service.Mode mode, WebServiceFeatureList features) {
    PortInfo port = safeGetPort(portName);

    ComponentFeature cf = features.get(ComponentFeature.class);
    if (cf != null && !Target.STUB.equals(cf.getTarget())) {
        throw new IllegalArgumentException();
    }
    ComponentsFeature csf = features.get(ComponentsFeature.class);
    if (csf != null) {
        for (ComponentFeature cfi : csf.getComponentFeatures()) {
            if (!Target.STUB.equals(cfi.getTarget()))
                throw new IllegalArgumentException();
        }
    }
    features.addAll(this.features);

    BindingImpl binding = port.createBinding(features, null, null);
    binding.setMode(mode);
    Dispatch<Object> dispatch = Stubs.createJAXBDispatch(
            port, binding, jaxbContext, mode,wsepr);
     serviceInterceptor.postCreateDispatch((WSBindingProvider)dispatch);
     return dispatch;
}
 
Example #13
Source File: Stub.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public final WSEndpointReference getWSEndpointReference() {
    if (binding.getBindingID().equals(HTTPBinding.HTTP_BINDING)) {
        throw new java.lang.UnsupportedOperationException(
                    ClientMessages.UNSUPPORTED_OPERATION("BindingProvider.getEndpointReference(Class<T> class)", "XML/HTTP Binding", "SOAP11 or SOAP12 Binding")
                );
    }

    if (endpointReference != null) {
        return endpointReference;
    }

    String eprAddress = requestContext.getEndpointAddress().toString();
    QName portTypeName = null;
    String wsdlAddress = null;
    List<WSEndpointReference.EPRExtension> wsdlEPRExtensions = new ArrayList<WSEndpointReference.EPRExtension>();
    if (wsdlPort != null) {
        portTypeName = wsdlPort.getBinding().getPortTypeName();
        wsdlAddress = eprAddress + "?wsdl";

        //gather EPRExtensions specified in WSDL.
        try {
            WSEndpointReference wsdlEpr = wsdlPort.getEPR();
            if (wsdlEpr != null) {
                for (WSEndpointReference.EPRExtension extnEl : wsdlEpr.getEPRExtensions()) {
                    wsdlEPRExtensions.add(new WSEPRExtension(
                            XMLStreamBuffer.createNewBufferFromXMLStreamReader(extnEl.readAsXMLStreamReader()), extnEl.getQName()));
                }
            }

        } catch (XMLStreamException ex) {
            throw new WebServiceException(ex);
        }
    }
    AddressingVersion av = AddressingVersion.W3C;
    this.endpointReference = new WSEndpointReference(
            av, eprAddress, getServiceName(), getPortName(), portTypeName, null, wsdlAddress, null, wsdlEPRExtensions, null);

    return this.endpointReference;
}
 
Example #14
Source File: WsaPropertyBag.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private WSEndpointReference getEPR(QName tag) throws XMLStreamException {
    if (packet.getMessage() == null) {
      return null;
    }
    Header h = packet.getMessage().getHeaders().get(tag, false);
    if(h==null) return null;
    return h.readAsEPR(addressingVersion);
}
 
Example #15
Source File: SEIStub.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Deprecated
public SEIStub(WSServiceDelegate owner, BindingImpl binding, SOAPSEIModel seiModel, Tube master, WSEndpointReference epr) {
    super(owner, master, binding, seiModel.getPort(), seiModel.getPort().getAddress(), epr);
    this.seiModel = seiModel;
    this.soapVersion = binding.getSOAPVersion();
    databinding = seiModel.getDatabinding();
    initMethodHandlers();
}
 
Example #16
Source File: WSServiceDelegate.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private QName addPortEpr(WSEndpointReference wsepr) {
    if (wsepr == null)
        throw new WebServiceException(ProviderApiMessages.NULL_EPR());
    QName eprPortName = getPortNameFromEPR(wsepr, null);
    //add Port, if it does n't exist;
    // TODO: what if it has different epr address?
    {
        PortInfo portInfo = new PortInfo(this, (wsepr.getAddress() == null) ? null : EndpointAddress.create(wsepr.getAddress()), eprPortName,
                getPortModel(wsdlService, eprPortName).getBinding().getBindingId());
        if (!ports.containsKey(eprPortName)) {
            ports.put(eprPortName, portInfo);
        }
    }
    return eprPortName;
}
 
Example #17
Source File: WsaPropertyBag.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private WSEndpointReference getEPR(QName tag) throws XMLStreamException {
    if (packet.getMessage() == null) {
      return null;
    }
    Header h = packet.getMessage().getHeaders().get(tag, false);
    if(h==null) return null;
    return h.readAsEPR(addressingVersion);
}
 
Example #18
Source File: DispatchImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@Deprecated
public static Dispatch<Source> createSourceDispatch(QName port, Mode mode, WSServiceDelegate owner, Tube pipe, BindingImpl binding, WSEndpointReference epr) {
    if(isXMLHttp(binding))
        return new RESTSourceDispatch(port,mode,owner,pipe,binding,epr);
    else
        return new SOAPSourceDispatch(port,mode,owner,pipe,binding,epr);
}
 
Example #19
Source File: SEIStub.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Deprecated
public SEIStub(WSServiceDelegate owner, BindingImpl binding, SOAPSEIModel seiModel, Tube master, WSEndpointReference epr) {
    super(owner, master, binding, seiModel.getPort(), seiModel.getPort().getAddress(), epr);
    this.seiModel = seiModel;
    this.soapVersion = binding.getSOAPVersion();
    databinding = seiModel.getDatabinding();
    initMethodHandlers();
}
 
Example #20
Source File: SEIStub.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public SEIStub(WSPortInfo portInfo, BindingImpl binding, SOAPSEIModel seiModel, WSEndpointReference epr) {
    super(portInfo, binding, seiModel.getPort().getAddress(),epr);
    this.seiModel = seiModel;
    this.soapVersion = binding.getSOAPVersion();
    databinding = seiModel.getDatabinding();
    initMethodHandlers();
}
 
Example #21
Source File: SOAPSourceDispatch.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public SOAPSourceDispatch(WSPortInfo portInfo, Mode mode, BindingImpl binding, WSEndpointReference epr) {
        super(portInfo, mode, binding, epr);
        assert !isXMLHttp(binding);
}
 
Example #22
Source File: RESTSourceDispatch.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public RESTSourceDispatch(WSPortInfo portInfo, Mode mode, BindingImpl binding, WSEndpointReference epr) {
    super(portInfo, mode, binding, epr);
    assert isXMLHttp(binding);
}
 
Example #23
Source File: PacketDispatch.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public PacketDispatch(WSPortInfo portInfo, Tube pipe, BindingImpl binding, WSEndpointReference epr) {
    this(portInfo, pipe, binding, epr, true);
}
 
Example #24
Source File: WSServiceDelegate.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@Override
public <T> Dispatch<T> createDispatch(QName portName, WSEndpointReference wsepr, Class<T> aClass, Service.Mode mode, WebServiceFeature... features) {
    return createDispatch(portName, wsepr, aClass, mode, new WebServiceFeatureList(features));
}
 
Example #25
Source File: DataSourceDispatch.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@Deprecated
public DataSourceDispatch(QName port, Service.Mode mode, WSServiceDelegate service, Tube pipe, BindingImpl binding, WSEndpointReference epr) {
   super(port, mode, service, pipe, binding, epr );
}
 
Example #26
Source File: WSEndpointImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public Collection<WSEndpointReference.EPRExtension> getEndpointReferenceExtensions() {
    return endpointReferenceExtensions.values();
}
 
Example #27
Source File: RESTSourceDispatch.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Deprecated
public RESTSourceDispatch(QName port, Mode mode, WSServiceDelegate owner, Tube pipe, BindingImpl binding, WSEndpointReference epr) {
    super(port, mode, owner, pipe, binding, epr);
    assert isXMLHttp(binding);
}
 
Example #28
Source File: WsaPropertyBag.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Property(WSA_FAULTTO_FROM_REQUEST)
public WSEndpointReference getFaultToFromRequest() {
  return _faultToFromRequest;
}
 
Example #29
Source File: WSServiceDelegate.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Dispatch<Object> createDispatch(QName portName, WSEndpointReference wsepr, JAXBContext jaxbContext, Service.Mode mode, WebServiceFeature... features) {
    return createDispatch(portName, wsepr, jaxbContext, mode, new WebServiceFeatureList(features));
}
 
Example #30
Source File: SOAPMessageDispatch.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public SOAPMessageDispatch(WSPortInfo portInfo, Service.Mode mode, BindingImpl binding, WSEndpointReference epr) {
    super(portInfo, mode, binding, epr);
}