Java Code Examples for javax.xml.ws.WebServiceFeature

The following are top voted examples for showing how to use javax.xml.ws.WebServiceFeature. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: lams   File: AbstractJaxWsServiceExporter.java   View source code 6 votes vote down vote up
private WebServiceFeature convertWebServiceFeature(Object feature) {
	Assert.notNull(feature, "WebServiceFeature specification object must not be null");
	if (feature instanceof WebServiceFeature) {
		return (WebServiceFeature) feature;
	}
	else if (feature instanceof Class) {
		return (WebServiceFeature) BeanUtils.instantiate((Class<?>) feature);
	}
	else if (feature instanceof String) {
		try {
			Class<?> featureClass = getBeanClassLoader().loadClass((String) feature);
			return (WebServiceFeature) BeanUtils.instantiate(featureClass);
		}
		catch (ClassNotFoundException ex) {
			throw new IllegalArgumentException("Could not load WebServiceFeature class [" + feature + "]");
		}
	}
	else {
		throw new IllegalArgumentException("Unknown WebServiceFeature specification type: " + feature.getClass());
	}
}
 
Example 2
Project: openjdk-jdk10   File: MtomFeatureConfigurator.java   View source code 6 votes vote down vote up
/**
 * process Mtom policy assertions and if found and is not optional then mtom is enabled on the
 * {@link WSDLBoundPortType}
 *
 * @param key Key that identifies the endpoint scope
 * @param policyMap Must be non-null
 * @throws PolicyException If retrieving the policy triggered an exception
 */
public Collection<WebServiceFeature> getFeatures(PolicyMapKey key, PolicyMap policyMap) throws PolicyException {
    final Collection<WebServiceFeature> features = new LinkedList<WebServiceFeature>();
    if ((key != null) && (policyMap != null)) {
        Policy policy = policyMap.getEndpointEffectivePolicy(key);
        if (null!=policy && policy.contains(OPTIMIZED_MIME_SERIALIZATION_ASSERTION)) {
            Iterator <AssertionSet> assertions = policy.iterator();
            while(assertions.hasNext()){
                AssertionSet assertionSet = assertions.next();
                Iterator<PolicyAssertion> policyAssertion = assertionSet.iterator();
                while(policyAssertion.hasNext()){
                    PolicyAssertion assertion = policyAssertion.next();
                    if(OPTIMIZED_MIME_SERIALIZATION_ASSERTION.equals(assertion.getName())){
                        features.add(new MTOMFeature(true));
                    } // end-if non optional mtom assertion found
                } // next assertion
            } // next alternative
        } // end-if policy contains mtom assertion
    }
    return features;
}
 
Example 3
Project: openjdk-jdk10   File: WebServiceFeatureList.java   View source code 6 votes vote down vote up
/**
 *
 * @param endpointClass web service impl class
 */
public void parseAnnotations(Class<?> endpointClass) {
    for (Annotation a : endpointClass.getAnnotations()) {
        WebServiceFeature ftr = getFeature(a);
        if (ftr != null) {
            if (ftr instanceof MTOMFeature) {
                // check conflict with @BindingType
                BindingID bindingID = BindingID.parse(endpointClass);
                MTOMFeature bindingMtomSetting = bindingID.createBuiltinFeatureList().get(MTOMFeature.class);
                if (bindingMtomSetting != null && bindingMtomSetting.isEnabled() ^ ftr.isEnabled()) {
                    throw new RuntimeModelerException(
                        ModelerMessages.RUNTIME_MODELER_MTOM_CONFLICT(bindingID, ftr.isEnabled()));
                }
            }
            add(ftr);
        }
    }
}
 
Example 4
Project: lams   File: JaxWsPortClientInterceptor.java   View source code 6 votes vote down vote up
/**
 * Obtain the port stub from the given JAX-WS Service.
 * @param service the Service object to obtain the port from
 * @param portQName the name of the desired port, if specified
 * @return the corresponding port object as returned from
 * {@code Service.getPort(...)}
 */
