Java Code Examples for javax.xml.ws.Service#addPort()

The following examples show how to use javax.xml.ws.Service#addPort() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: cxf   File: ClientServerTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testEchoProviderAsyncDecoupledEndpoints() throws Exception {
    String requestString = "<echo/>";
    Service service = Service.create(serviceName);
    service.addPort(fakePortName, javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING,
                    "http://localhost:" + PORT + "/SoapContext/AsyncEchoProvider");
    Dispatch<StreamSource> dispatcher = service.createDispatch(fakePortName,
                                                               StreamSource.class,
                                                               Service.Mode.PAYLOAD,
                                                               new LoggingFeature());

    Client client = ((DispatchImpl<StreamSource>)dispatcher).getClient();
    WSAddressingFeature wsAddressingFeature = new WSAddressingFeature();
    wsAddressingFeature.initialize(client, client.getBus());
    dispatcher.getRequestContext().put("org.apache.cxf.ws.addressing.replyto",
                                       "http://localhost:" + CLIENT_PORT
                                           + "/SoapContext/AsyncEchoClient");

    StreamSource request = new StreamSource(new ByteArrayInputStream(requestString.getBytes()));
    StreamSource response = dispatcher.invoke(request);

    assertEquals(requestString, StaxUtils.toString(response));
}
 
Example 2
Source Project: cxf   File: DispatchXMLClientServerTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testJAXBMESSAGE() throws Exception {
    Service service = Service.create(SERVICE_NAME);
    assertNotNull(service);
    service.addPort(PORT_NAME, "http://cxf.apache.org/bindings/xformat",
                    "http://localhost:"
                    + port
                    + "/XMLService/XMLDispatchPort");


    GreetMe gm = new GreetMe();
    gm.setRequestType("CXF");
    JAXBContext ctx = JAXBContext.newInstance(ObjectFactory.class);
    Dispatch<Object> disp = service.createDispatch(PORT_NAME, ctx, Service.Mode.MESSAGE);
    GreetMeResponse resp = (GreetMeResponse)disp.invoke(gm);
    assertNotNull(resp);
    assertEquals("Hello CXF", resp.getResponseType());

    try {
        disp.invoke(null);
        fail("Should have thrown a fault");
    } catch (WebServiceException ex) {
        //expected
    }
}
 
Example 3
Source Project: cxf   File: ClientServerTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testAddPort() throws Exception {
    Service service = Service.create(serviceName);
    service.addPort(fakePortName, "http://schemas.xmlsoap.org/soap/",
                    "http://localhost:" + PORT + "/SoapContext/SoapPort");
    Greeter greeter = service.getPort(fakePortName, Greeter.class);

    String response = new String("Bonjour");
    try {
        greeter.greetMe("test");
        String reply = greeter.sayHi();
        assertNotNull("no response received from service", reply);
        assertEquals(response, reply);
    } catch (UndeclaredThrowableException ex) {
        throw (Exception)ex.getCause();
    }
}
 
Example 4
@Test
public void testHelloSoapValidationFailsIfNameIsNull() throws Exception {
    final QName serviceName = new QName("http://bookworld.com", "BookWorld");
    final QName portName = new QName("http://bookworld.com", "BookWorldPort");
    final String address = "http://localhost:" + PORT + "/bwsoap";

    Service service = Service.create(serviceName);
    service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, address);

    BookWorld bwService = service.getPort(BookWorld.class);
    BookWithValidation bw = bwService.echoBook(new BookWithValidation("WS", "123"));
    assertEquals("123", bw.getId());
    try {
        bwService.echoBook(new BookWithValidation(null, "123"));
        fail("Validation failure expected");
    } catch (SOAPFaultException ex) {
        // complete
    }
}
 
