Search in sources :

Example 6 with ServiceImpl

use of org.apache.cxf.jaxws.ServiceImpl in project cxf by apache.

the class MultiplexClientServerTest method testWithGetPortExtensionOverJMS.

@Test
public void testWithGetPortExtensionOverJMS() throws Exception {
    NumberFactoryService service = new NumberFactoryService();
    NumberFactory factory = service.getNumberFactoryPort();
    updateAddressPort(factory, PORT);
    // use values >= 30 to create JMS eprs - see NumberFactoryImpl.create
    // verify it is JMS, 999 for JMS will throw a fault
    W3CEndpointReference ref = factory.create("999");
    String s = NumberService.WSDL_LOCATION.toString();
    EmbeddedJMSBrokerLauncher.updateWsdlExtensors(BusFactory.getDefaultBus(), s);
    NumberService numService = new NumberService();
    assertNotNull("reference", ref);
    ServiceImpl serviceImpl = ServiceDelegateAccessor.get(numService);
    Number num = serviceImpl.getPort(ref, Number.class);
    try {
        num.isEven().isEven();
        fail("there should be a fault on val 999");
    } catch (Exception expected) {
        assertTrue("match on exception message " + expected.getMessage(), expected.getMessage().indexOf("999") != -1);
    }
    ClientProxy.getClient(num).getConduit().close();
    ref = factory.create("37");
    assertNotNull("reference", ref);
    num = serviceImpl.getPort(ref, Number.class);
    assertTrue("37 is not even", !num.isEven().isEven());
    ClientProxy.getClient(num).getConduit().close();
    ClientProxy.getClient(factory).getConduit().close();
}
Also used : NumberService(org.apache.cxf.factory_pattern.NumberService) NumberFactory(org.apache.cxf.factory_pattern.NumberFactory) Number(org.apache.cxf.factory_pattern.Number) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) ServiceImpl(org.apache.cxf.jaxws.ServiceImpl) NumberFactoryService(org.apache.cxf.factory_pattern.NumberFactoryService) IOException(java.io.IOException) Test(org.junit.Test)

Example 7 with ServiceImpl

use of org.apache.cxf.jaxws.ServiceImpl in project cxf by apache.

the class MAPTestBase method createGreeter.

public Greeter createGreeter(EndpointReferenceType target) throws Exception {
    ServiceImpl serviceImpl = ServiceDelegateAccessor.get(new SOAPService(getWSDLURL(), SERVICE_NAME));
    Greeter g = serviceImpl.getPort(target, Greeter.class);
    updateAddressPort(g, getPort());
    return g;
}
Also used : SOAPService(org.apache.hello_world_soap_http.SOAPService) ServiceImpl(org.apache.cxf.jaxws.ServiceImpl) Greeter(org.apache.hello_world_soap_http.Greeter)

Example 8 with ServiceImpl

use of org.apache.cxf.jaxws.ServiceImpl in project cxf by apache.

the class ManualHttpMulitplexClientServerTest method testWithGetPortExtensionHttp.

@Test
public void testWithGetPortExtensionHttp() throws Exception {
    NumberFactoryService service = new NumberFactoryService();
    NumberFactory factory = service.getNumberFactoryPort();
    updateAddressPort(factory, PORT);
    W3CEndpointReference w3cEpr = factory.create("20");
    EndpointReferenceType numberTwoRef = ProviderImpl.convertToInternal(w3cEpr);
    assertNotNull("reference", numberTwoRef);
    // use getPort with epr api on service
    NumberService numService = new NumberService();
    ServiceImpl serviceImpl = ServiceDelegateAccessor.get(numService);
    Number num = serviceImpl.getPort(numberTwoRef, Number.class);
    assertTrue("20 is even", num.isEven().isEven());
    w3cEpr = factory.create("23");
    EndpointReferenceType numberTwentyThreeRef = ProviderImpl.convertToInternal(w3cEpr);
    num = serviceImpl.getPort(numberTwentyThreeRef, Number.class);
    assertTrue("23 is not even", !num.isEven().isEven());
}
Also used : NumberService(org.apache.cxf.factory_pattern.NumberService) NumberFactory(org.apache.cxf.factory_pattern.NumberFactory) EndpointReferenceType(org.apache.cxf.ws.addressing.EndpointReferenceType) Number(org.apache.cxf.factory_pattern.Number) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) ServiceImpl(org.apache.cxf.jaxws.ServiceImpl) NumberFactoryService(org.apache.cxf.factory_pattern.NumberFactoryService) Test(org.junit.Test)

