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


Java BindingProvider.getRequestContext方法代码示例

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


在下文中一共展示了BindingProvider.getRequestContext方法的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: updateBindingProvider

import javax.xml.ws.BindingProvider; //导入方法依赖的package包/类
private void updateBindingProvider(BindingProvider bindingProvider, String uri) {
    Map<String, Object> requestContext = bindingProvider.getRequestContext();

    requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, uri);
    requestContext.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);

    updateRequestTimeout();

    if (this.ignoreSslErrors) {
        IgnoreSslErrors.ignoreErrors(bindingProvider);
    }

    if (this.trustManager != null) {
        IgnoreSslErrors.useTrustManager(bindingProvider, this.trustManager);
    }
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:17,代码来源:BasicConnection.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: 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

示例5: getBESWebService

import javax.xml.ws.BindingProvider; //导入方法依赖的package包/类
public <T> T getBESWebService(Class<T> serviceClass)
        throws ParserConfigurationException {
    T client = getServicePort(serviceClass);
    BindingProvider bindingProvider = (BindingProvider) client;
    Map<String, Object> clientRequestContext = bindingProvider
            .getRequestContext();
    clientRequestContext.put(BindingProvider.USERNAME_PROPERTY, userName);
    clientRequestContext.put(BindingProvider.PASSWORD_PROPERTY, password);
    return client;
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:11,代码来源:ServiceFactory.java

示例6: setUserNameAndPassword

import javax.xml.ws.BindingProvider; //导入方法依赖的package包/类
/**
 * 
 * @param userName
 * @param password
 */
private void setUserNameAndPassword(String userName, String password) {
    final BindingProvider bindingProvider = (BindingProvider) endpoint;
    Map<String, Object> requestContext = bindingProvider
            .getRequestContext();
    requestContext.put(BindingProvider.USERNAME_PROPERTY, userName);
    requestContext.put(BindingProvider.PASSWORD_PROPERTY, password);
}
 
开发者ID:jonico,项目名称:core,代码行数:13,代码来源:SWPTester.java

示例7: createModelPort

import javax.xml.ws.BindingProvider; //导入方法依赖的package包/类
public static ModelPortType createModelPort(CommandLine cmdLine) {
	String endpointUrl = cmdLine.getOptionValue(OPT_URL, DEFAULT_ENDPOINT_URL);
       String user = cmdLine.getOptionValue(OPT_USER, ADM_USERNAME);
	ClientPasswordHandler.setPassword(cmdLine.getOptionValue(OPT_PASSWORD, ADM_PASSWORD));
	System.out.println("Endpoint URL: " + endpointUrl);
	
	ModelService modelService = new ModelService();
	ModelPortType modelPort = modelService.getModelPort();
	BindingProvider bp = (BindingProvider)modelPort;
	Map<String, Object> requestContext = bp.getRequestContext();
	requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointUrl);
	
	org.apache.cxf.endpoint.Client client = ClientProxy.getClient(modelPort);
	org.apache.cxf.endpoint.Endpoint cxfEndpoint = client.getEndpoint();
	
	Map<String,Object> outProps = new HashMap<>();
	
	outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
	outProps.put(WSHandlerConstants.USER, user);
	outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_DIGEST);
	outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS, ClientPasswordHandler.class.getName());
	
	WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
	cxfEndpoint.getOutInterceptors().add(wssOut);

	return modelPort;
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:28,代码来源:Upload.java

示例8: createModelPort

import javax.xml.ws.BindingProvider; //导入方法依赖的package包/类
public static ModelPortType createModelPort(String[] args) {
	String endpointUrl = DEFAULT_ENDPOINT_URL;
	
	if (args.length > 0) {
		endpointUrl = args[0];
	}

	System.out.println("Endpoint URL: "+endpointUrl);

       // uncomment this if you want to use Fiddler or any other proxy
       //ProxySelector.setDefault(new MyProxySelector("127.0.0.1", 8888));
	
	ModelService modelService = new ModelService();
	ModelPortType modelPort = modelService.getModelPort();
	BindingProvider bp = (BindingProvider)modelPort;
	Map<String, Object> requestContext = bp.getRequestContext();
	requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointUrl);
	
	org.apache.cxf.endpoint.Client client = ClientProxy.getClient(modelPort);
	org.apache.cxf.endpoint.Endpoint cxfEndpoint = client.getEndpoint();
	
	Map<String,Object> outProps = new HashMap<String,Object>();
	
	outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
	outProps.put(WSHandlerConstants.USER, ADM_USERNAME);
	outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_DIGEST);
	outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS, ClientPasswordHandler.class.getName());
	
	WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
	cxfEndpoint.getOutInterceptors().add(wssOut);
       // enable the following to get client-side logging of outgoing requests and incoming responses
       cxfEndpoint.getOutInterceptors().add(new LoggingOutInterceptor());
       cxfEndpoint.getInInterceptors().add(new LoggingInInterceptor());

	return modelPort;
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:37,代码来源:Main.java