Example 5
@Test
public void testFaultResponse() throws Exception {
    String address = "http://localhost:" + PORT + "/policytest";
    URL wsdlURL = new URL(address + "?wsdl");

    Service service = Service.create(wsdlURL, serviceName);
    service
        .addPort(new QName("http://handler.policy.ws.systest.cxf.apache.org/", "HelloPolicyServicePort"),
                 SOAPBinding.SOAP11HTTP_BINDING, address);
    HelloService port = service.getPort(new QName("http://handler.policy.ws.systest.cxf.apache.org/",
                                                  "HelloPolicyServicePort"), HelloService.class);
    Map<String, Object> context = ((BindingProvider)port).getRequestContext();
    context.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, address);

    context.put(SecurityConstants.CALLBACK_HANDLER, new CommonPasswordCallback());
    context.put(SecurityConstants.SIGNATURE_PROPERTIES, "alice.properties");
    context.put(SecurityConstants.SIGNATURE_USERNAME, "alice");

    try {
        port.checkHello("input");
        fail("Exception is expected");
    } catch (MyFault e) {
        assertEquals("Fault is not expected", "myMessage", e.getMessage());
    }

}
 
Example 6
Source Project: cxf   File: ClientServerMiscTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testDocLitWrappedCodeFirstServiceNoWsdlNoASM() throws Exception {
    try {
        setASM(false);
        QName portName = new QName("http://cxf.apache.org/systest/jaxws/DocLitWrappedCodeFirstService",
                                   "DocLitWrappedCodeFirstServicePort");
        QName servName = new QName("http://cxf.apache.org/systest/jaxws/DocLitWrappedCodeFirstService",
                                   "DocLitWrappedCodeFirstService");

        Service service = Service.create(servName);
        service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, ServerMisc.DOCLIT_CODEFIRST_URL);
        DocLitWrappedCodeFirstService port = service.getPort(portName,
                                                             DocLitWrappedCodeFirstService.class);
        runDocLitTest(port);
    } finally {
        setASM(true);
    }
}
 
Example 7
Source Project: servicemix   File: Client.java    License: Apache License 2.0 5 votes vote down vote up
public static void main(String args[]) throws Exception {
    try {

        SpringBusFactory bf = new SpringBusFactory();
        URL busFile = Client.class.getResource("ws_rm.xml");
        Bus bus = bf.createBus(busFile.toString());
        bf.setDefaultBus(bus);
        bus.getOutInterceptors().add(new MessageLossSimulator());
        // Endpoint Address
        Service service = Service.create(Client.class.getResource("/HelloWorld.wsdl"), SERVICE_NAME);

        String endpointAddress = "http://localhost:8181/cxf/HelloWorld";

        // Add a port to the Service
        service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING, endpointAddress);
        HelloWorld hw = service.getPort(HelloWorld.class);
        
        String[] names = new String[] {"Anne", "Bill", "Chris", "Daisy"};
        // make a sequence of 4 invocations
        for (int i = 0; i < 4; i++) {
            System.out.println("Calling HelloWorld service");
            System.out.println(hw.sayHi(names[i]));
        }

        // allow aynchronous resends to occur
        Thread.sleep(60 * 1000);
        bus.shutdown(true);

    } catch (Exception ex) {
        ex.printStackTrace();
    } finally {
        System.exit(0);
    }
}
 
Example 8
Source Project: cxf   File: DispatchSourceClient.java    License: Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {

        Server.main(new String[]{"inProcess"});

        Service service = Service.create(SERVICE_NAME);
        service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING, ADDRESS);

        Dispatch<Source> dispatch = service.createDispatch(PORT_NAME, Source.class, Service.Mode.PAYLOAD);

        String resp;
        Source response;

        System.out.println("Invoking sayHi...");
        setOperation(dispatch, SAYHI_OPERATION_NAME);
        response = dispatch.invoke(encodeSource(SAYHI_REQUEST_TEMPLATE, null));
        resp = decodeSource(response, PAYLOAD_NAMESPACE_URI, "responseType");
        System.out.println("Server responded with: " + resp);
        System.out.println();

        System.out.println("Invoking greetMe...");
        setOperation(dispatch, GREETME_OPERATION_NAME);
        response = dispatch.invoke(encodeSource(GREETME_REQUEST_TEMPLATE, System.getProperty("user.name")));
        resp = decodeSource(response, PAYLOAD_NAMESPACE_URI, "responseType");
        System.out.println("Server responded with: " + resp);
        System.out.println();

        try {
            System.out.println("Invoking pingMe, expecting exception...");
            setOperation(dispatch, PINGME_OPERATION_NAME);
            response = dispatch.invoke(encodeSource(PINGME_REQUEST_TEMPLATE, null));
        } catch (SOAPFaultException ex) {
            System.out.println("Expected exception: SoapFault has occurred: " + ex.getMessage());
        }
        System.exit(0);
    }
 
