当前位置: 首页>>代码示例>>Java>>正文


Java Service.getPort方法代码示例

本文整理汇总了Java中javax.xml.ws.Service.getPort方法的典型用法代码示例。如果您正苦于以下问题:Java Service.getPort方法的具体用法?Java Service.getPort怎么用?Java Service.getPort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.xml.ws.Service的用法示例。


在下文中一共展示了Service.getPort方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPort

import javax.xml.ws.Service; //导入方法依赖的package包/类
/**
     * Determines the reference to a web service provided by a technical
     * service.
     * 
     * @param <T>
     *            The type of service obtained.
     * @param localWsdlUrl
     *            The URL to a local service-related WSDL. The WSDL should be
     *            provided as file in a bundled .jar file.
     * @param serviceClass
     *            The service class implemented by the WSDL.
     * @return The web service reference.
     * @throws ParserConfigurationException
     * @throws WebServiceException
     *             Has to be caught by a caller, although it's a runtime
     *             exception
     */
    public <T> T getPort(URL localWsdlUrl, Class<T> serviceClass)
            throws ParserConfigurationException, WebServiceException {

        Service service = getService(localWsdlUrl, serviceClass);

        //EndpointReference epr = determineEndpointReference();
        T port = service.getPort(serviceClass);
        BindingProvider bindingProvider = (BindingProvider) port;
        Map<String, Object> clientRequestContext = bindingProvider
                .getRequestContext();
        clientRequestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, details.getEndpointURL());

        if (requiresUserAuthentication(userName, password)) {
//            BindingProvider bindingProvider = (BindingProvider) port;
//            Map<String, Object> clientRequestContext = bindingProvider
//                    .getRequestContext();
            clientRequestContext.put(BindingProvider.USERNAME_PROPERTY,
                    userName);
            clientRequestContext.put(BindingProvider.PASSWORD_PROPERTY,
                    password);
        }
        return port;
    }
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:41,代码来源:WSPortConnector.java

示例2: getPortStub

import javax.xml.ws.Service; //导入方法依赖的package包/类
/**
 * 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()));
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:JaxWsPortClientInterceptor.java

示例3: getServicePort

import javax.xml.ws.Service; //导入方法依赖的package包/类
<T> T getServicePort(Class<T> serviceClass, Map<String, Setting> settings)
            throws MalformedURLException {

        String targetNamespace = serviceClass.getAnnotation(WebService.class)
                .targetNamespace();
        QName serviceQName = new QName(targetNamespace,
                serviceClass.getSimpleName());

        Service service = createWebService(getWsdlUrl(serviceClass, settings),
                serviceQName);
//        addVersionInformation(service);
        return service.getPort(serviceClass);
    }
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:14,代码来源:BesDAO.java

示例4: createProxy

import javax.xml.ws.Service; //导入方法依赖的package包/类
/**
 * Helper method for creating a web service proxy. The service version
 * information is added into the header of the outbound SOAP message.
 * 
 * @param info
 *            - the properties for accessing the web service
 * @param type
 *            - web service described with the corresponding type
 * @return the web service proxy
 * @throws MalformedURLException
 */
private static <T> T createProxy(WsInfo info, final Class<T> type) {
    Service service = null;
    try {
        service = Service.create(new URL(info.getRemoteBssWsUrl()),
                new QName(NAMESPACE_URI, type.getSimpleName()));
    } catch (MalformedURLException e) {
        String text = "Error:Malformed URL";
        logger.error(text);
    }
    service = addVersionInformation(service);
    return service.getPort(type);
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:24,代码来源:WsProxy.java

示例5: getServicePort

import javax.xml.ws.Service; //导入方法依赖的package包/类
<T> T getServicePort(Class<T> serviceClass, Map<String, Setting> settings)
        throws MalformedURLException {

    String targetNamespace = serviceClass.getAnnotation(WebService.class)
            .targetNamespace();
    QName serviceQName = new QName(targetNamespace,
            serviceClass.getSimpleName());

    Service service = createWebService(getWsdlUrl(serviceClass, settings),
            serviceQName);
    addVersionInformation(service);
    return service.getPort(serviceClass);
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:14,代码来源:BesDAO.java

示例6: getServicePort

import javax.xml.ws.Service; //导入方法依赖的package包/类
private <T> T getServicePort(Class<T> serviceClass)
        throws ParserConfigurationException {

    String targetNamespace = serviceClass.getAnnotation(WebService.class)
            .targetNamespace();
    QName serviceQName = new QName(targetNamespace,
            serviceClass.getSimpleName());
    Service service = createWebService(localWSDLUrl, serviceQName);
    service = addVersionInformation(service);
    return service.getPort(
            determineEndpointReference(serviceClass.getSimpleName()),
            serviceClass);
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:14,代码来源:ServiceFactory.java

示例7: getBSSWebService

import javax.xml.ws.Service; //导入方法依赖的package包/类
/**
 * Creates a OSCM Web service with the given parameters.
 * 
 * @param serviceClass
 *            the class of the Web service to be created
 * @param authentication
 *            a <code>PasswordAuthentication</code> object specifying the
 *            credentials to be used for authentication
 * @return the service class
 * @throws ConfigurationException
 *             if the configuration of the platform is incorrect
 * @throws MalformedURLException
 *             if the base URL of the OSCM configuration is malformed
 */
public static <T> T getBSSWebService(Class<T> serviceClass,
        PasswordAuthentication authentication)
        throws ConfigurationException, MalformedURLException {

    String targetNamespace = serviceClass.getAnnotation(WebService.class)
            .targetNamespace();
    QName serviceQName = new QName(targetNamespace,
            serviceClass.getSimpleName());

    String wsdlUrl = APPlatformServiceFactory.getInstance()
            .getBSSWebServiceWSDLUrl();
    wsdlUrl = wsdlUrl.replace("{SERVICE}", serviceClass.getSimpleName());
    String serviceUrl = APPlatformServiceFactory.getInstance()
    .getBSSWebServiceUrl();
    serviceUrl=serviceUrl.replace("{SERVICE}", serviceClass.getSimpleName());
    Service service = Service.create(new URL(wsdlUrl), serviceQName);

    boolean isSsoMode = wsdlUrl != null
            && wsdlUrl.toLowerCase().endsWith("/sts?wsdl");
    String portSuffix = isSsoMode ? "PortSTS" : "PortBASIC";

    T client = service.getPort(
            new QName(targetNamespace, serviceClass.getSimpleName()
                    + portSuffix), serviceClass);

    String usernameConstant = isSsoMode ? "username"
            : BindingProvider.USERNAME_PROPERTY;
    String passwordConstant = isSsoMode ? "password"
            : BindingProvider.PASSWORD_PROPERTY;

    Map<String, Object> clientRequestContext = ((BindingProvider) client)
            .getRequestContext();
    clientRequestContext
            .put(usernameConstant, authentication.getUserName());
    clientRequestContext
            .put(passwordConstant, authentication.getPassword());
    clientRequestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
            serviceUrl );
    return client;
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:55,代码来源:BSSWebServiceFactory.java

示例8: getPort

import javax.xml.ws.Service; //导入方法依赖的package包/类
/**
 * Creates a proxy 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> T getPort(@NotNull Service jaxwsService,
                 @NotNull Class<T> serviceEndpointInterface,
                 WebServiceFeature... features)     {
    // TODO: implement it in a better way
    return jaxwsService.getPort(toSpec(),serviceEndpointInterface,features);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:WSEndpointReference.java


注:本文中的javax.xml.ws.Service.getPort方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。