示例9: createModelPort

import javax.xml.ws.BindingProvider; //导入方法依赖的package包/类
/**
   * Creates webservice client connecting to midpoint
   * */
  protected static ModelPortType createModelPort(String username, String password, String passwordType) {

  	String endpoint = ENDPOINT;
  	if (System.getProperty("midpoint.endpoint") != null) {
  		endpoint = System.getProperty("midpoint.endpoint");
  	}
      LOGGER.info("Creating model client endpoint: {} , username={}, password={}", 
      		new Object[] {endpoint, username, password});

      ModelService modelService = new ModelService();
      ModelPortType modelPort = modelService.getModelPort();
      BindingProvider bp = (BindingProvider)modelPort;
      Map<String, Object> requestContext = bp.getRequestContext();
      requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpoint);

      org.apache.cxf.endpoint.Client client = ClientProxy.getClient(modelPort);
      org.apache.cxf.endpoint.Endpoint cxfEndpoint = client.getEndpoint();

      Map<String, Object> outProps = new HashMap<String, Object>();
      if (username != null) {
       outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
       outProps.put(WSHandlerConstants.USER, username);
       outProps.put(WSHandlerConstants.PASSWORD_TYPE, passwordType);
       ClientPasswordHandler.setPassword(password);
       outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS, ClientPasswordHandler.class.getName());

       WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
       cxfEndpoint.getOutInterceptors().add(wssOut);
      }

      cxfEndpoint.getInInterceptors().add(new LoggingInInterceptor());
cxfEndpoint.getOutInterceptors().add(new LoggingOutInterceptor());

      return modelPort;
  }
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:39,代码来源:AbstractWebserviceTest.java

示例10: setUserCredentialsInContext