Example 9 with ServiceImpl

use of org.apache.cxf.jaxws.ServiceImpl in project cxf by apache.

the class MultiplexClientServerTest method testWithGetPortExtensionHttp.

@Test
public void testWithGetPortExtensionHttp() throws Exception {
    NumberFactoryService service = new NumberFactoryService();
    NumberFactory factory = service.getNumberFactoryPort();
    updateAddressPort(factory, PORT);
    NumberService numService = new NumberService();
    ServiceImpl serviceImpl = ServiceDelegateAccessor.get(numService);
    W3CEndpointReference numberTwoRef = factory.create("20");
    assertNotNull("reference", numberTwoRef);
    Number num = serviceImpl.getPort(numberTwoRef, Number.class);
    assertTrue("20 is even", num.isEven().isEven());
    close(num);
    W3CEndpointReference numberTwentyThreeRef = factory.create("23");
    num = serviceImpl.getPort(numberTwentyThreeRef, Number.class);
    assertTrue("23 is not even", !num.isEven().isEven());
    close(num);
    close(factory);
}
Also used : NumberService(org.apache.cxf.factory_pattern.NumberService) NumberFactory(org.apache.cxf.factory_pattern.NumberFactory) Number(org.apache.cxf.factory_pattern.Number) ServiceImpl(org.apache.cxf.jaxws.ServiceImpl) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) NumberFactoryService(org.apache.cxf.factory_pattern.NumberFactoryService) Test(org.junit.Test)

Example 10 with ServiceImpl

use of org.apache.cxf.jaxws.ServiceImpl in project cxf by apache.

the class MultiplexHttpAddressClientServerTest method testWithGetPortExtensionHttp.

@Test
public void testWithGetPortExtensionHttp() throws Exception {
    NumberFactoryService service = new NumberFactoryService();
    NumberFactory factory = service.getNumberFactoryPort();
    updateAddressPort(factory, PORT);
    NumberService numService = new NumberService();
    ServiceImpl serviceImpl = ServiceDelegateAccessor.get(numService);
    W3CEndpointReference numberTwoRef = factory.create("20");
    assertNotNull("reference", numberTwoRef);
    Number num = serviceImpl.getPort(numberTwoRef, Number.class);
    assertTrue("20 is even", num.isEven().isEven());
    W3CEndpointReference numberTwentyThreeRef = factory.create("23");
    num = serviceImpl.getPort(numberTwentyThreeRef, Number.class);
    assertTrue("23 is not even", !num.isEven().isEven());
}
Also used : NumberService(org.apache.cxf.factory_pattern.NumberService) NumberFactory(org.apache.cxf.factory_pattern.NumberFactory) Number(org.apache.cxf.factory_pattern.Number) ServiceImpl(org.apache.cxf.jaxws.ServiceImpl) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) NumberFactoryService(org.apache.cxf.factory_pattern.NumberFactoryService) Test(org.junit.Test)

Aggregations

ServiceImpl (org.apache.cxf.jaxws.ServiceImpl)14 Test (org.junit.Test)11 Source (javax.xml.transform.Source)7 DOMSource (javax.xml.transform.dom.DOMSource)7 AbstractJaxWsTest (org.apache.cxf.jaxws.AbstractJaxWsTest)7 W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)4 Number (org.apache.cxf.factory_pattern.Number)4 NumberFactory (org.apache.cxf.factory_pattern.NumberFactory)4 NumberFactoryService (org.apache.cxf.factory_pattern.NumberFactoryService)4 NumberService (org.apache.cxf.factory_pattern.NumberService)4 MessageReplayObserver (org.apache.cxf.jaxws.MessageReplayObserver)4 Document (org.w3c.dom.Document)4 DispatchImpl (org.apache.cxf.jaxws.DispatchImpl)3 BindingOperationInfo (org.apache.cxf.service.model.BindingOperationInfo)3 Service (javax.xml.ws.Service)2 Bus (org.apache.cxf.Bus)2 IOException (java.io.IOException)1 Field (java.lang.reflect.Field)1 QName (javax.xml.namespace.QName)1 WebServiceException (javax.xml.ws.WebServiceException)1