当前位置: 首页>>代码示例>>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;未经允许,请勿转载。