protected Object getPortStub(Service service, QName portQName) {
	if (this.portFeatures != null || this.webServiceFeatures != null) {
		WebServiceFeature[] portFeaturesToUse = this.portFeatures;
		if (portFeaturesToUse == null) {
			portFeaturesToUse = new WebServiceFeature[this.webServiceFeatures.length];
			for (int i = 0; i < this.webServiceFeatures.length; i++) {
				portFeaturesToUse[i] = convertWebServiceFeature(this.webServiceFeatures[i]);
			}
		}
		return (portQName != null ? service.getPort(portQName, getServiceInterface(), portFeaturesToUse) :
				service.getPort(getServiceInterface(), portFeaturesToUse));
	}
	else {
		return (portQName != null ? service.getPort(portQName, getServiceInterface()) :
				service.getPort(getServiceInterface()));
	}
}
 
Example 5
Project: OpenJSharp   File: WSEndpointReference.java   View source code 5 votes vote down vote up
/**
 * Creates a {@link Dispatch} that can be used to talk to this EPR.
 *
 * <p>
 * All the normal WS-Addressing processing happens automatically,
 * such as setting the endpoint address to {@link #getAddress() the address},
 * and sending the reference parameters associated with this EPR as
 * headers, etc.
 */
public @NotNull Dispatch<Object> createDispatch(
    @NotNull Service jaxwsService,
    @NotNull JAXBContext context,
    @NotNull Service.Mode mode,
    WebServiceFeature... features) {

    // TODO: implement it in a better way
    return jaxwsService.createDispatch(toSpec(),context,mode,features);
}
 
Example 6
Project: openjdk-jdk10   File: WebServiceFeatureList.java   View source code 5 votes vote down vote up
public @Nullable
    <F extends WebServiceFeature> F get(@NotNull Class<F> featureType) {
    WebServiceFeature f = featureType.cast(wsfeatures.get(featureType));
    if (f == null && parent != null) {
        return parent.getFeatures().get(featureType);
    }
    return (F) f;
}
 
Example 7
Project: OpenJSharp   File: WebServiceFeatureList.java   View source code 5 votes vote down vote up
static public WebServiceFeature[] toFeatureArray(WSBinding binding) {
    //TODO scchen convert BindingID  to WebServiceFeature[]
    if(!binding.isFeatureEnabled(EnvelopeStyleFeature.class)) {
        WebServiceFeature[] f = { binding.getSOAPVersion().toFeature() };
        binding.getFeatures().mergeFeatures(f, false);
    }
    return binding.getFeatures().toArray();
}
 
Example 8
Project: openjdk-jdk10   File: WSEndpointReference.java   View source code 5 votes vote down vote up
/**
 * Creates a {@link Dispatch} that can be used to talk to this EPR.
 *
 * <p>
 * All the normal WS-Addressing processing happens automatically,
 * such as setting the endpoint address to {@link #getAddress() the address},
 * and sending the reference parameters associated with this EPR as
 * headers, etc.
 */
public @NotNull <T> Dispatch<T> createDispatch(
    @NotNull Service jaxwsService,
    @NotNull Class<T> type,
    @NotNull Service.Mode mode,
    WebServiceFeature... features) {

    // TODO: implement it in a better way
    return jaxwsService.createDispatch(toSpec(),type,mode,features);
}
 
Example 9
Project: OpenJSharp   File: PortInfo.java   View source code 5 votes vote down vote up
public BindingImpl createBinding(WebServiceFeatureList webServiceFeatures, Class<?> portInterface,
            BindingImpl existingBinding) {
            if (existingBinding != null) {
                    webServiceFeatures.addAll(existingBinding.getFeatures());
            }

    Iterable<WebServiceFeature> configFeatures;
    //TODO incase of Dispatch, provide a way to User for complete control of the message processing by giving
    // ability to turn off the WSDL/Policy based features and its associated tubes.

    //Even in case of Dispatch, merge all features configured via WSDL/Policy or deployment configuration
    if (portModel != null) {
        // could have merged features from this.policyMap, but some features are set in WSDLModel which are not there in PolicyMap
        // for ex: <wsaw:UsingAddressing> wsdl extn., and since the policyMap features are merged into WSDLModel anyway during postFinished(),
        // So, using here WsdlModel for merging is right.

        // merge features from WSDL
        configFeatures = portModel.getFeatures();
    } else {
        configFeatures = PolicyUtil.getPortScopedFeatures(policyMap, owner.getServiceName(),portName);
    }
    webServiceFeatures.mergeFeatures(configFeatures, false);

    // merge features from interceptor
    webServiceFeatures.mergeFeatures(owner.serviceInterceptor.preCreateBinding(this, portInterface, webServiceFeatures), false);

    BindingImpl bindingImpl = BindingImpl.create(bindingId, webServiceFeatures.toArray());
    owner.getHandlerConfigurator().configureHandlers(this,bindingImpl);
    return bindingImpl;
}
 
