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


Java Service.create方法代码示例

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


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

示例1: createJaxWsService

import javax.xml.ws.Service; //导入方法依赖的package包/类
/**
 * Create a JAX-WS Service according to the parameters of this factory.
 * @see #setServiceName
 * @see #setWsdlDocumentUrl
 */
public Service createJaxWsService() {
	Assert.notNull(this.serviceName, "No service name specified");
	Service service;

	if (this.serviceFeatures != null) {
		service = (this.wsdlDocumentUrl != null ?
			Service.create(this.wsdlDocumentUrl, getQName(this.serviceName), this.serviceFeatures) :
			Service.create(getQName(this.serviceName), this.serviceFeatures));
	}
	else {
		service = (this.wsdlDocumentUrl != null ?
				Service.create(this.wsdlDocumentUrl, getQName(this.serviceName)) :
				Service.create(getQName(this.serviceName)));
	}

	if (this.executor != null) {
		service.setExecutor(this.executor);
	}
	if (this.handlerResolver != null) {
		service.setHandlerResolver(this.handlerResolver);
	}

	return service;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:30,代码来源:LocalJaxWsServiceFactory.java

示例2: 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

示例3: createWebService

import javax.xml.ws.Service; //导入方法依赖的package包/类
public Service createWebService(URL wsdlUrl, QName serviceQName) {
    return Service.create(wsdlUrl, serviceQName);
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:4,代码来源:BesDAO.java

示例4: getService

import javax.xml.ws.Service; //导入方法依赖的package包/类
public <T> Service getService(URL localWsdlUrl, Class<T> serviceClass)
        throws WebServiceException {
    QName serviceQName = new QName(details.getTargetNamespace(),
            serviceClass.getSimpleName());
    // as the real provisioning WSDL URL might require authentication,
    // we refer to a local version. The direct WSDL could be read with
    // appropriate credentials, but evaluation the imports will fail
    // with a 401. So we use a local version as workaround...
    Service service = Service.create(localWsdlUrl, serviceQName);

    return service;
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:13,代码来源:WSPortConnector.java

示例5: main

import javax.xml.ws.Service; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException, TransformerException {

        try {
            String address = deployWebservice();
            Service service = Service.create(new URL(address), ServiceImpl.SERVICE_NAME);

            Dispatch<Source> d = service.createDispatch(ServiceImpl.PORT_NAME, Source.class, Service.Mode.MESSAGE);
            Source response = d.invoke(new StreamSource(new StringReader(XML_REQUEST)));

            String resultXml = toString(response);

            log("= request ======== \n");
            log(XML_REQUEST);
            log("= result ========= \n");
            log(resultXml);
            log("\n==================");

            boolean xsAnyMixedPartSame = resultXml.contains(XS_ANY_MIXED_PART);
            log("resultXml.contains(XS_ANY_PART) = " + xsAnyMixedPartSame);
            if (!xsAnyMixedPartSame) {
                fail("The xs:any content=mixed part is supposed to be same in request and response.");
                throw new RuntimeException();
            }

            log("TEST PASSED");
        } finally {
            stopWebservice();

            // if you need to debug or explore wsdl generation result
            // comment this line out:
            deleteGeneratedFiles();
        }
    }
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:34,代码来源:Test.java

示例6: 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

示例7: createWebService

import javax.xml.ws.Service; //导入方法依赖的package包/类
private Service createWebService(URL wsdlUrl, QName serviceQName) {
    return Service.create(wsdlUrl, serviceQName);
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:4,代码来源:ServiceFactory.java

示例8: create

import javax.xml.ws.Service; //导入方法依赖的package包/类
/**
 * Creates a {@link Service} instance.
 *
 * <p>
 * This method works really like {@link Service#create(URL, QName)}
 * except it takes one more RI specific parameter.
 *
 * @param wsdlDocumentLocation
 *          {@code URL} for the WSDL document location for the service.
 *          Can be null, in which case WSDL is not loaded.
 * @param serviceName
 *          {@code QName} for the service.
 * @param properties
 *          Additional RI specific initialization parameters. Can be null.
 * @throws WebServiceException
 *          If any error in creation of the specified service.
 **/
public static Service create( URL wsdlDocumentLocation, QName serviceName, InitParams properties) {
    if(INIT_PARAMS.get()!=null)
        throw new IllegalStateException("someone left non-null InitParams");
    INIT_PARAMS.set(properties);
    try {
        Service svc = Service.create(wsdlDocumentLocation, serviceName);
        if(INIT_PARAMS.get()!=null)
            throw new IllegalStateException("Service "+svc+" didn't recognize InitParams");
        return svc;
    } finally {
        // even in case of an exception still reset INIT_PARAMS
        INIT_PARAMS.set(null);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:32,代码来源:WSService.java


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