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


Java BindingProvider类代码示例

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


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

示例1: setTimeout

import javax.xml.ws.BindingProvider; //导入依赖的package包/类
/**
 * Sets the timeout for this web service client. Every port created by a JAX-WS can be cast to
 * BindingProvider.
 */
public static void setTimeout(BindingProvider port, int timeout) {
	if (port == null) {
		throw new IllegalArgumentException("port must not be null!");
	}

	Map<String, Object> ctxt = port.getRequestContext();
	ctxt.put("com.sun.xml.ws.developer.JAXWSProperties.CONNECT_TIMEOUT", timeout);
	ctxt.put("com.sun.xml.ws.connect.timeout", timeout);
	ctxt.put("com.sun.xml.ws.internal.connect.timeout", timeout);
	ctxt.put("com.sun.xml.ws.request.timeout", timeout);
	ctxt.put("com.sun.xml.internal.ws.request.timeout", timeout);

	// We don't want to use proprietary Sun code
	// ctxt.put(BindingProviderProperties.REQUEST_TIMEOUT, timeout);
	// ctxt.put(BindingProviderProperties.CONNECT_TIMEOUT, timeout);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:21,代码来源:WebServiceTools.java

示例2: testJaxWsBeanFromCxfRoute

import javax.xml.ws.BindingProvider; //导入依赖的package包/类
@Test
public void testJaxWsBeanFromCxfRoute() throws Exception {
    URL wsdlURL = getClass().getClassLoader().getResource("person.wsdl");
    PersonService ss = new PersonService(wsdlURL, new QName("http://camel.apache.org/wsdl-first", "PersonService"));
    Person client = ss.getSoap();
    ((BindingProvider)client).getRequestContext()
        .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
             "http://localhost:" + CXFTestSupport.getPort1() + "/CxfBeanTest/PersonService/");
    
    Holder<String> personId = new Holder<String>();
    personId.value = "hello";
    Holder<String> ssn = new Holder<String>();
    Holder<String> name = new Holder<String>();
    client.getPerson(personId, ssn, name);
    assertEquals("Get a wrong personId", "hello", personId.value);
    assertEquals("Get a wrong SSN", "000-000-0000", ssn.value);
    assertEquals("Get a wrong name", "Bonjour", name.value);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:19,代码来源:CxfBeanTest.java

示例3: getPort

import javax.xml.ws.BindingProvider; //导入依赖的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

示例4: AdministrationWSClient

import javax.xml.ws.BindingProvider; //导入依赖的package包/类
/**
 * IWS Access WebService Client Constructor. Takes the URL for the WSDL as
 * parameter, to generate a new WebService Client instance.<br />
 *   For example: https://iws.iaeste.net:9443/iws-ws/administrationWS?wsdl
 *
 * @param wsdlLocation IWS Administration WSDL URL
 * @throws MalformedURLException if not a valid URL
 */
public AdministrationWSClient(final String wsdlLocation) throws MalformedURLException {
    super(new URL(wsdlLocation), ACCESS_SERVICE_NAME);
    client = getPort(ACCESS_SERVICE_PORT, AdministrationWS.class);

    // The CXF will by default attempt to read the URL from the WSDL at the
    // Server, which is normally given with the server's name. However, as
    // we're running via a load balancer and/or proxies, this address may
    // not be available or resolvable via DNS. Instead, we force using the
    // same WSDL for requests as we use for accessing the server.
    // Binding: http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-Howtooverridetheserviceaddress?
    ((BindingProvider) client).getRequestContext().put(ENDPOINT_ADDRESS, wsdlLocation);

    // The CXF has a number of default Policy settings, which can all be
    // controlled via the internal Policy Scheme. To override or update the
    // default values, the Policy must be exposed. Which is done by setting
    // a new Policy Scheme which can be access externally.
    // Policy: http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-HowtoconfiguretheHTTPConduitfortheSOAPClient?
    final Client proxy = ClientProxy.getClient(client);
    final HTTPConduit conduit = (HTTPConduit) proxy.getConduit();

    // Finally, set the Policy into the HTTP Conduit.
    conduit.setClient(policy);
}
 
开发者ID:IWSDevelopers,项目名称:iws,代码行数:32,代码来源:AdministrationWSClient.java

示例5: sendMessageWithUsernameToken

import javax.xml.ws.BindingProvider; //导入依赖的package包/类
protected String sendMessageWithUsernameToken(String username, String password, String message) throws Exception {
    final javax.xml.ws.Service svc = javax.xml.ws.Service.create(WSDL_LOC, SERVICE_QNAME);
    final Greeter greeter = svc.getPort(PORT_QNAME, Greeter.class);

    Client client = ClientProxy.getClient(greeter);        
    Map<String, Object> props = new HashMap<String, Object>();
    props.put("action", "UsernameToken");
    props.put("user", username);
    // Set the the password type to be plain text, 
    // so we can keep using the password to authenticate with spring security
    props.put("passwordType", "PasswordText");       
    WSS4JOutInterceptor wss4jOut = new WSS4JOutInterceptor(props);

    client.getOutInterceptors().add(wss4jOut);
    ((BindingProvider)greeter).getRequestContext().put("password", password);
    return greeter.greetMe(message);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:18,代码来源:GreeterClientTest.java

示例6: testRoutes

import javax.xml.ws.BindingProvider; //导入依赖的package包/类
@Test
public void testRoutes() throws Exception {
    URL wsdlURL = getClass().getClassLoader().getResource("person.wsdl");
    PersonService ss = new PersonService(wsdlURL, QName.valueOf(getServiceName()));

    Person client = ss.getSoap();
    
    Client c = ClientProxy.getClient(client);
    
    ((BindingProvider)client).getRequestContext()
        .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
             "http://localhost:" + port1 + "/" + getClass().getSimpleName() + "/PersonService");
    c.getInInterceptors().add(new LoggingInInterceptor());
    c.getOutInterceptors().add(new LoggingOutInterceptor());
    
    Holder<String> personId = new Holder<String>();
    personId.value = "hello";
    Holder<String> ssn = new Holder<String>();
    Holder<String> name = new Holder<String>();
    client.getPerson(personId, ssn, name);
    assertEquals("Bonjour", name.value);

}
 
开发者ID:HydAu,项目名称:Camel,代码行数:24,代码来源:CXFWsdlOnlyPayloadModeNoSpringTest.java

示例7: setEndpointInContext

import javax.xml.ws.BindingProvider; //导入依赖的package包/类
public <T> void setEndpointInContext(BindingProvider client,
        Map<String, Setting> settings, Class<T> serviceClass) {
    Map<String, Object> clientRequestContext = client.getRequestContext();
    String wsUrl = "";
    if (isSsoMode(settings)) {
        wsUrl = settings.get(
                PlatformConfigurationKey.BSS_STS_WEBSERVICE_URL.name())
                .getValue();
    } else {
        wsUrl = settings.get(
                PlatformConfigurationKey.BSS_WEBSERVICE_URL.name())
                .getValue();
    }
    wsUrl = wsUrl.replace("{SERVICE}", serviceClass.getSimpleName());
    clientRequestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
            wsUrl);
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:18,代码来源:BesDAO.java

示例8: getUserDetails

import javax.xml.ws.BindingProvider; //导入依赖的package包/类
/**
 * Gets the user details from BES. If user is null, the current user details
 * will be returned, otherwise of the specified user.
 * 
 * @param si
 * @param user
 * @param password
 * @param controllerId
 * @return
 * @throws APPlatformException
 * @throws BESNotificationException
 */
public VOUserDetails getUserDetails(ServiceInstance si, VOUser user,
                                    String password, Optional<String> controllerId) throws APPlatformException {
    VOUserDetails userDetails = null;
    IdentityService idServ = getBESWebService(IdentityService.class, si, controllerId);
    if (user != null) {
        Map<String, Setting> proxySettings = configService
                .getAllProxyConfigurationSettings();
        boolean isSso = isSsoMode(proxySettings);
        setUserCredentialsInContext((BindingProvider) idServ,
                isSso ? user.getUserId() : String.valueOf(user.getKey()),
                password, proxySettings);
    }

    try {
        userDetails = idServ.getCurrentUserDetails();
    } catch (Exception e) {
        throw new APPlatformException(e.getMessage(), e);
    }

    return userDetails;
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:34,代码来源:BesDAO.java

示例9: setUserCredentialsInContext_INTERNAL

import javax.xml.ws.BindingProvider; //导入依赖的package包/类
@Test
public void setUserCredentialsInContext_INTERNAL() {
    // given
    Map<String, Setting> settings = getSettingsForMode("INTERNAL");
    BindingProvider client = Mockito.mock(BindingProvider.class);
    Map<String, String> context = new HashMap<>();
    Mockito.doReturn(context).when(client).getRequestContext();

    // when
    besDAO.setUserCredentialsInContext(client, USER, PASSWORD, settings);

    // then
    assertNull(client.getRequestContext().get(
            "username"));
    assertNull(client.getRequestContext().get(
            "password"));
    assertEquals(
            USER,
            client.getRequestContext().get(
                    BindingProvider.USERNAME_PROPERTY));
    assertEquals(
            PASSWORD,
            client.getRequestContext().get(
                    BindingProvider.PASSWORD_PROPERTY));
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:26,代码来源:BesDAOTest.java

示例10: setUserCredentialsInContext_SAML_SP

import javax.xml.ws.BindingProvider; //导入依赖的package包/类
@Test
public void setUserCredentialsInContext_SAML_SP() {
    // given
    Map<String, Setting> settings = getSettingsForMode("SAML_SP");
    BindingProvider client = Mockito.mock(BindingProvider.class);
    Map<String, String> context = new HashMap<>();
    Mockito.doReturn(context).when(client).getRequestContext();

    // when
    besDAO.setUserCredentialsInContext(client, USER, PASSWORD, settings);

    // then
    assertNull(client.getRequestContext().get(
            BindingProvider.USERNAME_PROPERTY));
    assertNull(client.getRequestContext().get(
            BindingProvider.PASSWORD_PROPERTY));
    assertEquals(USER,
            client.getRequestContext().get("username"));
    assertEquals(PASSWORD,
            client.getRequestContext().get("password"));
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:22,代码来源:BesDAOTest.java

示例11: getUserDetails_givenUser_INTERNAL

import javax.xml.ws.BindingProvider; //导入依赖的package包/类
@Test
public void getUserDetails_givenUser_INTERNAL() throws APPlatformException {
    // given
    besDAO.configService = confServ;
    Map<String, Setting> settings = getSettingsForMode("INTERNAL");
    doReturn(settings).when(besDAO.configService)
            .getAllProxyConfigurationSettings();
    doReturn(idServ).when(besDAO).getBESWebService(
            eq(IdentityService.class), any(ServiceInstance.class), any(Optional.class));
    VOUser user = givenUser(null, "mail");

    // when
    besDAO.getUserDetails(new ServiceInstance(), user, "password", Optional.empty());

    // then
    verify(besDAO).setUserCredentialsInContext(any(BindingProvider.class),
            eq(Long.valueOf(user.getKey()).toString()), eq("password"),
            eq(settings));
    verify(idServ).getCurrentUserDetails();
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:21,代码来源:BesDAOTest.java

示例12: getUserDetails_givenUser_SSO

import javax.xml.ws.BindingProvider; //导入依赖的package包/类
@Test
public void getUserDetails_givenUser_SSO() throws APPlatformException {
    // given
    besDAO.configService = confServ;
    Map<String, Setting> settings = getSettingsForMode("SAML_SP");
    doReturn(settings).when(besDAO.configService)
            .getAllProxyConfigurationSettings();
    doReturn(idServ).when(besDAO).getBESWebService(
            eq(IdentityService.class), any(ServiceInstance.class), any(Optional.class));
    VOUser user = givenUser(null, "mail");

    // when
    besDAO.getUserDetails(new ServiceInstance(), user, "password", Optional.empty());

    // then
    verify(besDAO).setUserCredentialsInContext(any(BindingProvider.class),
            eq(user.getUserId()), eq("password"), eq(settings));
    verify(idServ).getCurrentUserDetails();
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:20,代码来源:BesDAOTest.java

示例13: getClientForBESTechnologyManager_INTERNAL_userInConfig

import javax.xml.ws.BindingProvider; //导入依赖的package包/类
@Test
public void getClientForBESTechnologyManager_INTERNAL_userInConfig()
        throws MalformedURLException, APPlatformException {
    // given
    Map<String, Setting> proxySettings = getSettingsForMode("INTERNAL");
    Map<String, Setting> controllerSettings = getControllerSettings(true,
            true, true);
    BesDAO besDAO = mockWebServiceSetup(proxySettings, controllerSettings);

    // when
    IdentityService client = besDAO.getBESWebService(IdentityService.class,
            new ServiceInstance(), Optional.empty());

    // then
    verify(besDAO, times(1)).setUserCredentialsInContext(
            (BindingProvider) client, USER_KEY_TM, USER_PWD_TM,
            proxySettings);
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:19,代码来源:BesDAOTest.java

示例14: getClientForBESTechnologyManager_INTERNAL_userKeyNotInConfig_userInTS

import javax.xml.ws.BindingProvider; //导入依赖的package包/类
@Test
public void getClientForBESTechnologyManager_INTERNAL_userKeyNotInConfig_userInTS()
        throws MalformedURLException, BadResultException,
        APPlatformException {
    // given
    Map<String, Setting> proxySettings = getSettingsForMode("INTERNAL");
    Map<String, Setting> controllerSettings = getControllerSettings(true,
            false, true);
    BesDAO besDAO = mockWebServiceSetup(proxySettings, controllerSettings);
    ServiceInstance si = getServiceInstanceWithParameters(true, true);

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

    // then
    verify(besDAO, times(1)).setUserCredentialsInContext(
            (BindingProvider) client, USER_TM_TechSvc, USER_PWD_TM_TechSvc,
            proxySettings);
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:21,代码来源:BesDAOTest.java

示例15: getClientForBESTechnologyManager_INTERNAL_userPwdNotInConfig_userInTS

import javax.xml.ws.BindingProvider; //导入依赖的package包/类
@Test
public void getClientForBESTechnologyManager_INTERNAL_userPwdNotInConfig_userInTS()
        throws MalformedURLException, BadResultException,
        APPlatformException {
    // given
    Map<String, Setting> proxySettings = getSettingsForMode("INTERNAL");
    Map<String, Setting> controllerSettings = getControllerSettings(true,
            true, false);
    BesDAO besDAO = mockWebServiceSetup(proxySettings, controllerSettings);
    ServiceInstance si = getServiceInstanceWithParameters(true, true);

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

    // then
    verify(besDAO, times(1)).setUserCredentialsInContext(
            (BindingProvider) client, USER_TM_TechSvc, USER_PWD_TM_TechSvc,
            proxySettings);
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:21,代码来源:BesDAOTest.java


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