Example 10
Project: openjdk-jdk10   File: ProviderImpl.java   View source code 5 votes vote down vote up
public ServiceDelegate createServiceDelegate( URL wsdlDocumentLocation, QName serviceName, Class serviceClass,
                                              WebServiceFeature ... features) {
    for (WebServiceFeature feature : features) {
        if (!(feature instanceof ServiceSharedFeatureMarker))
        throw new WebServiceException("Doesn't support any Service specific features");
    }
    return new WSServiceDelegate(wsdlDocumentLocation, serviceName, serviceClass, features);
}
 
Example 11
Project: openjdk-jdk10   File: WebServiceFeatureList.java   View source code 5 votes vote down vote up
public static @Nullable <F extends WebServiceFeature> F getFeature(@NotNull WebServiceFeature[] features,
                                                                   @NotNull Class<F> featureType) {
    for (WebServiceFeature f : features) {
        if (f.getClass() == featureType)
            return (F) f;
    }
    return null;
}
 
Example 12
Project: OpenJSharp   File: BindingImpl.java   View source code 5 votes vote down vote up
public void setInputMessageFeatures(@NotNull final QName operationName, WebServiceFeature... newFeatures) {
    if (newFeatures != null) {
        WebServiceFeatureList featureList = inputMessageFeatures.get(operationName);
        if (featureList == null) {
            featureList = new WebServiceFeatureList();
        }
        for (WebServiceFeature f : newFeatures) {
            featureList.add(f);
        }
        inputMessageFeatures.put(operationName, featureList);
    }
}
 
Example 13
Project: OpenJSharp   File: MessageContextFactory.java   View source code 5 votes vote down vote up
static public MessageContextFactory createFactory(ClassLoader cl, WebServiceFeature ...f) {
    for (MessageContextFactory factory : ServiceFinder.find(MessageContextFactory.class, cl)) {
        MessageContextFactory newfac = factory.newFactory(f);
        if (newfac != null) return newfac;
    }
    return new com.sun.xml.internal.ws.api.message.MessageContextFactory(f);
}
 
Example 14
Project: OpenJSharp   File: WebServiceFeatureList.java   View source code 5 votes vote down vote up
public void validate() {
    if (!isValidating) {
        isValidating = true;

        // validation
        for (WebServiceFeature ff : this) {
            validate(ff);
        }
    }
}
 
Example 15
Project: openjdk-jdk10   File: WebServiceFeatureList.java   View source code 5 votes vote down vote up
public void validate() {
    if (!isValidating) {
        isValidating = true;

        // validation
        for (WebServiceFeature ff : this) {
            validate(ff);
        }
    }
}
 
