Package org.reficio.ws.client.core

Examples of org.reficio.ws.client.core.SoapClient


        Binding binding = soapBuilder.getBinding();
        BindingOperation op = binding.getBindingOperation(operation.getOperationName(), operation.getOperationInputName(),
                operation.getOperationOutputName());

        String response;
        SoapClient client = clientBuilder.buildClient(endpointUrl);
        if (postSoapAction.booleanValue()) {
            String soapAction = SoapUtils.getSOAPActionUri(op);
            response = postRequest(client, request, soapAction);
        } else {
            response = postRequest(client, request);
View Full Code Here


     * Here we're gonna simply post SOAP hardcoded message using SoapClient
     */
    @Test
    public void invoke_tradePriceRequest_hardcodedMessages() throws IOException, SAXException {
        String url = String.format("http://localhost:%d%s", port, contextPath);
        SoapClient client = SoapClient.builder()
                .endpointUri(url)
                .build();

        String request =
                "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:stoc=\"http://reficio.org/stockquote.wsdl\" xmlns:stoc1=\"http://reficio.org/stockquote.xsd\">\n" +
                        "   <soapenv:Header/>\n" +
                        "   <soapenv:Body>\n" +
                        "      <stoc:GetLastTradePrice>\n" +
                        "         <stoc1:TradePriceRequest>\n" +
                        "            <tickerSymbol>?</tickerSymbol>\n" +
                        "         </stoc1:TradePriceRequest>\n" +
                        "      </stoc:GetLastTradePrice>\n" +
                        "   </soapenv:Body>\n" +
                        "</soapenv:Envelope>";

        String response = client.post(request);

        String expectedResponse = "" +
                "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:stoc=\"http://reficio.org/stockquote.wsdl\" xmlns:stoc1=\"http://reficio.org/stockquote.xsd\">\n" +
                "   <soapenv:Header/>\n" +
                "   <soapenv:Body>\n" +
View Full Code Here

     */
    @Test
    public void invoke_tradePriceRequest_generatedMessages() throws Exception, SAXException, WSDLException {
        // construct the client
        String url = String.format("http://localhost:%d%s", port, contextPath);
        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

        String input = Wsdl.parse(url)
                .binding().name("{http://www.webserviceX.NET/}CurrencyConvertorSoap").find()
                .operation().soapAction("http://www.webserviceX.NET/ConversionRate").find()
                .buildInputMessage();

        SoapClient client = SoapClient.builder()
                .endpointUri("http://localhost:51515/service")
                .build();

        String response = client.post(input);

        XmlSlurper slurper = new XmlSlurper(XMLReaderFactory.createXMLReader());
        return slurper.parseText(response).toString();
    }
View Full Code Here

    public static SoapRule classRule = new SoapRule();

    @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

        exception.expectMessage(AnyOf.anyOf(
                StringContains.containsString("failed"),
                StringContains.containsString("timed out"))
        );

        SoapClient client = SoapClient.builder()
                .endpointUri("http://test.ch:9999")
                .connectTimeoutInMillis(1000)
                .build();
        client.post("<xml/>");
    }
View Full Code Here

TOP

Related Classes of org.reficio.ws.client.core.SoapClient

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.