Example 9
Source Project: cxf   File: TransformFeatureTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testClientOutTransformation() {
    Service service = Service.create(SERVICE_NAME);
    String endpoint = "http://localhost:" + PORT + "/EchoContext/EchoPort";
    service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING, endpoint);

    Echo port = service.getPort(PORT_NAME, Echo.class);
    Client client = ClientProxy.getClient(port);
    XSLTOutInterceptor outInterceptor = new XSLTOutInterceptor(XSLT_REQUEST_PATH);
    client.getOutInterceptors().add(outInterceptor);
    String response = port.echo("test");
    assertTrue("Request was not transformed", response.contains(TRANSFORMED_CONSTANT));
}
 
Example 10
Source Project: fixflow   File: SecureWSConnector.java    License: Apache License 2.0 5 votes vote down vote up
public void execute(ExecutionContext executionContext) throws Exception {
    final QName serviceQName = new QName(serviceNS, serviceName);
    final QName portQName = new QName(serviceNS, portName);
    final Service service = Service.create(serviceQName);
    service.addPort(portQName, binding, endPointAddress);
    final Dispatch<Source> dispatch = service.createDispatch(portQName, Source.class, Service.Mode.MESSAGE);
    
    if (SOAPAction != null) {
      dispatch.getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, true);
      dispatch.getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY, SOAPAction);
    }
    
    this.response = dispatch.invoke(new StreamSource(new StringReader(request)));

}
 
Example 11
Source Project: cxf   File: ClientServerTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testBasicAuth() throws Exception {
    Service service = Service.create(serviceName);
    service.addPort(fakePortName, "http://schemas.xmlsoap.org/soap/",
                    "http://localhost:" + PORT + "/SoapContext/SoapPort");
    Greeter greeter = service.getPort(fakePortName, Greeter.class);

    try {
        //try the jaxws way
        BindingProvider bp = (BindingProvider)greeter;
        bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "BJ");
        bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "pswd");
        String s = greeter.greetMe("secure");
        assertEquals("Hello BJ", s);
        bp.getRequestContext().remove(BindingProvider.USERNAME_PROPERTY);
        bp.getRequestContext().remove(BindingProvider.PASSWORD_PROPERTY);

        //try setting on the conduit directly
        Client client = ClientProxy.getClient(greeter);
        HTTPConduit httpConduit = (HTTPConduit)client.getConduit();
        AuthorizationPolicy policy = new AuthorizationPolicy();
        policy.setUserName("BJ2");
        policy.setPassword("pswd");
        httpConduit.setAuthorization(policy);

        s = greeter.greetMe("secure");
        assertEquals("Hello BJ2", s);
    } catch (UndeclaredThrowableException ex) {
        throw (Exception)ex.getCause();
    }
}
 
