當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。