use of javax.xml.ws.BindingProvider in project wildfly by wildfly.
the class ReliableServiceTestCase method consumeOneWayService.
private void consumeOneWayService() throws Exception {
QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wsrm", "ReliableService");
URL wsdlURL = new URL(baseUrl, "ReliableService?wsdl");
Service service = Service.create(wsdlURL, serviceName, new UseNewBusFeature());
ReliableService proxy = (ReliableService) service.getPort(ReliableService.class);
BindingProvider bp = (BindingProvider) proxy;
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, new URL(baseUrl, "ReliableService").toString());
proxy.writeLogMessage();
}
use of javax.xml.ws.BindingProvider 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.BindingProvider 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.BindingProvider 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.BindingProvider 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