List of usage examples for javax.xml.ws Service getPort
public <T> T getPort(Class<T> serviceEndpointInterface, WebServiceFeature... features)
From source file:org.apache.coheigea.cxf.kerberos.authentication.AuthenticationTest.java
@org.junit.Test public void testSpnego() throws Exception { SpringBusFactory bf = new SpringBusFactory(); URL busFile = AuthenticationTest.class.getResource("cxf-client.xml"); Bus bus = bf.createBus(busFile.toString()); SpringBusFactory.setDefaultBus(bus); SpringBusFactory.setThreadDefaultBus(bus); URL wsdl = AuthenticationTest.class.getResource("DoubleIt.wsdl"); Service service = Service.create(wsdl, SERVICE_QNAME); QName portQName = new QName(NAMESPACE, "DoubleItSpnegoTransportPort"); DoubleItPortType transportPort = service.getPort(portQName, DoubleItPortType.class); TestUtil.updateAddressPort(transportPort, PORT); doubleIt(transportPort, 25);// w w w . java 2 s . c o m }
From source file:org.apache.coheigea.cxf.ldap.authentication.AuthenticationTest.java
@org.junit.Test public void testAuthenticatedRequestViaSun() throws Exception { SpringBusFactory bf = new SpringBusFactory(); URL busFile = AuthenticationTest.class.getResource("cxf-client.xml"); Bus bus = bf.createBus(busFile.toString()); SpringBusFactory.setDefaultBus(bus); SpringBusFactory.setThreadDefaultBus(bus); URL wsdl = AuthenticationTest.class.getResource("DoubleIt.wsdl"); Service service = Service.create(wsdl, SERVICE_QNAME); QName portQName = new QName(NAMESPACE, "DoubleItTransportSunPort"); DoubleItPortType transportPort = service.getPort(portQName, DoubleItPortType.class); TestUtil.updateAddressPort(transportPort, PORT); Client client = ClientProxy.getClient(transportPort); client.getRequestContext().put("ws-security.username", "alice"); doubleIt(transportPort, 25);/* www . j av a 2s . c om*/ }
From source file:org.apache.coheigea.cxf.ldap.authentication.AuthenticationTest.java
@org.junit.Test public void testUnauthenticatedRequestviaSun() throws Exception { SpringBusFactory bf = new SpringBusFactory(); URL busFile = AuthenticationTest.class.getResource("cxf-client.xml"); Bus bus = bf.createBus(busFile.toString()); SpringBusFactory.setDefaultBus(bus); SpringBusFactory.setThreadDefaultBus(bus); URL wsdl = AuthenticationTest.class.getResource("DoubleIt.wsdl"); Service service = Service.create(wsdl, SERVICE_QNAME); QName portQName = new QName(NAMESPACE, "DoubleItTransportSunPort"); DoubleItPortType transportPort = service.getPort(portQName, DoubleItPortType.class); TestUtil.updateAddressPort(transportPort, PORT); Client client = ClientProxy.getClient(transportPort); client.getRequestContext().put("ws-security.username", "bob"); try {//w w w . j a v a2 s . c o m doubleIt(transportPort, 25); Assert.fail("Failure expected on bob"); } catch (Exception ex) { // expected } }
From source file:org.apache.coheigea.cxf.ldap.authentication.AuthenticationTest.java
@org.junit.Test public void testAuthenticatedRequestViaJetty() throws Exception { SpringBusFactory bf = new SpringBusFactory(); URL busFile = AuthenticationTest.class.getResource("cxf-client.xml"); Bus bus = bf.createBus(busFile.toString()); SpringBusFactory.setDefaultBus(bus); SpringBusFactory.setThreadDefaultBus(bus); URL wsdl = AuthenticationTest.class.getResource("DoubleIt.wsdl"); Service service = Service.create(wsdl, SERVICE_QNAME); QName portQName = new QName(NAMESPACE, "DoubleItTransportJettyPort"); DoubleItPortType transportPort = service.getPort(portQName, DoubleItPortType.class); TestUtil.updateAddressPort(transportPort, PORT); Client client = ClientProxy.getClient(transportPort); client.getRequestContext().put("ws-security.username", "alice"); doubleIt(transportPort, 25);/* w w w . j a va2s . c o m*/ }
From source file:org.apache.coheigea.cxf.ldap.authentication.AuthenticationTest.java
@org.junit.Test public void testUnauthenticatedRequestViaJetty() throws Exception { SpringBusFactory bf = new SpringBusFactory(); URL busFile = AuthenticationTest.class.getResource("cxf-client.xml"); Bus bus = bf.createBus(busFile.toString()); SpringBusFactory.setDefaultBus(bus); SpringBusFactory.setThreadDefaultBus(bus); URL wsdl = AuthenticationTest.class.getResource("DoubleIt.wsdl"); Service service = Service.create(wsdl, SERVICE_QNAME); QName portQName = new QName(NAMESPACE, "DoubleItTransportJettyPort"); DoubleItPortType transportPort = service.getPort(portQName, DoubleItPortType.class); TestUtil.updateAddressPort(transportPort, PORT); Client client = ClientProxy.getClient(transportPort); client.getRequestContext().put("ws-security.username", "bob"); try {/* www . j a v a 2 s . c o m*/ doubleIt(transportPort, 25); Assert.fail("Failure expected on bob"); } catch (Exception ex) { // expected } }
From source file:org.apache.coheigea.cxf.ldap.authentication.AuthenticationTest.java
@org.junit.Test public void testAuthenticatedRequestViaKaraf() throws Exception { SpringBusFactory bf = new SpringBusFactory(); URL busFile = AuthenticationTest.class.getResource("cxf-client.xml"); Bus bus = bf.createBus(busFile.toString()); SpringBusFactory.setDefaultBus(bus); SpringBusFactory.setThreadDefaultBus(bus); URL wsdl = AuthenticationTest.class.getResource("DoubleIt.wsdl"); Service service = Service.create(wsdl, SERVICE_QNAME); QName portQName = new QName(NAMESPACE, "DoubleItTransportKarafPort"); DoubleItPortType transportPort = service.getPort(portQName, DoubleItPortType.class); TestUtil.updateAddressPort(transportPort, PORT); Client client = ClientProxy.getClient(transportPort); client.getRequestContext().put("ws-security.username", "alice"); doubleIt(transportPort, 25);//from w w w . jav a2s. c o m }
From source file:org.apache.coheigea.cxf.ldap.authentication.AuthenticationTest.java
@org.junit.Test public void testUnauthenticatedRequestViaKaraf() throws Exception { SpringBusFactory bf = new SpringBusFactory(); URL busFile = AuthenticationTest.class.getResource("cxf-client.xml"); Bus bus = bf.createBus(busFile.toString()); SpringBusFactory.setDefaultBus(bus); SpringBusFactory.setThreadDefaultBus(bus); URL wsdl = AuthenticationTest.class.getResource("DoubleIt.wsdl"); Service service = Service.create(wsdl, SERVICE_QNAME); QName portQName = new QName(NAMESPACE, "DoubleItTransportKarafPort"); DoubleItPortType transportPort = service.getPort(portQName, DoubleItPortType.class); TestUtil.updateAddressPort(transportPort, PORT); Client client = ClientProxy.getClient(transportPort); client.getRequestContext().put("ws-security.username", "bob"); try {/*from w w w . j a v a2 s.c om*/ doubleIt(transportPort, 25); Assert.fail("Failure expected on bob"); } catch (Exception ex) { // expected } }
From source file:org.apache.coheigea.cxf.ldap.authorization.AuthorizationTest.java
@org.junit.Test public void testAuthorizedRequestViaJetty() throws Exception { SpringBusFactory bf = new SpringBusFactory(); URL busFile = AuthorizationTest.class.getResource("cxf-client.xml"); Bus bus = bf.createBus(busFile.toString()); SpringBusFactory.setDefaultBus(bus); SpringBusFactory.setThreadDefaultBus(bus); URL wsdl = AuthorizationTest.class.getResource("DoubleIt.wsdl"); Service service = Service.create(wsdl, SERVICE_QNAME); QName portQName = new QName(NAMESPACE, "DoubleItTransportJettyPort"); DoubleItPortType transportPort = service.getPort(portQName, DoubleItPortType.class); TestUtil.updateAddressPort(transportPort, PORT); Client client = ClientProxy.getClient(transportPort); client.getRequestContext().put("ws-security.username", "alice"); doubleIt(transportPort, 25);//from w ww. ja v a2 s. c o m }
From source file:org.apache.coheigea.cxf.ldap.authorization.AuthorizationTest.java
@org.junit.Test public void testUnauthorizedRequestViaJetty() throws Exception { SpringBusFactory bf = new SpringBusFactory(); URL busFile = AuthorizationTest.class.getResource("cxf-client.xml"); Bus bus = bf.createBus(busFile.toString()); SpringBusFactory.setDefaultBus(bus); SpringBusFactory.setThreadDefaultBus(bus); URL wsdl = AuthorizationTest.class.getResource("DoubleIt.wsdl"); Service service = Service.create(wsdl, SERVICE_QNAME); QName portQName = new QName(NAMESPACE, "DoubleItTransportJettyPort"); DoubleItPortType transportPort = service.getPort(portQName, DoubleItPortType.class); TestUtil.updateAddressPort(transportPort, PORT); Client client = ClientProxy.getClient(transportPort); client.getRequestContext().put("ws-security.username", "bob"); try {/*from w ww .jav a 2 s. c o m*/ doubleIt(transportPort, 25); Assert.fail("Failure expected on bob"); } catch (Exception ex) { // expected } }
From source file:org.apache.coheigea.cxf.ldap.authorization.AuthorizationTest.java
@org.junit.Test public void testAuthorizedRequestViaKaraf() throws Exception { SpringBusFactory bf = new SpringBusFactory(); URL busFile = AuthorizationTest.class.getResource("cxf-client.xml"); Bus bus = bf.createBus(busFile.toString()); SpringBusFactory.setDefaultBus(bus); SpringBusFactory.setThreadDefaultBus(bus); URL wsdl = AuthorizationTest.class.getResource("DoubleIt.wsdl"); Service service = Service.create(wsdl, SERVICE_QNAME); QName portQName = new QName(NAMESPACE, "DoubleItTransportKarafPort"); DoubleItPortType transportPort = service.getPort(portQName, DoubleItPortType.class); TestUtil.updateAddressPort(transportPort, PORT); Client client = ClientProxy.getClient(transportPort); client.getRequestContext().put("ws-security.username", "alice"); doubleIt(transportPort, 25);/* w w w. ja va 2s . c om*/ }