當前位置: 首頁>>代碼示例>>Java>>正文


Java Service類代碼示例

本文整理匯總了Java中javax.xml.ws.Service的典型用法代碼示例。如果您正苦於以下問題:Java Service類的具體用法?Java Service怎麽用?Java Service使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Service類屬於javax.xml.ws包,在下文中一共展示了Service類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: mockWebServiceSetup

import javax.xml.ws.Service; //導入依賴的package包/類
@SuppressWarnings("unchecked")
private BesDAO mockWebServiceSetup(
        final Map<String, Setting> proxySettings,
        final Map<String, Setting> controllerSettings)
        throws APPlatformException, MalformedURLException {
    BesDAO besDAO = spy(new BesDAO());
    besDAO.configService = spy(new APPConfigurationServiceBean());
    doReturn(proxySettings).when(besDAO.configService)
            .getAllProxyConfigurationSettings();
    if (controllerSettings != null) {
        doReturn(controllerSettings).when(besDAO.configService)
                .getControllerConfigurationSettings(anyString());
    }
    doReturn(mock(Service.class)).when(besDAO).createWebService(
            any(URL.class), any(QName.class));
    doReturn(idServ).when(besDAO).getServicePort(eq(IdentityService.class),
            anyMap());
    doReturn(subServ).when(besDAO).getServicePort(
            eq(SubscriptionService.class), anyMap());
    return besDAO;
}
 
開發者ID:servicecatalog,項目名稱:oscm-app,代碼行數:22,代碼來源:BesDAOTest.java

示例2: getServicePort