Example 12
Source Project: tomee   File: CalculatorTest.java    License: Apache License 2.0 5 votes vote down vote up
public void testCalculatorViaWsInterfaceWithUsernameTokenHashedPassword() throws Exception {
    final Service calcService = Service.create(new URL("http://localhost:" + port + "/webservice-ws-security/CalculatorImplUsernameTokenHashedPassword?wsdl"),
            new QName("http://superbiz.org/wsdl", "CalculatorWsService"));
    assertNotNull(calcService);

    // for debugging (ie. TCPMon)
    calcService.addPort(new QName("http://superbiz.org/wsdl",
                    "CalculatorWsService2"), SOAPBinding.SOAP12HTTP_BINDING,
            "http://127.0.0.1:8204/CalculatorImplUsernameTokenHashedPassword");

    //        CalculatorWs calc = calcService.getPort(
    //        	new QName("http://superbiz.org/wsdl", "CalculatorWsService2"),
    //        	CalculatorWs.class);

    final CalculatorWs calc = calcService.getPort(CalculatorWs.class);

    final Client client = ClientProxy.getClient(calc);
    final Endpoint endpoint = client.getEndpoint();
    endpoint.getOutInterceptors().add(new SAAJOutInterceptor());

    final Map<String, Object> outProps = new HashMap<String, Object>();
    outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
    outProps.put(WSHandlerConstants.USER, "jane");
    outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_DIGEST);
    outProps.put(WSHandlerConstants.PW_CALLBACK_REF, new CallbackHandler() {

        @Override
        public void handle(final Callback[] callbacks) throws IOException, UnsupportedCallbackException {
            final WSPasswordCallback pc = (WSPasswordCallback) callbacks[0];
            pc.setPassword("waterfall");
        }
    });

    final WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
    endpoint.getOutInterceptors().add(wssOut);

    assertEquals(10, calc.sum(4, 6));
}
 
Example 13
Source Project: cxf   File: WSSecurityClientTest.java    License: Apache License 2.0 5 votes vote down vote up
private static Dispatch<Source> createUsernameTokenDispatcher(boolean decoupled, String port) {
    final Service service = Service.create(
        GREETER_SERVICE_QNAME
    );
    service.addPort(
        USERNAME_TOKEN_PORT_QNAME,
        decoupled ? SOAPBinding.SOAP11HTTP_BINDING : HTTPBinding.HTTP_BINDING,
        "http://localhost:" + port + "/GreeterService/UsernameTokenPort"
    );
    final Dispatch<Source> dispatcher = service.createDispatch(
        USERNAME_TOKEN_PORT_QNAME,
        Source.class,
        Service.Mode.MESSAGE,
        new AddressingFeature(decoupled, decoupled)
    );
    final java.util.Map<String, Object> requestContext =
        dispatcher.getRequestContext();
    requestContext.put(
        MessageContext.HTTP_REQUEST_METHOD,
        "POST"
    );
    if (decoupled) {
        HTTPConduit cond = (HTTPConduit)((DispatchImpl<?>)dispatcher).getClient().getConduit();
        cond.getClient().setDecoupledEndpoint("http://localhost:" + DEC_PORT + "/decoupled");
    }
    return dispatcher;
}
 
Example 14
Source Project: cxf   File: ClientServerXMLTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testAddPort() throws Exception {
    URL url = getClass().getResource("/wsdl/hello_world_xml_wrapped.wsdl");

    Service service = Service.create(url, wrapServiceName);
    assertNotNull(service);

    service.addPort(wrapFakePortName, "http://cxf.apache.org/bindings/xformat",
            "http://localhost:" + WRAP_PORT + "/XMLService/XMLPort");

    String response1 = new String("Hello ");
    String response2 = new String("Bonjour");

    org.apache.hello_world_xml_http.wrapped.Greeter greeter = service.getPort(wrapPortName,
            org.apache.hello_world_xml_http.wrapped.Greeter.class);
    updateAddressPort(greeter, WRAP_PORT);

    try {
        String username = System.getProperty("user.name");
        String reply = greeter.greetMe(username);

        assertNotNull("no response received from service", reply);
        assertEquals(response1 + username, reply);

        reply = greeter.sayHi();
        assertNotNull("no response received from service", reply);
        assertEquals(response2, reply);

        BindingProvider bp = (BindingProvider) greeter;
        Map<String, Object> responseContext = bp.getResponseContext();
        Integer responseCode = (Integer) responseContext.get(Message.RESPONSE_CODE);
        assertEquals(200, responseCode.intValue());

        greeter.greetMeOneWay(System.getProperty("user.name"));

    } catch (UndeclaredThrowableException ex) {
        throw (Exception) ex.getCause();
    }

}
 
