Search in sources :

Example 96 with Service

use of javax.xml.ws.Service in project wildfly by wildfly.

the class PojoEndpointAuthenticationTestCase method accessHelloWithUnauthorizedUser.

@Test
public void accessHelloWithUnauthorizedUser() 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, "user3");
    reqContext.put(BindingProvider.PASSWORD_PROPERTY, "password3");
    try {
        proxy.hello("World");
        Assert.fail("Test should fail, HTTP response '403: Forbidden' was expected");
    } catch (WebServiceException e) {
        // failure is expected
        Assert.assertTrue("String '403: Forbidden' was expected in " + e.getCause().getMessage(), e.getCause().getMessage().contains("403: Forbidden"));
    }
}
Also used : WebServiceException(javax.xml.ws.WebServiceException) Service(javax.xml.ws.Service) BindingProvider(javax.xml.ws.BindingProvider) URL(java.net.URL) Test(org.junit.Test)

Example 97 with Service

use of javax.xml.ws.Service in project wildfly by wildfly.

the class OnlyEjbInWarTestCase method testEJB3Endpoint.

@Test
public void testEJB3Endpoint() throws Exception {
    final QName serviceName = new QName("org.jboss.as.test.integration.ws.context.as1605", "EJB3EndpointService");
    final URL wsdlURL = new URL(baseUrl, "/as1605-customized/EJB3Endpoint?wsdl");
    final Service service = Service.create(wsdlURL, serviceName);
    final EndpointIface port = service.getPort(EndpointIface.class);
    final String result = port.echo("hello");
    Assert.assertEquals("EJB3 hello", result);
}
Also used : QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) URL(java.net.URL) Test(org.junit.Test)

Example 98 with Service

use of javax.xml.ws.Service in project wildfly by wildfly.

the class SimpleStatelessWebserviceEndpointTestCase method testSimpleStatelessWebserviceEndpoint.

@Test
public void testSimpleStatelessWebserviceEndpoint() throws Exception {
    final QName serviceName = new QName("org.jboss.as.test.integration.ws.ejb", "SimpleService");
    final URL wsdlURL = new URL(baseUrl, "/stateless-ws-endpoint-example/SimpleService/SimpleStatelessWebserviceEndpointImpl?wsdl");
    final Service service = Service.create(wsdlURL, serviceName);
    final SimpleStatelessWebserviceEndpointIface port = service.getPort(SimpleStatelessWebserviceEndpointIface.class);
    final String result = port.echo("hello");
    Assert.assertEquals("hello", result);
}
Also used : QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) URL(java.net.URL) Test(org.junit.Test)

Example 99 with Service

use of javax.xml.ws.Service in project wildfly by wildfly.

the class PojoEndpointTestCase method endpointLookup.

@Before
public void endpointLookup() throws Exception {
    QName serviceName = new QName("http://jbossws.org/basic", "POJOService");
    URL wsdlURL = new URL(baseUrl, "/jaxws-basic-pojo/POJOService?wsdl");
    Service service = Service.create(wsdlURL, serviceName);
    proxy = service.getPort(EndpointIface.class);
}
Also used : QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) URL(java.net.URL) Before(org.junit.Before)

Example 100 with Service

use of javax.xml.ws.Service in project wildfly by wildfly.

the class CdiInterceptorTestCase method getEjb3.

private EndpointIface getEjb3() throws Exception {
    final URL wsdlURL = new URL(baseUrl + "EJB3EndpointService/EJB3Endpoint?wsdl");
    final QName serviceName = new QName("http://org.jboss.test.ws/jbws3441", "EJB3EndpointService");
    final Service service = Service.create(wsdlURL, serviceName);
    return service.getPort(EndpointIface.class);
}
Also used : QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) URL(java.net.URL)

Aggregations

Service (javax.xml.ws.Service)138 URL (java.net.URL)125 QName (javax.xml.namespace.QName)91 Test (org.junit.Test)84 BindingProvider (javax.xml.ws.BindingProvider)39 WebServiceException (javax.xml.ws.WebServiceException)18 IOException (java.io.IOException)12 Bus (org.apache.cxf.Bus)12 OperateOnDeployment (org.jboss.arquillian.container.test.api.OperateOnDeployment)11 InsuranceService (com.salaboy.jbpm5.dev.guide.webservice.InsuranceService)10 HashMap (java.util.HashMap)10 ServiceIface (org.jboss.as.test.integration.ws.wsse.ServiceIface)10 UseNewBusFeature (org.jboss.wsf.stack.cxf.client.UseNewBusFeature)10 MalformedURLException (java.net.MalformedURLException)9 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)9 WrapThreadContextClassLoader (org.jboss.as.test.integration.ws.WrapThreadContextClassLoader)9 File (java.io.File)8 WSS4JOutInterceptor (org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor)8 SAAJOutInterceptor (org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor)7 Client (org.apache.cxf.endpoint.Client)7