Java Code Examples for org.apache.cxf.jaxws.JaxWsProxyFactoryBean#setProperties()

The following examples show how to use org.apache.cxf.jaxws.JaxWsProxyFactoryBean#setProperties() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AegisJaxWsTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
private void setupForTest(boolean sec) throws Exception {

        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
        factory.setServiceClass(AegisJaxWs.class);
        if (sec) {
            factory.setAddress("http://localhost:" + PORT + "/aegisJaxWsUN");
            WSS4JOutInterceptor wss4jOut = new WSS4JOutInterceptor();
            wss4jOut.setProperty("action", "UsernameToken");
            wss4jOut.setProperty("user", "alice");
            wss4jOut.setProperty("password", "pass");

            factory.setProperties(new HashMap<String, Object>());
            factory.getProperties().put("password", "pass");
            factory.getOutInterceptors().add(wss4jOut);
        } else {
            factory.setAddress("http://localhost:" + PORT + "/aegisJaxWs");
        }
        factory.getServiceFactory().setDataBinding(new AegisDatabinding());

        client = (AegisJaxWs)factory.create();
    }
 
Example 2
Source File: IntegrationBaseTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
protected Resource createClient(ReferenceParametersType refParams) {
    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();

    Map<String, Object> props = factory.getProperties();
    if (props == null) {
        props = new HashMap<>();
    }
    props.put("jaxb.additionalContextClasses",
            ExpressionType.class);
    factory.setProperties(props);

    factory.setBus(bus);
    factory.setServiceClass(Resource.class);
    factory.setAddress(RESOURCE_ADDRESS);
    Resource proxy = (Resource) factory.create();

    // Add reference parameters
    AddressingProperties addrProps = new AddressingProperties();
    EndpointReferenceType endpoint = new EndpointReferenceType();
    endpoint.setReferenceParameters(refParams);
    endpoint.setAddress(ContextUtils.getAttributedURI(RESOURCE_ADDRESS));
    addrProps.setTo(endpoint);
    ((BindingProvider) proxy).getRequestContext().put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES, addrProps);

    return proxy;
}
 
Example 3
Source File: SoapChannel.java    From BIMserver with GNU Affero General Public License v3.0 6 votes vote down vote up
public void connect(TokenHolder tokenHolder) {
	for (Class<? extends PublicInterface> interface1 : interfaces) {
		JaxWsProxyFactoryBean cpfb = new JaxWsProxyFactoryBean();
		cpfb.setServiceClass(interface1);
		cpfb.setAddress(address + "/" + interface1.getSimpleName());
		Map<String, Object> properties = new HashMap<String, Object>();
		properties.put("mtom-enabled", Boolean.TRUE);
		cpfb.setProperties(properties);
		
		PublicInterface serviceInterface = (PublicInterface) cpfb.create();
		
		client = ClientProxy.getClient(serviceInterface);
		HTTPConduit http = (HTTPConduit) client.getConduit();
		http.getClient().setConnectionTimeout(360000);
		http.getClient().setAllowChunking(false);
		http.getClient().setReceiveTimeout(320000);
		
		if (!useSoapHeaderSessions) {
			((BindingProvider) serviceInterface).getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY, Boolean.TRUE);
		}
		add(interface1.getName(), serviceInterface);
	}
	tokenHolder.registerTokenChangeListener(this);
	notifyOfConnect();
}
 
Example 4
Source File: XKMSClientFactory.java    From cxf with Apache License 2.0 5 votes vote down vote up
public static XKMSPortType create(String endpointAddress, Bus bus) {
    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    factory.setBus(bus);
    factory.setServiceClass(XKMSPortType.class);
    factory.setAddress(endpointAddress);

    Map<String, Object> properties = new HashMap<>();
    properties.put("jaxb.additionalContextClasses",
                   new Class[] {ResultDetails.class});
    factory.setProperties(properties);

    return (XKMSPortType)factory.create();
}