use of javax.xml.ws.Service in project wildfly by wildfly.
the class TestNoAddressingTestCase method usingWSDLFromDeployedEndpoint.
@Test
public void usingWSDLFromDeployedEndpoint() throws Exception {
QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wsaddressing", "AddressingService");
URL wsdlURL = new URL(baseUrl, "/jaxws-wsa/AddressingService?wsdl");
File wsdlFile = new File(this.getClass().getSimpleName() + ".wsdl");
downloadWSDLToFile(wsdlURL, wsdlFile);
Service service = Service.create(wsdlFile.toURI().toURL(), serviceName);
ServiceIface proxy = (ServiceIface) service.getPort(ServiceIface.class);
Assert.assertEquals(expectedResponse, proxy.sayHello(message));
wsdlFile.delete();
}
use of javax.xml.ws.Service in project wildfly by wildfly.
the class TestOptionalAddressingTestCase method usingWSDLFromDeployedEndpoint.
@Test
public void usingWSDLFromDeployedEndpoint() throws Exception {
QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wsaddressing", "AddressingService");
URL wsdlURL = new URL(baseUrl, "/jaxws-wsa/AddressingService?wsdl");
File wsdlFile = new File(this.getClass().getSimpleName() + ".wsdl");
TestNoAddressingTestCase.downloadWSDLToFile(wsdlURL, wsdlFile);
Service service = Service.create(wsdlFile.toURI().toURL(), serviceName);
ServiceIface proxy = (ServiceIface) service.getPort(ServiceIface.class);
Assert.assertEquals(expectedResponse, proxy.sayHello(message));
wsdlFile.delete();
}
use of javax.xml.ws.Service in project wildfly by wildfly.
the class EJBEndpointSecuredWSDLAccessTestCase method createService.
@Test
public void createService() throws Exception {
QName serviceName = new QName("http://jbossws.org/authenticationForWSDL", "EJB3ServiceForWSDL");
URL wsdlURL = new URL(baseUrl, "/jaxws-authentication-ejb3-for-wsdl/EJB3ServiceForWSDL?wsdl");
try {
Service service = Service.create(wsdlURL, serviceName);
EJBEndpointIface proxy = service.getPort(EJBEndpointIface.class);
Assert.fail("Proxy shouldn't be created because WSDL access should be secured");
} catch (WebServiceException e) {
// failure is expected
}
}
use of javax.xml.ws.Service in project wildfly by wildfly.
the class PojoEndpointAuthenticationTestCase method accessHelloWithValidUser2.
@Test
public void accessHelloWithValidUser2() throws Exception {
URL wsdlURL = new URL(baseUrl, "/jaxws-authentication-pojo/POJOAuthService?wsdl");
Service service = Service.create(wsdlURL, serviceName);
PojoEndpointIface proxy = service.getPort(PojoEndpointIface.class);
Map<String, Object> reqContext = ((BindingProvider) proxy).getRequestContext();
reqContext.put(BindingProvider.USERNAME_PROPERTY, "user2");
reqContext.put(BindingProvider.PASSWORD_PROPERTY, "password2");
final String result = proxy.hello("World");
Assert.assertEquals("Hello World!", result);
}
use of javax.xml.ws.Service in project wildfly by wildfly.
the class PojoEndpointAuthenticationTestCase method accessHelloWithoutUsernameAndPassord.
@Test
public void accessHelloWithoutUsernameAndPassord() throws Exception {
URL wsdlURL = new URL(baseUrl, "/jaxws-authentication-pojo/POJOAuthService?wsdl");
Service service = Service.create(wsdlURL, serviceName);
PojoEndpointIface proxy = service.getPort(PojoEndpointIface.class);
try {
proxy.hello("World");
Assert.fail("Test should fail, HTTP response '401: Unauthorized' was expected");
} catch (WebServiceException e) {
// failure is expected
Assert.assertTrue("HTTPException '401: Unauthorized' was expected", e.getCause().getMessage().contains("401: Unauthorized"));
}
}
Aggregations