use of javax.xml.ws.Service in project wildfly by wildfly.
the class Usecase2TestCase method testAnonymousEndpoint.
@Test
public void testAnonymousEndpoint() throws Exception {
final QName serviceName = new QName("org.jboss.as.test.integration.ws.anonymousPojos", "AnonymousPOJOService");
final URL wsdlURL = new URL(baseUrl, "/anonymous-pojo-usecase2/AnonymousPOJOService?wsdl");
final Service service = Service.create(wsdlURL, serviceName);
final POJOIface port = service.getPort(POJOIface.class);
final String result = port.echo("hello");
Assert.assertEquals("hello from anonymous POJO", result);
}
use of javax.xml.ws.Service in project wildfly by wildfly.
the class EJBEndpointAuthenticationTestCase method accessHelloWithUnauthorizedUser.
@Test
public void accessHelloWithUnauthorizedUser() throws Exception {
URL wsdlURL = new URL(baseUrl, "/jaxws-authentication-ejb3/EJB3AuthService?wsdl");
Service service = Service.create(wsdlURL, serviceName);
EJBEndpointIface proxy = service.getPort(EJBEndpointIface.class);
Map<String, Object> reqContext = ((BindingProvider) proxy).getRequestContext();
reqContext.put(BindingProvider.USERNAME_PROPERTY, "user2");
reqContext.put(BindingProvider.PASSWORD_PROPERTY, "password2");
try {
proxy.hello("World");
Assert.fail("Test should fail, user shouldn't be allowed to invoke that method");
} catch (WebServiceException e) {
// failure is expected
Assert.assertEquals(getNotAllowedExceptionMessage("hello"), e.getCause().getMessage());
}
}
use of javax.xml.ws.Service in project wildfly by wildfly.
the class EJBEndpointAuthenticationTestCase method accessHelloForNoneWithValidRole3.
@Test
public void accessHelloForNoneWithValidRole3() throws Exception {
URL wsdlURL = new URL(baseUrl, "/jaxws-authentication-ejb3/EJB3AuthService?wsdl");
Service service = Service.create(wsdlURL, serviceName);
EJBEndpointIface proxy = service.getPort(EJBEndpointIface.class);
Map<String, Object> reqContext = ((BindingProvider) proxy).getRequestContext();
reqContext.put(BindingProvider.USERNAME_PROPERTY, "user3");
reqContext.put(BindingProvider.PASSWORD_PROPERTY, "password3");
try {
proxy.helloForNone("World");
Assert.fail("Test should fail, user shouldn't be allowed to invoke that method");
} catch (WebServiceException e) {
// failure is expected
Assert.assertEquals(getNotAllowedExceptionMessage("helloForNone"), e.getCause().getMessage());
}
}
use of javax.xml.ws.Service in project wildfly by wildfly.
the class EJBEndpointAuthenticationTestCase method accessHelloForRolesWithValidRole2.
@Test
public void accessHelloForRolesWithValidRole2() throws Exception {
URL wsdlURL = new URL(baseUrl, "/jaxws-authentication-ejb3/EJB3AuthService?wsdl");
Service service = Service.create(wsdlURL, serviceName);
EJBEndpointIface proxy = service.getPort(EJBEndpointIface.class);
Map<String, Object> reqContext = ((BindingProvider) proxy).getRequestContext();
reqContext.put(BindingProvider.USERNAME_PROPERTY, "user2");
reqContext.put(BindingProvider.PASSWORD_PROPERTY, "password2");
final String result = proxy.helloForRoles("World");
Assert.assertEquals("Hello World!", result);
}
use of javax.xml.ws.Service in project wildfly by wildfly.
the class TestNoAddressingTestCase method getServicePortFromWSDL.
private ServiceIface getServicePortFromWSDL(String wsdlFileName) throws MalformedURLException {
QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wsaddressing", "AddressingService");
File wsdlFile = new File(System.getProperty("jbossas.ts.submodule.dir") + "/src/test/java/org/jboss/as/test/integration/ws/wsa/" + wsdlFileName);
URL wsdlURL = wsdlFile.toURI().toURL();
Service service = Service.create(wsdlURL, serviceName);
ServiceIface proxy = (ServiceIface) service.getPort(ServiceIface.class);
BindingProvider bp = (BindingProvider) proxy;
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, new URL(baseUrl, "/jaxws-wsa/AddressingService").toString());
return proxy;
}
Aggregations