import javax.xml.ws.BindingProvider; //导入方法依赖的package包/类
public void setUserCredentialsInContext(BindingProvider client,
        String user, String password, Map<String, Setting> settings) {
    Map<String, Object> clientRequestContext = client.getRequestContext();
    clientRequestContext.put(getUsernameConstant(settings), user);
    clientRequestContext.put(getPasswordConstant(settings), password);
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:7,代码来源:BesDAO.java

示例11: setEndpointInContext

import javax.xml.ws.BindingProvider; //导入方法依赖的package包/类
public <T> void setEndpointInContext(BindingProvider client, String wsUrl) {
    Map<String, Object> clientRequestContext = client.getRequestContext();
    clientRequestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
            wsUrl);
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:6,代码来源:HeidelpayResponseServlet.java

示例12: ignoreErrors

import javax.xml.ws.BindingProvider; //导入方法依赖的package包/类
public static void ignoreErrors(BindingProvider bp) {
    Map<String, Object> requestContext = bp.getRequestContext();

    requestContext.put(SSL_SOCKET_FACTORY, getInsecureSSLSocketFactory());
    requestContext.put(HOSTNAME_VERIFIER, newNonVerifyingHostnameVerifier());
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:7,代码来源:IgnoreSslErrors.java

示例13: useTrustManager

import javax.xml.ws.BindingProvider; //导入方法依赖的package包/类
public static void useTrustManager(BindingProvider bp, TrustManager trustManager) {
    Map<String, Object> requestContext = bp.getRequestContext();

    requestContext.put(SSL_SOCKET_FACTORY, newTrustedSocketFactory(trustManager));
    requestContext.put(HOSTNAME_VERIFIER, newNonVerifyingHostnameVerifier());
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:7,代码来源:IgnoreSslErrors.java

示例14: createPort

import javax.xml.ws.BindingProvider; //导入方法依赖的package包/类
protected P createPort() throws Exception {
	
	String password = getDefaultPassword();
	String username = getDefaultUsername();
	String endpointUrl = getDefaultEndpointUrl();
	
	if (commandLine.hasOption('p')) {
		password = commandLine.getOptionValue('p');
	}
	if (commandLine.hasOption('u')) {
		username = commandLine.getOptionValue('u');
	}
	if (commandLine.hasOption('e')) {
		endpointUrl = commandLine.getOptionValue('e');
	}
	
	if (verbose) {
		System.out.println("Username: "+username);
		System.out.println("Password: <not shown>");
		System.out.println("Endpoint URL: "+endpointUrl);
	}

       // uncomment this if you want to use Fiddler or any other proxy
       //ProxySelector.setDefault(new MyProxySelector("127.0.0.1", 8888));
	
	P modelPort = createService().getPort(getPortClass());
	BindingProvider bp = (BindingProvider)modelPort;
	Map<String, Object> requestContext = bp.getRequestContext();
	requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointUrl);
	
	org.apache.cxf.endpoint.Client client = ClientProxy.getClient(modelPort);
	org.apache.cxf.endpoint.Endpoint cxfEndpoint = client.getEndpoint();
	
	Map<String,Object> wssProps = new HashMap<String,Object>();
	
	if (!commandLine.hasOption('a') || 
			(commandLine.hasOption('a') && WSHandlerConstants.USERNAME_TOKEN.equals(commandLine.getOptionValue('a')))) {
	
		wssProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
		wssProps.put(WSHandlerConstants.USER, username);
		wssProps.put(WSHandlerConstants.PASSWORD_TYPE, getPasswordType());
		wssProps.put(WSHandlerConstants.PW_CALLBACK_CLASS, ClientPasswordHandler.class.getName());
		ClientPasswordHandler.setPassword(password);
		
		WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(wssProps);
		cxfEndpoint.getOutInterceptors().add(wssOut);
	} else if (commandLine.hasOption('a') && "none".equals(commandLine.getOptionValue('a'))) {
		// Nothing to do
	} else {
		throw new IllegalArgumentException("Unknown authentication mechanism '"+commandLine.getOptionValue('a')+"'");
	}
	
	if (commandLine.hasOption('m')) {
		cxfEndpoint.getInInterceptors().add(new LoggingInInterceptor());
		cxfEndpoint.getOutInterceptors().add(new LoggingOutInterceptor());
	}

	return modelPort;
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:60,代码来源:AbstractWebServiceClient.java

示例15: createModelPort

import javax.xml.ws.BindingProvider; //导入方法依赖的package包/类
public ModelPortType createModelPort(String[] args) {
		String endpointUrl = DEFAULT_ENDPOINT_URL;
		
		if (args.length > 0) {
			endpointUrl = args[0];
		}

		System.out.println("Endpoint URL: "+endpointUrl);

        // uncomment this if you want to use Fiddler or any other proxy
//        ProxySelector.setDefault(new MyProxySelector("127.0.0.1", 8888));
		
		ModelService modelService = new ModelService();
		ModelPortType modelPort = modelService.getModelPort();
		BindingProvider bp = (BindingProvider)modelPort;
		Map<String, Object> requestContext = bp.getRequestContext();
		requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointUrl);

		org.apache.cxf.endpoint.Client client = ClientProxy.getClient(modelPort);

        HTTPConduit http = (HTTPConduit) client.getConduit();
        HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
        httpClientPolicy.setReceiveTimeout(300000L);
        http.setClient(httpClientPolicy);

        org.apache.cxf.endpoint.Endpoint cxfEndpoint = client.getEndpoint();
		
		Map<String,Object> outProps = new HashMap<String,Object>();
		
		outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
		outProps.put(WSHandlerConstants.USER, ADM_USERNAME);
		outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_DIGEST);
		outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS, ClientPasswordHandler.class.getName());
		
		WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
		cxfEndpoint.getOutInterceptors().add(wssOut);
        // enable the following to get client-side logging of outgoing requests and incoming responses
        //cxfEndpoint.getOutInterceptors().add(new LoggingOutInterceptor());
        //cxfEndpoint.getInInterceptors().add(new LoggingInInterceptor());

		return modelPort;
	}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:43,代码来源:AbstractTestForExchangeConnector.java


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