Example 15
Source Project: cxf   File: MTOMTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testMTOMInHashMap() throws Exception {
    Service service = Service.create(new QName("http://foo", "bar"));
    service.addPort(new QName("http://foo", "bar"), SOAPBinding.SOAP11HTTP_BINDING,
                    ADDRESS);
    MTOMService port = service.getPort(new QName("http://foo", "bar"),
                                       MTOMService.class);

    final int count = 99;
    ObjectWithHashMapData data = port.getHashMapData(count);
    for (int y = 1;  y < count; y++) {
        byte[] bytes = data.getKeyData().get(Integer.toHexString(y));
        assertEquals(y, bytes.length);
    }
}
 
Example 16
Source Project: tomee   File: CalculatorTest.java    License: Apache License 2.0 5 votes vote down vote up
public void testCalculatorViaWsInterfaceWithTimestamp2ways() throws Exception {
    final Service calcService = Service.create(new URL("http://localhost:" + port + "/webservice-ws-security/CalculatorImplTimestamp2ways?wsdl"),
            new QName("http://superbiz.org/wsdl", "CalculatorWsService"));
    assertNotNull(calcService);

    // for debugging (ie. TCPMon)
    calcService.addPort(new QName("http://superbiz.org/wsdl",
                    "CalculatorWsService2"), SOAPBinding.SOAP12HTTP_BINDING,
            "http://127.0.0.1:8204/CalculatorImplTimestamp2ways");

    //        CalculatorWs calc = calcService.getPort(
    //        	new QName("http://superbiz.org/wsdl", "CalculatorWsService2"),
    //		CalculatorWs.class);

    final CalculatorWs calc = calcService.getPort(CalculatorWs.class);

    final Client client = ClientProxy.getClient(calc);
    final Endpoint endpoint = client.getEndpoint();
    endpoint.getOutInterceptors().add(new SAAJOutInterceptor());
    endpoint.getInInterceptors().add(new SAAJInInterceptor());

    final Map<String, Object> outProps = new HashMap<String, Object>();
    outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.TIMESTAMP);
    final WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
    endpoint.getOutInterceptors().add(wssOut);

    final Map<String, Object> inProps = new HashMap<String, Object>();
    inProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.TIMESTAMP);
    final WSS4JInInterceptor wssIn = new WSS4JInInterceptor(inProps);
    endpoint.getInInterceptors().add(wssIn);

    assertEquals(12, calc.multiply(3, 4));
}
 
Example 17
Source Project: cxf   File: ClientServerTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testEchoProviderAsync() throws Exception {
    String requestString = "<echo/>";
    Service service = Service.create(serviceName);
    service.addPort(fakePortName, javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING,
                    "http://localhost:" + PORT + "/SoapContext/AsyncEchoProvider");
    Dispatch<StreamSource> dispatcher = service.createDispatch(fakePortName,
                                                               StreamSource.class,
                                                               Service.Mode.PAYLOAD);

    StreamSource request = new StreamSource(new ByteArrayInputStream(requestString.getBytes()));
    StreamSource response = dispatcher.invoke(request);

    assertEquals(requestString, StaxUtils.toString(response));
}
 
