Search in sources :

Example 1 with SimpleService

use of org.jboss.test.ws.jaxws.samples.wsrm.generated.SimpleService in project jbossws-cxf by jbossws.

the class WSReliableMessagingWithAPITestCase method test.

@Test
@RunAsClient
public void test() throws Exception {
    final Bus bus = BusFactory.newInstance().createBus();
    BusFactory.setThreadDefaultBus(bus);
    try {
        QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wsrm", "SimpleService");
        URL wsdlURL = getResourceURL("jaxws/samples/wsrm/WEB-INF/wsdl/SimpleService.wsdl");
        Service service = Service.create(wsdlURL, serviceName);
        SimpleService proxy = (SimpleService) service.getPort(SimpleService.class);
        ((BindingProvider) proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, baseURL + "/jaxws-samples-wsrm-api/SimpleService");
        // request response call
        assertEquals("Hello World!", proxy.echo("Hello World!"));
        // one way call
        proxy.ping();
    } finally {
        bus.shutdown(true);
    }
}
Also used : Bus(org.apache.cxf.Bus) QName(javax.xml.namespace.QName) SimpleService(org.jboss.test.ws.jaxws.samples.wsrm.generated.SimpleService) Service(javax.xml.ws.Service) SimpleService(org.jboss.test.ws.jaxws.samples.wsrm.generated.SimpleService) URL(java.net.URL) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test) JBossWSTest(org.jboss.wsf.test.JBossWSTest)

Example 2 with SimpleService

use of org.jboss.test.ws.jaxws.samples.wsrm.generated.SimpleService in project jbossws-cxf by jbossws.

the class WSReliableMessagingWithAPITestCase method testWithFeature.

@Test
@RunAsClient
public void testWithFeature() throws Exception {
    final Bus bus = BusFactory.newInstance().createBus();
    BusFactory.setThreadDefaultBus(bus);
    try {
        QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wsrm", "SimpleService");
        URL wsdlURL = getResourceURL("jaxws/samples/wsrm/WEB-INF/wsdl/SimpleService.wsdl");
        Service service = Service.create(wsdlURL, serviceName);
        RMFeature feature = new RMFeature();
        RMAssertion rma = new RMAssertion();
        RMAssertion.BaseRetransmissionInterval bri = new RMAssertion.BaseRetransmissionInterval();
        bri.setMilliseconds(4000L);
        rma.setBaseRetransmissionInterval(bri);
        AcknowledgementInterval ai = new AcknowledgementInterval();
        ai.setMilliseconds(2000L);
        rma.setAcknowledgementInterval(ai);
        feature.setRMAssertion(rma);
        DestinationPolicyType dp = new DestinationPolicyType();
        AcksPolicyType ap = new AcksPolicyType();
        ap.setIntraMessageThreshold(0);
        dp.setAcksPolicy(ap);
        feature.setDestinationPolicy(dp);
        SimpleService proxy = (SimpleService) service.getPort(SimpleService.class, feature);
        ((BindingProvider) proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, baseURL + "/jaxws-samples-wsrm-api/SimpleService");
        // request response call
        assertEquals("Hello World!", proxy.echo("Hello World!"));
        // one way call
        proxy.ping();
    } finally {
        bus.shutdown(true);
    }
}
Also used : Bus(org.apache.cxf.Bus) AcksPolicyType(org.apache.cxf.ws.rm.manager.AcksPolicyType) RMAssertion(org.apache.cxf.ws.rmp.v200502.RMAssertion) AcknowledgementInterval(org.apache.cxf.ws.rmp.v200502.RMAssertion.AcknowledgementInterval) QName(javax.xml.namespace.QName) SimpleService(org.jboss.test.ws.jaxws.samples.wsrm.generated.SimpleService) Service(javax.xml.ws.Service) SimpleService(org.jboss.test.ws.jaxws.samples.wsrm.generated.SimpleService) RMFeature(org.apache.cxf.ws.rm.feature.RMFeature) DestinationPolicyType(org.apache.cxf.ws.rm.manager.DestinationPolicyType) URL(java.net.URL) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test) JBossWSTest(org.jboss.wsf.test.JBossWSTest)

Example 3 with SimpleService

use of org.jboss.test.ws.jaxws.samples.wsrm.generated.SimpleService in project jbossws-cxf by jbossws.

the class WSReliableMessagingWithAPITestCase method testWithFeatureProperty.

@Test
@RunAsClient
@WrapThreadContextClassLoader
public void testWithFeatureProperty() throws Exception {
    final Bus bus = BusFactory.newInstance().createBus();
    BusFactory.setThreadDefaultBus(bus);
    try {
        QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wsrm", "SimpleService");
        URL wsdlURL = getResourceURL("jaxws/samples/wsrm/WEB-INF/wsdl/SimpleService.wsdl");
        Service service = Service.create(wsdlURL, serviceName);
        SimpleService proxy = (SimpleService) service.getPort(SimpleService.class);
        ClientConfigurer configurer = ClientConfigUtil.resolveClientConfigurer();
        configurer.setConfigProperties(proxy, "META-INF/jaxws-client-config.xml", "Custom Client Config");
        ((BindingProvider) proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, baseURL + "/jaxws-samples-wsrm-api/SimpleService");
        // request response call
        assertEquals("Hello World!", proxy.echo("Hello World!"));
        // one way call
        proxy.ping();
    } finally {
        bus.shutdown(true);
    }
}
Also used : Bus(org.apache.cxf.Bus) QName(javax.xml.namespace.QName) SimpleService(org.jboss.test.ws.jaxws.samples.wsrm.generated.SimpleService) Service(javax.xml.ws.Service) SimpleService(org.jboss.test.ws.jaxws.samples.wsrm.generated.SimpleService) ClientConfigurer(org.jboss.ws.api.configuration.ClientConfigurer) URL(java.net.URL) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test) JBossWSTest(org.jboss.wsf.test.JBossWSTest) WrapThreadContextClassLoader(org.jboss.wsf.test.WrapThreadContextClassLoader)

Aggregations

URL (java.net.URL)3 QName (javax.xml.namespace.QName)3 Service (javax.xml.ws.Service)3 Bus (org.apache.cxf.Bus)3 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)3 SimpleService (org.jboss.test.ws.jaxws.samples.wsrm.generated.SimpleService)3 JBossWSTest (org.jboss.wsf.test.JBossWSTest)3 Test (org.junit.Test)3 RMFeature (org.apache.cxf.ws.rm.feature.RMFeature)1 AcksPolicyType (org.apache.cxf.ws.rm.manager.AcksPolicyType)1 DestinationPolicyType (org.apache.cxf.ws.rm.manager.DestinationPolicyType)1 RMAssertion (org.apache.cxf.ws.rmp.v200502.RMAssertion)1 AcknowledgementInterval (org.apache.cxf.ws.rmp.v200502.RMAssertion.AcknowledgementInterval)1 ClientConfigurer (org.jboss.ws.api.configuration.ClientConfigurer)1 WrapThreadContextClassLoader (org.jboss.wsf.test.WrapThreadContextClassLoader)1