import javax.xml.ws.Service; //導入依賴的package包/類
@Test
public void getServicePort() throws MalformedURLException {
    // given
    Map<String, Setting> settings = getSettingsForMode("SAML_SP");
    IdentityService idSvcMock = Mockito.mock(IdentityService.class);
    Service serviceMock = Mockito.mock(Service.class);
    doReturn(serviceMock).when(besDAO).createWebService(any(URL.class),
            any(QName.class));
    when(
            serviceMock.getPort(Matchers.any(QName.class),
                    eq(IdentityService.class))).thenReturn(idSvcMock);

    // when
    IdentityService idSvc = besDAO.getServicePort(IdentityService.class,
            settings);

    // then
    assertTrue(IdentityService.class.isAssignableFrom(idSvc.getClass()));
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:20,代碼來源:BesDAOTest.java

示例3: getBESWebService_nullInstance

import javax.xml.ws.Service; //導入依賴的package包/類
@SuppressWarnings("unchecked")
@Test
public void getBESWebService_nullInstance() throws MalformedURLException,
        APPlatformException {
    // given
    BesDAO besDAO = spy(new BesDAO());
    besDAO.configService = spy(new APPConfigurationServiceBean());
    Map<String, Setting> settings = getSettingsForMode("INTERNAL");
    doReturn(settings).when(besDAO.configService)
            .getAllProxyConfigurationSettings();
    Service serviceMock = Mockito.mock(Service.class);
    doReturn(serviceMock).when(besDAO).createWebService(any(URL.class),
            any(QName.class));
    doReturn(idServ).when(besDAO).getServicePort(eq(IdentityService.class),
            anyMap());
    doReturn(new PasswordAuthentication("user", "password")).when(
            besDAO.configService).getAuthenticationForAPPAdmin(anyMap());

    // when
    besDAO.getBESWebService(IdentityService.class, null, Optional.empty());

    // then
    verify(besDAO.configService, times(1)).getAuthenticationForAPPAdmin(
            anyMap());
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:26,代碼來源:BesDAOTest.java

示例4: createDispatch

import javax.xml.ws.Service; //導入依賴的package包/類
/**
 * Creates a new {@link Dispatch} stub that connects to the given pipe.
 *
 * @param portName
 *      see {@link Service#createDispatch(QName, Class, Service.Mode)}.
 * @param owner
 *      see <a href="#param">common parameters</a>
 * @param binding
 *      see <a href="#param">common parameters</a>
 * @param clazz
 *      Type of the {@link Dispatch} to be created.
 *      See {@link Service#createDispatch(QName, Class, Service.Mode)}.
 * @param mode
 *      The mode of the dispatch.
 *      See {@link Service#createDispatch(QName, Class, Service.Mode)}.
 * @param next
 *      see <a href="#param">common parameters</a>
 * @param epr
 *      see <a href="#param">common parameters</a>
 * TODO: are these parameters making sense?
 */
@SuppressWarnings("unchecked")
    public static <T> Dispatch<T> createDispatch(QName portName,
                                             WSService owner,
                                             WSBinding binding,
                                             Class<T> clazz, Service.Mode mode, Tube next,
                                             @Nullable WSEndpointReference epr) {
    if (clazz == SOAPMessage.class) {
        return (Dispatch<T>) createSAAJDispatch(portName, owner, binding, mode, next, epr);
    } else if (clazz == Source.class) {
        return (Dispatch<T>) createSourceDispatch(portName, owner, binding, mode, next, epr);
    } else if (clazz == DataSource.class) {
        return (Dispatch<T>) createDataSourceDispatch(portName, owner, binding, mode, next, epr);
    } else if (clazz == Message.class) {
        if(mode==Mode.MESSAGE)
            return (Dispatch<T>) createMessageDispatch(portName, owner, binding, next, epr);
        else
            throw new WebServiceException(mode+" not supported with Dispatch<Message>");
    } else if (clazz == Packet.class) {
        return (Dispatch<T>) createPacketDispatch(portName, owner, binding, next, epr);
    } else
        throw new WebServiceException("Unknown class type " + clazz.getName());
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:44,代碼來源:Stubs.java

示例5: createDispatch

import javax.xml.ws.Service; //導入依賴的package包/類
protected Dispatch<Object> createDispatch(QName portName, JAXBContext jaxbContext, Service.Mode mode, WebServiceFeatureList features) {
    WSEndpointReference wsepr = null;
    boolean isAddressingEnabled = false;
    AddressingFeature af = features.get(AddressingFeature.class);
    if (af == null) {
        af = this.features.get(AddressingFeature.class);
    }
    if (af != null && af.isEnabled())
        isAddressingEnabled = true;
    MemberSubmissionAddressingFeature msa = features.get(MemberSubmissionAddressingFeature.class);
    if (msa == null) {
        msa = this.features.get(MemberSubmissionAddressingFeature.class);
    }
    if (msa != null && msa.isEnabled())
        isAddressingEnabled = true;
    if(isAddressingEnabled && wsdlService != null && wsdlService.get(portName) != null) {
        wsepr = wsdlService.get(portName).getEPR();
    }
    return createDispatch(portName, wsepr, jaxbContext, mode, features);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:21,代碼來源:WSServiceDelegate.java

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

示例7: findIstack22APIs

import javax.xml.ws.Service; //導入依賴的package包/類
/**
 * Creates a class loader for loading JAXB/WS 2.2 jar
 */
private static URL[] findIstack22APIs(ClassLoader cl) throws ClassNotFoundException, IOException {
    List<URL> urls = new ArrayList<URL>();

    if(Service.class.getClassLoader()==null) {
        // JAX-WS API is loaded from bootstrap class loader
        URL res = cl.getResource("javax/xml/ws/EndpointContext.class");
        if(res==null)
            throw new ClassNotFoundException("There's no JAX-WS 2.2 API in the classpath");
        urls.add(ParallelWorldClassLoader.toJarUrl(res));
        res = cl.getResource("javax/xml/bind/JAXBPermission.class");
        if(res==null)
            throw new ClassNotFoundException("There's no JAXB 2.2 API in the classpath");
        urls.add(ParallelWorldClassLoader.toJarUrl(res));
    }

    return urls.toArray(new URL[urls.size()]);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:21,代碼來源:Invoker.java

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

示例9: initWebServiceClient

import javax.xml.ws.Service; //導入依賴的package包/類
/**
 * Initialiseert webservice client voor protocolleer synchronisatie persoon.
 */
@PostConstruct
public void initWebServiceClient() {
    webserviceClient = initService().createDispatch(SYNC_PERSOON_PORT_NAME, Source.class, Service.Mode.PAYLOAD);
    /// future calls to getRequestContext() will use a thread local request context, allowing the request context to be threadsafe.
    webserviceClient.getRequestContext().put("thread.local.request.context", Boolean.TRUE.toString().toLowerCase());
}
 
開發者ID:MinBZK,項目名稱:OperatieBRP,代碼行數:10,代碼來源:VerzendingVerwerkPersoonWebServiceClientImpl.java

示例10: getBESWebService_withInstance

import javax.xml.ws.Service; //導入依賴的package包/類
@SuppressWarnings("unchecked")
@Test
public void getBESWebService_withInstance() throws MalformedURLException,
        APPlatformException {
    // given
    BesDAO besDAO = spy(new BesDAO());
    besDAO.configService = spy(new APPConfigurationServiceBean());
    Map<String, Setting> settings = getSettingsForMode("INTERNAL");
    doReturn(settings).when(besDAO.configService)
            .getAllProxyConfigurationSettings();
    Map<String, Setting> controllerSettings = getControllerSettings(true,
            true, true);
    doReturn(controllerSettings).when(besDAO.configService)
            .getControllerConfigurationSettings(anyString());
    doReturn(mock(Service.class)).when(besDAO).createWebService(
            any(URL.class), any(QName.class));
    doReturn(idServ).when(besDAO).getServicePort(eq(IdentityService.class),
            anyMap());
    doReturn(new PasswordAuthentication("user", "password")).when(
            besDAO.configService).getAuthenticationForAPPAdmin(anyMap());
    ServiceInstance si = new ServiceInstance();

    // when
    besDAO.getBESWebService(IdentityService.class, si, Optional.empty());

    // then
    verify(besDAO.configService, times(1))
            .getAuthenticationForBESTechnologyManager(anyString(), eq(si),
                    anyMap());
}
 
開發者ID:servicecatalog,項目名稱:oscm-app,代碼行數:31,代碼來源:BesDAOTest.java

示例11: addVersionInformationToClient

import javax.xml.ws.Service; //導入依賴的package包/類
/**
 * This method adds a version SOAP Handler into the handler chain of a web
 * service. The version SOAP Handler is responsible to add a version
 * information in the header of the outbound SOAP message.
 * 
 * @param service
 *            set HandlerResolver for service by invoking service
 *            <code>setHandlerResolver</code> method.
 * @return service with handler chain for handling version information.
 */
public Service addVersionInformationToClient(Service service) {
    service.setHandlerResolver(new HandlerResolver() {
        @SuppressWarnings("rawtypes")
        @Override
        public List<Handler> getHandlerChain(PortInfo portInfo) {
            List<Handler> handlerList = new ArrayList<Handler>();
            handlerList.add(new VersionHandler(version));
            return handlerList;
        }
    });
    return service;
}
 
開發者ID:servicecatalog,項目名稱:oscm,代碼行數:23,代碼來源:ClientVersionHandler.java

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

示例13: initWebServiceClient

import javax.xml.ws.Service; //導入依賴的package包/類
/**
 * Initialiseert webservice client voor protocolleer bijhoudingsnotificatie..
 */
@PostConstruct
public void initWebServiceClient() {
    webserviceClient = initService().createDispatch(VERWERK_BIJH_PLAN_PORT_NAME, Source.class, Service.Mode.PAYLOAD);
    /// future calls to getRequestContext() will use a thread local request context, allowing the request context to be threadsafe.
    webserviceClient.getRequestContext().put("thread.local.request.context", Boolean.TRUE.toString().toLowerCase());
}
 
開發者ID:MinBZK,項目名稱:OperatieBRP,代碼行數:10,代碼來源:VerzendingBijhoudingsNotificatieWebServiceClientImpl.java

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

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


注:本文中的javax.xml.ws.Service類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。