Example 16
Project: openjdk-jdk10   File: PortInfo.java   View source code 5 votes vote down vote up
public BindingImpl createBinding(WebServiceFeatureList webServiceFeatures, Class<?> portInterface,
            BindingImpl existingBinding) {
            if (existingBinding != null) {
                    webServiceFeatures.addAll(existingBinding.getFeatures());
            }

    Iterable<WebServiceFeature> configFeatures;
    //TODO incase of Dispatch, provide a way to User for complete control of the message processing by giving
    // ability to turn off the WSDL/Policy based features and its associated tubes.

    //Even in case of Dispatch, merge all features configured via WSDL/Policy or deployment configuration
    if (portModel != null) {
        // could have merged features from this.policyMap, but some features are set in WSDLModel which are not there in PolicyMap
        // for ex: <wsaw:UsingAddressing> wsdl extn., and since the policyMap features are merged into WSDLModel anyway during postFinished(),
        // So, using here WsdlModel for merging is right.

        // merge features from WSDL
        configFeatures = portModel.getFeatures();
    } else {
        configFeatures = PolicyUtil.getPortScopedFeatures(policyMap, owner.getServiceName(),portName);
    }
    webServiceFeatures.mergeFeatures(configFeatures, false);

    // merge features from interceptor
    webServiceFeatures.mergeFeatures(owner.serviceInterceptor.preCreateBinding(this, portInterface, webServiceFeatures), false);

    BindingImpl bindingImpl = BindingImpl.create(bindingId, webServiceFeatures.toArray());
    owner.getHandlerConfigurator().configureHandlers(this,bindingImpl);
    return bindingImpl;
}
 
Example 17
Project: OpenJSharp   File: HttpTransportPipe.java   View source code 5 votes vote down vote up
private static boolean isSticky(WSBinding binding) {
    boolean tSticky = false;
    WebServiceFeature[] features = binding.getFeatures().toArray();
    for(WebServiceFeature f : features) {
        if (f instanceof StickyFeature) {
            tSticky = true;
            break;
        }
    }
    return tSticky;
}
 
Example 18
Project: openjdk-jdk10   File: WebServiceFeatureList.java   View source code 4 votes vote down vote up
/**
 * Adds a feature to the list if it's not already added.
 */
public void add(@NotNull WebServiceFeature f) {
    if(addNoValidate(f) && isValidating)
        validate(f);
}
 
Example 19
Project: rapidminer   File: RepositoryService_Service.java   View source code 4 votes vote down vote up
public RepositoryService_Service(WebServiceFeature... features) {
    super(__getWsdlLocation(), REPOSITORYSERVICE_QNAME, features);
}
 
Example 20
Project: openjdk-jdk10   File: DatabindingConfig.java   View source code 4 votes vote down vote up
public void setFeatures(WebServiceFeature[] features) {
        setFeatures(new WebServiceFeatureList(features));
}
 
Example 21
Project: rapidminer   File: ManagementServiceService.java   View source code 4 votes vote down vote up
public ManagementServiceService(WebServiceFeature... features) {
    super(__getWsdlLocation(), MANAGEMENTSERVICESERVICE_QNAME, features);
}
 
Example 22
Project: rapidminer   File: ManagementServiceService.java   View source code 4 votes vote down vote up
public ManagementServiceService(URL wsdlLocation, WebServiceFeature... features) {
    super(wsdlLocation, MANAGEMENTSERVICESERVICE_QNAME, features);
}
 
Example 23
Project: rapidminer   File: ManagementServiceService.java   View source code 4 votes vote down vote up
public ManagementServiceService(URL wsdlLocation, QName serviceName, WebServiceFeature... features) {
    super(wsdlLocation, serviceName, features);
}
 
Example 24
Project: OpenJSharp   File: WSServiceDelegate.java   View source code 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 25
Project: rapidminer   File: ProcessService13_Service.java   View source code 4 votes vote down vote up
public ProcessService13_Service(URL wsdlLocation, WebServiceFeature... features) {
    super(wsdlLocation, PROCESSSERVICE13_QNAME, features);
}
 
Example 26
Project: rapidminer   File: ProcessService13_Service.java   View source code 4 votes vote down vote up
public ProcessService13_Service(URL wsdlLocation, QName serviceName, WebServiceFeature... features) {
    super(wsdlLocation, serviceName, features);
}
 
Example 27
Project: openjdk-jdk10   File: HTTPBindingImpl.java   View source code 4 votes vote down vote up
HTTPBindingImpl(WebServiceFeature ... features) {
    super(BindingID.XML_HTTP, features);
}
 
Example 28
Project: OpenJSharp   File: FeatureListUtil.java   View source code 4 votes vote down vote up
public static boolean isFeatureEnabled(@NotNull Class<? extends WebServiceFeature> featureType,
        @Nullable WebServiceFeatureList list1, @Nullable WebServiceFeatureList list2)
        throws WebServiceException {
    final WebServiceFeature mergedFeature = mergeFeature(featureType, list1, list2);
    return (mergedFeature != null) && mergedFeature.isEnabled();
}
 