Example 18
Source Project: tomee   File: CalculatorTest.java    License: Apache License 2.0 4 votes vote down vote up
public void testCalculatorViaWsInterfaceWithUsernameTokenPlainPasswordEncrypt() throws Exception {
    final Service calcService = Service.create(new URL("http://localhost:" + port + "/webservice-ws-security/CalculatorImplUsernameTokenPlainPasswordEncrypt?wsdl"),
            new QName("http://superbiz.org/wsdl", "CalculatorWsService"));
    assertNotNull(calcService);

    // for debugging (ie. TCPMon)
    calcService.addPort(new QName("http://superbiz.org/wsdl",
                    "CalculatorWsService2"), SOAPBinding.SOAP12HTTP_BINDING,
            "http://127.0.0.1:8204/CalculatorImplUsernameTokenPlainPasswordEncrypt");

    //        CalculatorWs calc = calcService.getPort(
    //        	new QName("http://superbiz.org/wsdl", "CalculatorWsService2"),
    //        	CalculatorWs.class);

    final CalculatorWs calc = calcService.getPort(CalculatorWs.class);

    final Client client = ClientProxy.getClient(calc);
    final Endpoint endpoint = client.getEndpoint();
    endpoint.getOutInterceptors().add(new SAAJOutInterceptor());

    final Map<String, Object> outProps = new HashMap<String, Object>();
    outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN
            + " " + WSHandlerConstants.ENCRYPT);
    outProps.put(WSHandlerConstants.USER, "jane");
    outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);
    outProps.put(WSHandlerConstants.PW_CALLBACK_REF, new CallbackHandler() {

        @Override
        public void handle(final Callback[] callbacks) throws IOException, UnsupportedCallbackException {
            final WSPasswordCallback pc = (WSPasswordCallback) callbacks[0];
            pc.setPassword("waterfall");
        }
    });
    outProps.put(WSHandlerConstants.ENC_PROP_FILE, "META-INF/CalculatorImplUsernameTokenPlainPasswordEncrypt-client.properties");
    outProps.put(WSHandlerConstants.ENCRYPTION_USER, "serveralias");

    final WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
    endpoint.getOutInterceptors().add(wssOut);

    assertEquals(10, calc.sum(4, 6));
}
 
Example 19
Source Project: cxf   File: DispatchClientServerTest.java    License: Apache License 2.0 4 votes vote down vote up
@Test
public void testJAXBObjectPAYLOADWithFeature() throws Exception {
    createBus("org/apache/cxf/systest/dispatch/client-config.xml");
    BusFactory.setThreadDefaultBus(bus);

    URL wsdl = getClass().getResource("/wsdl/hello_world.wsdl");
    assertNotNull(wsdl);

    String bindingId = "http://schemas.xmlsoap.org/wsdl/soap/";
    String endpointUrl = "http://localhost:" + greeterPort + "/SOAPDispatchService/SoapDispatchPort";

    Service service = Service.create(wsdl, SERVICE_NAME);
    service.addPort(PORT_NAME, bindingId, endpointUrl);
    assertNotNull(service);

    JAXBContext jc = JAXBContext.newInstance("org.apache.hello_world_soap_http.types");
    Dispatch<Object> disp = service.createDispatch(PORT_NAME, jc, Service.Mode.PAYLOAD);
    disp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                                 "http://localhost:"
                                 + greeterPort
                                 + "/SOAPDispatchService/SoapDispatchPort");

    String expected = "Hello Jeeves";
    GreetMe greetMe = new GreetMe();
    greetMe.setRequestType("Jeeves");

    Object response = disp.invoke(greetMe);
    assertNotNull(response);
    String responseValue = ((GreetMeResponse)response).getResponseType();
    assertEquals("Expected string, " + expected, expected, responseValue);

    assertEquals("Feature should be applied", 1, TestDispatchFeature.getCount());
    assertEquals("Feature based interceptors should be added",
                 1, TestDispatchFeature.getCount());

    assertEquals("Feature based In interceptors has be added to in chain.",
                 1, TestDispatchFeature.getInInterceptorCount());

    assertEquals("Feature based interceptors has to be added to out chain.",
                 1, TestDispatchFeature.getOutInterceptorCount());
    bus.shutdown(true);
}
 
Example 20
Source Project: cxf   File: AppleFindClientServerTest.java    License: Apache License 2.0 4 votes vote down vote up
@Test
public void testBasicConnection() throws Exception {
    QName serviceName = new QName("http://type_substitution.systest.cxf.apache.org/",
                                  "AppleFinder");
    QName portName = new QName("http://type_substitution.systest.cxf.apache.org/", "AppleFinderPort");

    Service service = Service.create(serviceName);
    String endpointAddress = "http://localhost:" + PORT + "/appleFind";

    service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, endpointAddress);



    AppleFinder finder = service.getPort(AppleFinder.class);
    assertEquals(2, finder.getApple("Fuji").size());
}