Java Code Examples for org.apache.cxf.jaxws.JaxWsServerFactoryBean#setTransportId()
The following examples show how to use
org.apache.cxf.jaxws.JaxWsServerFactoryBean#setTransportId() .
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: StaxToDOMEncryptionIdentifierTest.java From cxf with Apache License 2.0 | 5 votes |
private Service createService() { // Create the Service JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean(); factory.setServiceBean(new EchoImpl()); factory.setAddress("local://Echo"); factory.setTransportId(LocalTransportFactory.TRANSPORT_ID); Server server = factory.create(); Service service = server.getEndpoint().getService(); service.getInInterceptors().add(new LoggingInInterceptor()); service.getOutInterceptors().add(new LoggingOutInterceptor()); return service; }
Example 2
Source File: StaxToDOMSamlTest.java From cxf with Apache License 2.0 | 5 votes |
private Service createService() { // Create the Service JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean(); factory.setServiceBean(new EchoImpl()); factory.setAddress("local://Echo"); factory.setTransportId(LocalTransportFactory.TRANSPORT_ID); Server server = factory.create(); Service service = server.getEndpoint().getService(); service.getInInterceptors().add(new LoggingInInterceptor()); service.getOutInterceptors().add(new LoggingOutInterceptor()); return service; }
Example 3
Source File: DOMToStaxSamlTest.java From cxf with Apache License 2.0 | 5 votes |
private Service createService() { // Create the Service JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean(); factory.setServiceBean(new EchoImpl()); factory.setAddress("local://Echo"); factory.setTransportId(LocalTransportFactory.TRANSPORT_ID); Server server = factory.create(); Service service = server.getEndpoint().getService(); service.getInInterceptors().add(new LoggingInInterceptor()); service.getOutInterceptors().add(new LoggingOutInterceptor()); return service; }
Example 4
Source File: StaxRoundTripTest.java From cxf with Apache License 2.0 | 5 votes |
private Service createService() { // Create the Service JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean(); factory.setServiceBean(new EchoImpl()); factory.setAddress("local://Echo"); factory.setTransportId(LocalTransportFactory.TRANSPORT_ID); Server server = factory.create(); Service service = server.getEndpoint().getService(); service.getInInterceptors().add(new LoggingInInterceptor()); service.getOutInterceptors().add(new LoggingOutInterceptor()); return service; }
Example 5
Source File: DOMToStaxSignatureIdentifierTest.java From cxf with Apache License 2.0 | 5 votes |
private Service createService() { // Create the Service JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean(); factory.setServiceBean(new EchoImpl()); factory.setAddress("local://Echo"); factory.setTransportId(LocalTransportFactory.TRANSPORT_ID); Server server = factory.create(); Service service = server.getEndpoint().getService(); service.getInInterceptors().add(new LoggingInInterceptor()); service.getOutInterceptors().add(new LoggingOutInterceptor()); return service; }
Example 6
Source File: DOMToStaxRoundTripTest.java From cxf with Apache License 2.0 | 5 votes |
private Service createService() { // Create the Service JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean(); factory.setServiceBean(new EchoImpl()); factory.setAddress("local://Echo"); factory.setTransportId(LocalTransportFactory.TRANSPORT_ID); Server server = factory.create(); Service service = server.getEndpoint().getService(); service.getInInterceptors().add(new LoggingInInterceptor()); service.getOutInterceptors().add(new LoggingOutInterceptor()); return service; }
Example 7
Source File: StaxToDOMSignatureIdentifierTest.java From cxf with Apache License 2.0 | 5 votes |
private Service createService() { // Create the Service JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean(); factory.setServiceBean(new EchoImpl()); factory.setAddress("local://Echo"); factory.setTransportId(LocalTransportFactory.TRANSPORT_ID); Server server = factory.create(); Service service = server.getEndpoint().getService(); service.getInInterceptors().add(new LoggingInInterceptor()); service.getOutInterceptors().add(new LoggingOutInterceptor()); return service; }
Example 8
Source File: DOMToStaxEncryptionIdentifierTest.java From cxf with Apache License 2.0 | 5 votes |
private Service createService() { // Create the Service JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean(); factory.setServiceBean(new EchoImpl()); factory.setAddress("local://Echo"); factory.setTransportId(LocalTransportFactory.TRANSPORT_ID); Server server = factory.create(); Service service = server.getEndpoint().getService(); service.getInInterceptors().add(new LoggingInInterceptor()); service.getOutInterceptors().add(new LoggingOutInterceptor()); return service; }
Example 9
Source File: StaxRoundTripActionTest.java From cxf with Apache License 2.0 | 5 votes |
private Service createService() { // Create the Service JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean(); factory.setServiceBean(new EchoImpl()); factory.setAddress("local://Echo"); factory.setTransportId(LocalTransportFactory.TRANSPORT_ID); Server server = factory.create(); Service service = server.getEndpoint().getService(); service.getInInterceptors().add(new LoggingInInterceptor()); service.getOutInterceptors().add(new LoggingOutInterceptor()); return service; }
Example 10
Source File: ServerJMS.java From cxf with Apache License 2.0 | 5 votes |
private static void launchCxfApi() { Object implementor = new HelloWorldImpl(); JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean(); svrFactory.setServiceClass(HelloWorld.class); svrFactory.setTransportId(JMSSpecConstants.SOAP_JMS_SPECIFICATION_TRANSPORTID); svrFactory.setAddress(JMS_ENDPOINT_URI); svrFactory.setServiceBean(implementor); svrFactory.setFeatures(Collections.singletonList(new LoggingFeature())); svrFactory.create(); }
Example 11
Source File: RoundTripTest.java From steady with Apache License 2.0 | 4 votes |
@Before public void setUpService() throws Exception { JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean(); factory.setServiceBean(new EchoImpl()); factory.setAddress("local://Echo"); factory.setTransportId(LocalTransportFactory.TRANSPORT_ID); Server server = factory.create(); Service service = server.getEndpoint().getService(); service.getInInterceptors().add(new SAAJInInterceptor()); service.getInInterceptors().add(new LoggingInInterceptor()); service.getOutInterceptors().add(new SAAJOutInterceptor()); service.getOutInterceptors().add(new LoggingOutInterceptor()); wsIn = new WSS4JInInterceptor(); wsIn.setProperty(WSHandlerConstants.SIG_PROP_FILE, "insecurity.properties"); wsIn.setProperty(WSHandlerConstants.DEC_PROP_FILE, "insecurity.properties"); wsIn.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS, TestPwdCallback.class.getName()); service.getInInterceptors().add(wsIn); wsOut = new WSS4JOutInterceptor(); wsOut.setProperty(WSHandlerConstants.SIG_PROP_FILE, "outsecurity.properties"); wsOut.setProperty(WSHandlerConstants.ENC_PROP_FILE, "outsecurity.properties"); wsOut.setProperty(WSHandlerConstants.USER, "myalias"); wsOut.setProperty("password", "myAliasPassword"); wsOut.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS, TestPwdCallback.class.getName()); service.getOutInterceptors().add(wsOut); // Create the client JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean(); proxyFac.setServiceClass(Echo.class); proxyFac.setAddress("local://Echo"); proxyFac.getClientFactoryBean().setTransportId(LocalTransportFactory.TRANSPORT_ID); echo = (Echo)proxyFac.create(); client = ClientProxy.getClient(echo); client.getInInterceptors().add(new LoggingInInterceptor()); client.getInInterceptors().add(wsIn); client.getInInterceptors().add(new SAAJInInterceptor()); client.getOutInterceptors().add(new LoggingOutInterceptor()); client.getOutInterceptors().add(wsOut); client.getOutInterceptors().add(new SAAJOutInterceptor()); }
Example 12
Source File: UserNameTokenAuthorizationTest.java From steady with Apache License 2.0 | 4 votes |
public void setUpService(String expectedRoles, boolean digest, boolean encryptUsernameTokenOnly) throws Exception { JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean(); factory.setServiceBean(new EchoImpl()); factory.setAddress("local://Echo"); factory.setTransportId(LocalTransportFactory.TRANSPORT_ID); Server server = factory.create(); Service service = server.getEndpoint().getService(); service.getInInterceptors().add(new SAAJInInterceptor()); service.getInInterceptors().add(new LoggingInInterceptor()); service.getOutInterceptors().add(new SAAJOutInterceptor()); service.getOutInterceptors().add(new LoggingOutInterceptor()); wsIn = new SimpleSubjectCreatingInterceptor(); wsIn.setSupportDigestPasswords(digest); wsIn.setProperty(WSHandlerConstants.SIG_PROP_FILE, "insecurity.properties"); wsIn.setProperty(WSHandlerConstants.DEC_PROP_FILE, "insecurity.properties"); wsIn.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS, TestPwdCallback.class.getName()); service.getInInterceptors().add(wsIn); SimpleAuthorizingInterceptor sai = new SimpleAuthorizingInterceptor(); sai.setMethodRolesMap(Collections.singletonMap("echo", expectedRoles)); service.getInInterceptors().add(sai); wsOut = new WSS4JOutInterceptor(); wsOut.setProperty(WSHandlerConstants.SIG_PROP_FILE, "outsecurity.properties"); wsOut.setProperty(WSHandlerConstants.ENC_PROP_FILE, "outsecurity.properties"); wsOut.setProperty(WSHandlerConstants.USER, "myalias"); if (digest) { wsOut.setProperty("password", "myAliasPassword"); } else { wsOut.setProperty(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT); } if (encryptUsernameTokenOnly) { wsOut.setProperty(WSHandlerConstants.ENCRYPTION_USER, "myalias"); wsOut.setProperty( WSHandlerConstants.ENCRYPTION_PARTS, "{Content}{" + WSConstants.WSSE_NS + "}UsernameToken" ); } wsOut.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS, TestPwdCallback.class.getName()); service.getOutInterceptors().add(wsOut); // Create the client JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean(); proxyFac.setServiceClass(Echo.class); proxyFac.setAddress("local://Echo"); proxyFac.getClientFactoryBean().setTransportId(LocalTransportFactory.TRANSPORT_ID); echo = (Echo)proxyFac.create(); ((BindingProvider)echo).getRequestContext().put(LocalConduit.DIRECT_DISPATCH, Boolean.TRUE); client = ClientProxy.getClient(echo); client.getInInterceptors().add(new LoggingInInterceptor()); client.getInInterceptors().add(wsIn); client.getInInterceptors().add(new SAAJInInterceptor()); client.getOutInterceptors().add(new LoggingOutInterceptor()); client.getOutInterceptors().add(wsOut); client.getOutInterceptors().add(new SAAJOutInterceptor()); }
Example 13
Source File: RoundTripTest.java From steady with Apache License 2.0 | 4 votes |
@Before public void setUpService() throws Exception { JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean(); factory.setServiceBean(new EchoImpl()); factory.setAddress("local://Echo"); factory.setTransportId(LocalTransportFactory.TRANSPORT_ID); Server server = factory.create(); Service service = server.getEndpoint().getService(); service.getInInterceptors().add(new SAAJInInterceptor()); service.getInInterceptors().add(new LoggingInInterceptor()); service.getOutInterceptors().add(new SAAJOutInterceptor()); service.getOutInterceptors().add(new LoggingOutInterceptor()); wsIn = new WSS4JInInterceptor(); wsIn.setProperty(WSHandlerConstants.SIG_PROP_FILE, "insecurity.properties"); wsIn.setProperty(WSHandlerConstants.DEC_PROP_FILE, "insecurity.properties"); wsIn.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS, TestPwdCallback.class.getName()); service.getInInterceptors().add(wsIn); wsOut = new WSS4JOutInterceptor(); wsOut.setProperty(WSHandlerConstants.SIG_PROP_FILE, "outsecurity.properties"); wsOut.setProperty(WSHandlerConstants.ENC_PROP_FILE, "outsecurity.properties"); wsOut.setProperty(WSHandlerConstants.USER, "myalias"); wsOut.setProperty("password", "myAliasPassword"); wsOut.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS, TestPwdCallback.class.getName()); service.getOutInterceptors().add(wsOut); // Create the client JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean(); proxyFac.setServiceClass(Echo.class); proxyFac.setAddress("local://Echo"); proxyFac.getClientFactoryBean().setTransportId(LocalTransportFactory.TRANSPORT_ID); echo = (Echo)proxyFac.create(); client = ClientProxy.getClient(echo); client.getInInterceptors().add(new LoggingInInterceptor()); client.getInInterceptors().add(wsIn); client.getInInterceptors().add(new SAAJInInterceptor()); client.getOutInterceptors().add(new LoggingOutInterceptor()); client.getOutInterceptors().add(wsOut); client.getOutInterceptors().add(new SAAJOutInterceptor()); }
Example 14
Source File: RoundTripTest.java From cxf with Apache License 2.0 | 4 votes |
@Before public void setUpService() throws Exception { JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean(); factory.setServiceBean(new EchoImpl()); factory.setAddress("local://Echo"); factory.setTransportId(LocalTransportFactory.TRANSPORT_ID); Server server = factory.create(); Service service = server.getEndpoint().getService(); service.getInInterceptors().add(new SAAJInInterceptor()); service.getInInterceptors().add(new LoggingInInterceptor()); service.getOutInterceptors().add(new SAAJOutInterceptor()); service.getOutInterceptors().add(new LoggingOutInterceptor()); wsIn = new WSS4JInInterceptor(); wsIn.setProperty(ConfigurationConstants.SIG_VER_PROP_FILE, "insecurity.properties"); wsIn.setProperty(ConfigurationConstants.DEC_PROP_FILE, "insecurity.properties"); wsIn.setProperty(ConfigurationConstants.PW_CALLBACK_CLASS, TestPwdCallback.class.getName()); service.getInInterceptors().add(wsIn); wsOut = new WSS4JOutInterceptor(); wsOut.setProperty(ConfigurationConstants.SIG_PROP_FILE, "outsecurity.properties"); wsOut.setProperty(ConfigurationConstants.ENC_PROP_FILE, "outsecurity.properties"); wsOut.setProperty(ConfigurationConstants.USER, "myalias"); wsOut.setProperty("password", "myAliasPassword"); wsOut.setProperty(ConfigurationConstants.PW_CALLBACK_CLASS, TestPwdCallback.class.getName()); service.getOutInterceptors().add(wsOut); // Create the client JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean(); proxyFac.setServiceClass(Echo.class); proxyFac.setAddress("local://Echo"); proxyFac.getClientFactoryBean().setTransportId(LocalTransportFactory.TRANSPORT_ID); echo = (Echo)proxyFac.create(); client = ClientProxy.getClient(echo); client.getInInterceptors().add(new LoggingInInterceptor()); client.getInInterceptors().add(wsIn); client.getInInterceptors().add(new SAAJInInterceptor()); client.getOutInterceptors().add(new LoggingOutInterceptor()); client.getOutInterceptors().add(wsOut); client.getOutInterceptors().add(new SAAJOutInterceptor()); }
Example 15
Source File: UserNameTokenAuthorizationTest.java From steady with Apache License 2.0 | 4 votes |
public void setUpService(String expectedRoles, boolean digest, boolean encryptUsernameTokenOnly) throws Exception { JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean(); factory.setServiceBean(new EchoImpl()); factory.setAddress("local://Echo"); factory.setTransportId(LocalTransportFactory.TRANSPORT_ID); Server server = factory.create(); Service service = server.getEndpoint().getService(); service.getInInterceptors().add(new SAAJInInterceptor()); service.getInInterceptors().add(new LoggingInInterceptor()); service.getOutInterceptors().add(new SAAJOutInterceptor()); service.getOutInterceptors().add(new LoggingOutInterceptor()); wsIn = new SimpleSubjectCreatingInterceptor(); wsIn.setSupportDigestPasswords(digest); wsIn.setProperty(WSHandlerConstants.SIG_PROP_FILE, "insecurity.properties"); wsIn.setProperty(WSHandlerConstants.DEC_PROP_FILE, "insecurity.properties"); wsIn.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS, TestPwdCallback.class.getName()); service.getInInterceptors().add(wsIn); SimpleAuthorizingInterceptor sai = new SimpleAuthorizingInterceptor(); sai.setMethodRolesMap(Collections.singletonMap("echo", expectedRoles)); service.getInInterceptors().add(sai); wsOut = new WSS4JOutInterceptor(); wsOut.setProperty(WSHandlerConstants.SIG_PROP_FILE, "outsecurity.properties"); wsOut.setProperty(WSHandlerConstants.ENC_PROP_FILE, "outsecurity.properties"); wsOut.setProperty(WSHandlerConstants.USER, "myalias"); if (digest) { wsOut.setProperty("password", "myAliasPassword"); } else { wsOut.setProperty(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT); } if (encryptUsernameTokenOnly) { wsOut.setProperty(WSHandlerConstants.ENCRYPTION_USER, "myalias"); wsOut.setProperty( WSHandlerConstants.ENCRYPTION_PARTS, "{Content}{" + WSConstants.WSSE_NS + "}UsernameToken" ); } wsOut.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS, TestPwdCallback.class.getName()); service.getOutInterceptors().add(wsOut); // Create the client JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean(); proxyFac.setServiceClass(Echo.class); proxyFac.setAddress("local://Echo"); proxyFac.getClientFactoryBean().setTransportId(LocalTransportFactory.TRANSPORT_ID); echo = (Echo)proxyFac.create(); ((BindingProvider)echo).getRequestContext().put(LocalConduit.DIRECT_DISPATCH, Boolean.TRUE); client = ClientProxy.getClient(echo); client.getInInterceptors().add(new LoggingInInterceptor()); client.getInInterceptors().add(wsIn); client.getInInterceptors().add(new SAAJInInterceptor()); client.getOutInterceptors().add(new LoggingOutInterceptor()); client.getOutInterceptors().add(wsOut); client.getOutInterceptors().add(new SAAJOutInterceptor()); }
Example 16
Source File: RoundTripTest.java From steady with Apache License 2.0 | 4 votes |
@Before public void setUpService() throws Exception { JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean(); factory.setServiceBean(new EchoImpl()); factory.setAddress("local://Echo"); factory.setTransportId(LocalTransportFactory.TRANSPORT_ID); Server server = factory.create(); Service service = server.getEndpoint().getService(); service.getInInterceptors().add(new SAAJInInterceptor()); service.getInInterceptors().add(new LoggingInInterceptor()); service.getOutInterceptors().add(new SAAJOutInterceptor()); service.getOutInterceptors().add(new LoggingOutInterceptor()); wsIn = new WSS4JInInterceptor(); wsIn.setProperty(WSHandlerConstants.SIG_PROP_FILE, "insecurity.properties"); wsIn.setProperty(WSHandlerConstants.DEC_PROP_FILE, "insecurity.properties"); wsIn.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS, TestPwdCallback.class.getName()); service.getInInterceptors().add(wsIn); wsOut = new WSS4JOutInterceptor(); wsOut.setProperty(WSHandlerConstants.SIG_PROP_FILE, "outsecurity.properties"); wsOut.setProperty(WSHandlerConstants.ENC_PROP_FILE, "outsecurity.properties"); wsOut.setProperty(WSHandlerConstants.USER, "myalias"); wsOut.setProperty("password", "myAliasPassword"); wsOut.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS, TestPwdCallback.class.getName()); service.getOutInterceptors().add(wsOut); // Create the client JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean(); proxyFac.setServiceClass(Echo.class); proxyFac.setAddress("local://Echo"); proxyFac.getClientFactoryBean().setTransportId(LocalTransportFactory.TRANSPORT_ID); echo = (Echo)proxyFac.create(); client = ClientProxy.getClient(echo); client.getInInterceptors().add(new LoggingInInterceptor()); client.getInInterceptors().add(wsIn); client.getInInterceptors().add(new SAAJInInterceptor()); client.getOutInterceptors().add(new LoggingOutInterceptor()); client.getOutInterceptors().add(wsOut); client.getOutInterceptors().add(new SAAJOutInterceptor()); }
Example 17
Source File: UserNameTokenAuthorizationTest.java From steady with Apache License 2.0 | 4 votes |
public void setUpService(String expectedRoles, boolean digest, boolean encryptUsernameTokenOnly) throws Exception { JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean(); factory.setServiceBean(new EchoImpl()); factory.setAddress("local://Echo"); factory.setTransportId(LocalTransportFactory.TRANSPORT_ID); Server server = factory.create(); Service service = server.getEndpoint().getService(); service.getInInterceptors().add(new SAAJInInterceptor()); service.getInInterceptors().add(new LoggingInInterceptor()); service.getOutInterceptors().add(new SAAJOutInterceptor()); service.getOutInterceptors().add(new LoggingOutInterceptor()); wsIn = new SimpleSubjectCreatingInterceptor(); wsIn.setSupportDigestPasswords(digest); wsIn.setProperty(WSHandlerConstants.SIG_PROP_FILE, "insecurity.properties"); wsIn.setProperty(WSHandlerConstants.DEC_PROP_FILE, "insecurity.properties"); wsIn.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS, TestPwdCallback.class.getName()); service.getInInterceptors().add(wsIn); SimpleAuthorizingInterceptor sai = new SimpleAuthorizingInterceptor(); sai.setMethodRolesMap(Collections.singletonMap("echo", expectedRoles)); service.getInInterceptors().add(sai); wsOut = new WSS4JOutInterceptor(); wsOut.setProperty(WSHandlerConstants.SIG_PROP_FILE, "outsecurity.properties"); wsOut.setProperty(WSHandlerConstants.ENC_PROP_FILE, "outsecurity.properties"); wsOut.setProperty(WSHandlerConstants.USER, "myalias"); if (digest) { wsOut.setProperty("password", "myAliasPassword"); } else { wsOut.setProperty(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT); } if (encryptUsernameTokenOnly) { wsOut.setProperty(WSHandlerConstants.ENCRYPTION_USER, "myalias"); wsOut.setProperty( WSHandlerConstants.ENCRYPTION_PARTS, "{Content}{" + WSConstants.WSSE_NS + "}UsernameToken" ); } wsOut.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS, TestPwdCallback.class.getName()); service.getOutInterceptors().add(wsOut); // Create the client JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean(); proxyFac.setServiceClass(Echo.class); proxyFac.setAddress("local://Echo"); proxyFac.getClientFactoryBean().setTransportId(LocalTransportFactory.TRANSPORT_ID); echo = (Echo)proxyFac.create(); ((BindingProvider)echo).getRequestContext().put(LocalConduit.DIRECT_DISPATCH, Boolean.TRUE); client = ClientProxy.getClient(echo); client.getInInterceptors().add(new LoggingInInterceptor()); client.getInInterceptors().add(wsIn); client.getInInterceptors().add(new SAAJInInterceptor()); client.getOutInterceptors().add(new LoggingOutInterceptor()); client.getOutInterceptors().add(wsOut); client.getOutInterceptors().add(new SAAJOutInterceptor()); }
Example 18
Source File: UserNameTokenAuthorizationTest.java From cxf with Apache License 2.0 | 4 votes |
public void setUpService(String expectedRoles, boolean digest, boolean encryptUsernameTokenOnly) throws Exception { JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean(); factory.setServiceBean(new EchoImpl()); factory.setAddress("local://Echo"); factory.setTransportId(LocalTransportFactory.TRANSPORT_ID); Server server = factory.create(); Service service = server.getEndpoint().getService(); service.getInInterceptors().add(new SAAJInInterceptor()); service.getInInterceptors().add(new LoggingInInterceptor()); service.getOutInterceptors().add(new SAAJOutInterceptor()); service.getOutInterceptors().add(new LoggingOutInterceptor()); wsIn = new SimpleSubjectCreatingInterceptor(); wsIn.setSupportDigestPasswords(digest); wsIn.setProperty(ConfigurationConstants.SIG_PROP_FILE, "insecurity.properties"); wsIn.setProperty(ConfigurationConstants.DEC_PROP_FILE, "insecurity.properties"); wsIn.setProperty(ConfigurationConstants.PW_CALLBACK_CLASS, TestPwdCallback.class.getName()); service.getInInterceptors().add(wsIn); SimpleAuthorizingInterceptor sai = new SimpleAuthorizingInterceptor(); sai.setMethodRolesMap(Collections.singletonMap("echo", expectedRoles)); service.getInInterceptors().add(sai); wsOut = new WSS4JOutInterceptor(); wsOut.setProperty(ConfigurationConstants.SIG_PROP_FILE, "outsecurity.properties"); wsOut.setProperty(ConfigurationConstants.ENC_PROP_FILE, "outsecurity.properties"); wsOut.setProperty(ConfigurationConstants.USER, "myalias"); if (digest) { wsOut.setProperty("password", "myAliasPassword"); } else { wsOut.setProperty(ConfigurationConstants.PASSWORD_TYPE, WSS4JConstants.PW_TEXT); } if (encryptUsernameTokenOnly) { wsOut.setProperty(ConfigurationConstants.ENCRYPTION_USER, "myalias"); wsOut.setProperty( ConfigurationConstants.ENCRYPTION_PARTS, "{Content}{" + WSS4JConstants.WSSE_NS + "}UsernameToken" ); } wsOut.setProperty(ConfigurationConstants.PW_CALLBACK_CLASS, TestPwdCallback.class.getName()); service.getOutInterceptors().add(wsOut); // Create the client JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean(); proxyFac.setServiceClass(Echo.class); proxyFac.setAddress("local://Echo"); proxyFac.getClientFactoryBean().setTransportId(LocalTransportFactory.TRANSPORT_ID); echo = (Echo)proxyFac.create(); ((BindingProvider)echo).getRequestContext().put(LocalConduit.DIRECT_DISPATCH, Boolean.TRUE); client = ClientProxy.getClient(echo); client.getInInterceptors().add(new LoggingInInterceptor()); client.getInInterceptors().add(wsIn); client.getInInterceptors().add(new SAAJInInterceptor()); client.getOutInterceptors().add(new LoggingOutInterceptor()); client.getOutInterceptors().add(wsOut); client.getOutInterceptors().add(new SAAJOutInterceptor()); }
Example 19
Source File: RoundTripTest.java From steady with Apache License 2.0 | 4 votes |
@Before public void setUpService() throws Exception { JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean(); factory.setServiceBean(new EchoImpl()); factory.setAddress("local://Echo"); factory.setTransportId(LocalTransportFactory.TRANSPORT_ID); Server server = factory.create(); Service service = server.getEndpoint().getService(); service.getInInterceptors().add(new SAAJInInterceptor()); service.getInInterceptors().add(new LoggingInInterceptor()); service.getOutInterceptors().add(new SAAJOutInterceptor()); service.getOutInterceptors().add(new LoggingOutInterceptor()); wsIn = new WSS4JInInterceptor(); wsIn.setProperty(WSHandlerConstants.SIG_PROP_FILE, "insecurity.properties"); wsIn.setProperty(WSHandlerConstants.DEC_PROP_FILE, "insecurity.properties"); wsIn.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS, TestPwdCallback.class.getName()); service.getInInterceptors().add(wsIn); wsOut = new WSS4JOutInterceptor(); wsOut.setProperty(WSHandlerConstants.SIG_PROP_FILE, "outsecurity.properties"); wsOut.setProperty(WSHandlerConstants.ENC_PROP_FILE, "outsecurity.properties"); wsOut.setProperty(WSHandlerConstants.USER, "myalias"); wsOut.setProperty("password", "myAliasPassword"); wsOut.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS, TestPwdCallback.class.getName()); service.getOutInterceptors().add(wsOut); // Create the client JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean(); proxyFac.setServiceClass(Echo.class); proxyFac.setAddress("local://Echo"); proxyFac.getClientFactoryBean().setTransportId(LocalTransportFactory.TRANSPORT_ID); echo = (Echo)proxyFac.create(); client = ClientProxy.getClient(echo); client.getInInterceptors().add(new LoggingInInterceptor()); client.getInInterceptors().add(wsIn); client.getInInterceptors().add(new SAAJInInterceptor()); client.getOutInterceptors().add(new LoggingOutInterceptor()); client.getOutInterceptors().add(wsOut); client.getOutInterceptors().add(new SAAJOutInterceptor()); }
Example 20
Source File: UserNameTokenAuthorizationTest.java From steady with Apache License 2.0 | 4 votes |
public void setUpService(String expectedRoles, boolean digest, boolean encryptUsernameTokenOnly) throws Exception { JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean(); factory.setServiceBean(new EchoImpl()); factory.setAddress("local://Echo"); factory.setTransportId(LocalTransportFactory.TRANSPORT_ID); Server server = factory.create(); Service service = server.getEndpoint().getService(); service.getInInterceptors().add(new SAAJInInterceptor()); service.getInInterceptors().add(new LoggingInInterceptor()); service.getOutInterceptors().add(new SAAJOutInterceptor()); service.getOutInterceptors().add(new LoggingOutInterceptor()); wsIn = new SimpleSubjectCreatingInterceptor(); wsIn.setSupportDigestPasswords(digest); wsIn.setProperty(WSHandlerConstants.SIG_PROP_FILE, "insecurity.properties"); wsIn.setProperty(WSHandlerConstants.DEC_PROP_FILE, "insecurity.properties"); wsIn.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS, TestPwdCallback.class.getName()); service.getInInterceptors().add(wsIn); SimpleAuthorizingInterceptor sai = new SimpleAuthorizingInterceptor(); sai.setMethodRolesMap(Collections.singletonMap("echo", expectedRoles)); service.getInInterceptors().add(sai); wsOut = new WSS4JOutInterceptor(); wsOut.setProperty(WSHandlerConstants.SIG_PROP_FILE, "outsecurity.properties"); wsOut.setProperty(WSHandlerConstants.ENC_PROP_FILE, "outsecurity.properties"); wsOut.setProperty(WSHandlerConstants.USER, "myalias"); if (digest) { wsOut.setProperty("password", "myAliasPassword"); } else { wsOut.setProperty(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT); } if (encryptUsernameTokenOnly) { wsOut.setProperty(WSHandlerConstants.ENCRYPTION_USER, "myalias"); wsOut.setProperty( WSHandlerConstants.ENCRYPTION_PARTS, "{Content}{" + WSConstants.WSSE_NS + "}UsernameToken" ); } wsOut.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS, TestPwdCallback.class.getName()); service.getOutInterceptors().add(wsOut); // Create the client JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean(); proxyFac.setServiceClass(Echo.class); proxyFac.setAddress("local://Echo"); proxyFac.getClientFactoryBean().setTransportId(LocalTransportFactory.TRANSPORT_ID); echo = (Echo)proxyFac.create(); ((BindingProvider)echo).getRequestContext().put(LocalConduit.DIRECT_DISPATCH, Boolean.TRUE); client = ClientProxy.getClient(echo); client.getInInterceptors().add(new LoggingInInterceptor()); client.getInInterceptors().add(wsIn); client.getInInterceptors().add(new SAAJInInterceptor()); client.getOutInterceptors().add(new LoggingOutInterceptor()); client.getOutInterceptors().add(wsOut); client.getOutInterceptors().add(new SAAJOutInterceptor()); }