Example 29
Project: OpenJSharp   File: SOAPBindingCodec.java   View source code 4 votes vote down vote up
public SOAPBindingCodec(WSFeatureList features, StreamSOAPCodec xmlSoapCodec) {
    super(getSoapVersion(features), features);

    this.xmlSoapCodec = xmlSoapCodec;
    xmlMimeType = xmlSoapCodec.getMimeType();

    xmlMtomCodec = new MtomCodec(version, xmlSoapCodec, features);

    xmlSwaCodec = new SwACodec(version, features, xmlSoapCodec);

    String clientAcceptedContentTypes = xmlSoapCodec.getMimeType() + ", " +
            xmlMtomCodec.getMimeType();

    WebServiceFeature fi = features.get(FastInfosetFeature.class);
    isFastInfosetDisabled = (fi != null && !fi.isEnabled());
    if (!isFastInfosetDisabled) {
        fiSoapCodec = getFICodec(xmlSoapCodec, version);
        if (fiSoapCodec != null) {
            fiMimeType = fiSoapCodec.getMimeType();
            fiSwaCodec = new SwACodec(version, features, fiSoapCodec);
            connegXmlAccept = fiMimeType + ", " + clientAcceptedContentTypes;

            /**
             * This feature will only be present on the client side.
             *
             * Fast Infoset is enabled on the client if the service
             * explicitly supports Fast Infoset.
             */
            WebServiceFeature select = features.get(SelectOptimalEncodingFeature.class);
            if (select != null) { // if the client FI feature is set - ignore negotiation property
                ignoreContentNegotiationProperty = true;
                if (select.isEnabled()) {
                    // If the client's FI encoding feature is enabled, and server's is not disabled
                    if (fi != null) {  // if server's FI feature also enabled
                        useFastInfosetForEncoding = true;
                    }

                    clientAcceptedContentTypes = connegXmlAccept;
                } else {  // If client FI feature is disabled
                    isFastInfosetDisabled = true;
                }
            }
        } else {
            // Fast Infoset could not be loaded by the runtime
            isFastInfosetDisabled = true;
            fiSwaCodec = null;
            fiMimeType = "";
            connegXmlAccept = clientAcceptedContentTypes;
            ignoreContentNegotiationProperty = true;
        }
    } else {
        // Fast Infoset is explicitly not supported by the service
        fiSoapCodec = fiSwaCodec = null;
        fiMimeType = "";
        connegXmlAccept = clientAcceptedContentTypes;
        ignoreContentNegotiationProperty = true;
    }

    xmlAccept = clientAcceptedContentTypes;

    if(getSoapVersion(features) == null)
        throw new WebServiceException("Expecting a SOAP binding but found ");
}
 
Example 30
Project: rapidminer   File: UpdateServiceService.java   View source code 4 votes vote down vote up
public UpdateServiceService(URL wsdlLocation, QName serviceName, WebServiceFeature... features) {
    super(wsdlLocation, serviceName, features);
}
 
Example 31
Project: module-template   File: GeoIPService.java   View source code 4 votes vote down vote up
public GeoIPService(URL wsdlLocation, WebServiceFeature ... features) {
    super(wsdlLocation, SERVICE, features);
}
 
Example 32
Project: OpenJSharp   File: DatabindingFactoryImpl.java   View source code 4 votes vote down vote up
public Builder feature(WebServiceFeature... f) {
    config.setFeatures(f);
    return this;
}
 
Example 33
Project: camel-springboot   File: GlobalWeather.java   View source code 4 votes vote down vote up
public GlobalWeather(WebServiceFeature ... features) {
    super(WSDL_LOCATION, SERVICE, features);
}
 
Example 34
Project: openjdk-jdk10   File: WSServiceDelegate.java   View source code 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 35
Project: OpenJSharp   File: MessageContextFactory.java   View source code 4 votes vote down vote up
protected com.oracle.webservices.internal.api.message.MessageContextFactory newFactory(WebServiceFeature... f) {
    return new com.sun.xml.internal.ws.api.message.MessageContextFactory(f);
}
 
