Package org.reficio.ws.builder

Examples of org.reficio.ws.builder.SoapBuilder


    public static void registerAutoResponderForAllServiceBindings(SoapServer server, int testServiceId, Wsdl parser) {
        for (QName bindingName : parser.getBindings()) {
            String contextPath = TestUtils.formatContextPath(testServiceId, bindingName);
            log.info(String.format("Registering auto responder for service [%d] undex context path [%s]", testServiceId, contextPath));
            SoapContext context = SoapContext.builder().exampleContent(true).build();
            SoapBuilder builder = parser.binding().name(bindingName).find();
            server.registerRequestResponder(contextPath, new AutoResponder(builder, context));
        }
    }
View Full Code Here


        log.info(String.format("------------------- TESTING SERVICE [%d] -----------------------", testServiceId));
        Wsdl parser = TestUtils.createParserForService(testServiceId);
        registerHandler(server, testServiceId, parser);

        for (QName bindingName : parser.getBindings()) {
            SoapBuilder builder = parser.binding().name(bindingName).find();
            String contextPath = TestUtils.formatContextPath(testServiceId, builder.getBindingName());
            String endpointUrl = formatEndpointAddress(contextPath);

            for (SoapOperation operation : builder.getOperations()) {
                if (postSoapAction == null) {
                    // test both with and without soap action
                    testOperation(clientBuilder, builder, operation, endpointUrl, Boolean.TRUE);
                    testOperation(clientBuilder, builder, operation, endpointUrl, Boolean.FALSE);
                } else {
View Full Code Here

    public SoapServer initServer() {
        validate();
        URL wsdlUrl = getWsdlUrl(testClass);
        Wsdl parser = Wsdl.parse(wsdlUrl);
        SoapBuilder builder = getBuilder(parser);
        server = construct();
        AutoResponder responder = getAutoResponder(builder);
        registerService(server, responder);

        server.start();
View Full Code Here

                .build();
        return new AutoResponder(builder, context);
    }

    private SoapBuilder getBuilder(Wsdl parser) {
        SoapBuilder builder = null;
        try {
            builder = parser.binding().name(binding).find();
        } catch (SoapException ex) {
            // ignore
        }
View Full Code Here

                .build();
        server.start();

        URL wsdlUrl = ResourceUtils.getResourceWithAbsolutePackagePath("/", "wsdl/stockquote-service.wsdl");
        Wsdl parser = Wsdl.parse(wsdlUrl);
        SoapBuilder builder = parser.binding().localPart("StockQuoteSoapBinding").find();
        AutoResponder responder = new AutoResponder(builder);

        server.registerRequestResponder("/service", responder);
        server.stop();
    }
View Full Code Here

                .build();
        server.start();

        URL wsdlUrl = ResourceUtils.getResourceWithAbsolutePackagePath("/", "wsdl/stockquote-service.wsdl");
        Wsdl parser = Wsdl.parse(wsdlUrl);
        final SoapBuilder builder = parser.binding().localPart("StockQuoteSoapBinding").find();

        AbstractResponder customResponder = new AbstractResponder(builder) {
            @Override
            public Source respond(SoapOperation invokedOperation, SoapMessage message) {
                try {
                    // build the response using builder
                    String response = builder.buildOutputMessage(invokedOperation);
                    // here you can tweak the response -> for example with XSLT
                    //...
                    return XmlUtils.xmlStringToSource(response);
                } catch (Exception e) {
                    // will automatically generate SOAP-FAULT
View Full Code Here

        SoapClient client = SoapClient.builder()
                .endpointUri(url)
                .build();

        Wsdl parser = Wsdl.parse(wsdlUrl);
        SoapBuilder soapBuilder = parser.binding().name(bindingName).find();

        // get the operation to invoked -> assumption our operation is the first operation in the WSDL's
        SoapOperation operation = soapBuilder.operation().name("GetLastTradePrice").find();

        // construct the request
        String request = soapBuilder.buildInputMessage(operation);
        // post the request to the server
        String response = client.post(request);
        // get the response
        String expectedResponse = soapBuilder.buildOutputMessage(operation, SoapContext.NO_CONTENT);

        assertTrue(XMLUnit.compareXML(expectedResponse, response).identical());
    }
View Full Code Here

    @Test
    @Server(wsdl = "classpath:wsdl/currency-convertor.wsdl", binding = "CurrencyConvertorSoap", port = 41414)
    public void testSoapMock_perMethodServer() {
        SoapClient client = SoapClient.builder().endpointUri("http://localhost:41414/service").build();
        SoapBuilder builder = Wsdl.parse(WSDL).binding().localPart("CurrencyConvertorSoap").find();
        SoapOperation operation = builder.operation().name("ConversionRate").find();
        String request = builder.buildInputMessage(operation);

        log.info("\n" + request);

        String response = client.post(request);
        log.info("\n" + response);
View Full Code Here

    }

    @Test
    public void testSoapMock_perClassServer() {
        SoapClient client = SoapClient.builder().endpointUri("http://localhost:51515/service").build();
        SoapBuilder builder = Wsdl.parse(WSDL).binding().localPart("CurrencyConvertorSoap").find();
        SoapOperation operation = builder.operation().name("ConversionRate").find();
        String request = builder.buildInputMessage(operation);

        log.info("\n" + request);

        String response = client.post(request);
        log.info("\n" + response);
View Full Code Here

TOP

Related Classes of org.reficio.ws.builder.SoapBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.