Example 36
Project: openjdk-jdk10   File: BindingImpl.java   View source code 4 votes vote down vote up
public boolean isOperationFeatureEnabled(@NotNull Class<? extends WebServiceFeature> featureType,
        @NotNull final QName operationName) {
    final WebServiceFeatureList operationFeatureList = this.operationFeatures.get(operationName);
    return FeatureListUtil.isFeatureEnabled(featureType, operationFeatureList, features);
}
 
Example 37
Project: KernelHive   File: MonitoringClientBeanService.java   View source code 4 votes vote down vote up
public MonitoringClientBeanService(URL wsdlLocation, QName serviceName, WebServiceFeature... features) {
	super(wsdlLocation, serviceName, features);
}
 
Example 38
Project: openjdk-jdk10   File: SOAPBindingCodec.java   View source code 4 votes vote down vote up
public SOAPBindingCodec(WSFeatureList features, StreamSOAPCodec xmlSoapCodec) {
    super(getSoapVersion(features), features);

    this.xmlSoapCodec = xmlSoapCodec;
    xmlMimeType = xmlSoapCodec.getMimeType();

    xmlMtomCodec = new MtomCodec(version, xmlSoapCodec, features);

    xmlSwaCodec = new SwACodec(version, features, xmlSoapCodec);

    String clientAcceptedContentTypes = xmlSoapCodec.getMimeType() + ", " +
            xmlMtomCodec.getMimeType();

    WebServiceFeature fi = features.get(FastInfosetFeature.class);
    isFastInfosetDisabled = (fi != null && !fi.isEnabled());
    if (!isFastInfosetDisabled) {
        fiSoapCodec = getFICodec(xmlSoapCodec, version);
        if (fiSoapCodec != null) {
            fiMimeType = fiSoapCodec.getMimeType();
            fiSwaCodec = new SwACodec(version, features, fiSoapCodec);
            connegXmlAccept = fiMimeType + ", " + clientAcceptedContentTypes;

            /**
             * This feature will only be present on the client side.
             *
             * Fast Infoset is enabled on the client if the service
             * explicitly supports Fast Infoset.
             */
            WebServiceFeature select = features.get(SelectOptimalEncodingFeature.class);
            if (select != null) { // if the client FI feature is set - ignore negotiation property
                ignoreContentNegotiationProperty = true;
                if (select.isEnabled()) {
                    // If the client's FI encoding feature is enabled, and server's is not disabled
                    if (fi != null) {  // if server's FI feature also enabled
                        useFastInfosetForEncoding = true;
                    }

                    clientAcceptedContentTypes = connegXmlAccept;
                } else {  // If client FI feature is disabled
                    isFastInfosetDisabled = true;
                }
            }
        } else {
            // Fast Infoset could not be loaded by the runtime
            isFastInfosetDisabled = true;
            fiSwaCodec = null;
            fiMimeType = "";
            connegXmlAccept = clientAcceptedContentTypes;
            ignoreContentNegotiationProperty = true;
        }
    } else {
        // Fast Infoset is explicitly not supported by the service
        fiSoapCodec = fiSwaCodec = null;
        fiMimeType = "";
        connegXmlAccept = clientAcceptedContentTypes;
        ignoreContentNegotiationProperty = true;
    }

    xmlAccept = clientAcceptedContentTypes;

    if(getSoapVersion(features) == null)
        throw new WebServiceException("Expecting a SOAP binding but found ");
}
 
Example 39
Project: openjdk-jdk10   File: WebServiceFeatureList.java   View source code 4 votes vote down vote up
public boolean isEnabled(@NotNull Class<? extends WebServiceFeature> feature) {
    WebServiceFeature ftr = get(feature);
    return ftr != null && ftr.isEnabled();
}
 
Example 40
Project: OpenJSharp   File: BindingImpl.java   View source code 4 votes vote down vote up
public @Nullable <F extends WebServiceFeature> F getFeature(@NotNull Class<F> featureType){
    return features.get(featureType);
}