Package org.jibx.ws.wsdl

Examples of org.jibx.ws.wsdl.WsdlLocationToRequestUrlAdapter


                    if (wsdlStream == null) {
                        throw new WsConfigurationException("Unable to open WSDL file '" + sdef.getWsdlFilepath() + "'");
                    }
                    WsdlProvider wsdlProvider = new InputStreamWsdlProvider(wsdlStream);
                    if (sdef.getWsdlLocationTransform()) {
                        wsdlProvider = new WsdlLocationToRequestUrlAdapter(wsdlProvider);
                    }
                    setWsdlProvider(wsdlProvider);
                }
            } catch (IOException e) {
                throw new WsConfigurationException("Error reading WSDL file '" + sdef.getWsdlFilepath() + "'");
View Full Code Here


    /** Tests relative URL. */
    @Test
    public void givenWsdlWithRelativeUrl_writeWsdl_shouldReturnBaseUrlFromRequestPlusRelativeUrl() throws Exception {
        String initialWsdl = wsdlWithLocation("/example/service");
        WsdlLocationToRequestUrlAdapter adapter = createAdapter(initialWsdl);
        ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
        adapter.writeWSDL(baos, request);
        String responseWsdl = new String(baos.toByteArray());

        String expectedWsdl = wsdlWithLocation("http://test.example.com:80/example/service");
        XMLAssert.assertXMLEqual(expectedWsdl, responseWsdl);
    }
View Full Code Here

    /** Tests absolute URL. */
    @Test
    public void givenWsdlWithAbsoluteUrl_writeWsdl_shouldReturnUrlWithBaseUrlReplaced() throws Exception {
        String initialWsdl = wsdlWithLocation("http://localhost:8081/example/service");
        WsdlLocationToRequestUrlAdapter adapter = createAdapter(initialWsdl);
        ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
        adapter.writeWSDL(baos, request);
        String responseWsdl = new String(baos.toByteArray());

        String expectedWsdl = wsdlWithLocation("http://test.example.com:80/example/service");
        XMLAssert.assertXMLEqual(expectedWsdl, responseWsdl);
    }
View Full Code Here

   
    /** Tests absolute URL. */
    @Test
    public void givenWsdlWithUnknownUrlFormat_writeWsdl_shouldReturnInitialUrl() throws Exception {
        String initialWsdl = wsdlWithLocation("service");
        WsdlLocationToRequestUrlAdapter adapter = createAdapter(initialWsdl);
        ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
        adapter.writeWSDL(baos, request);
        String responseWsdl = new String(baos.toByteArray());

        XMLAssert.assertXMLEqual(initialWsdl, responseWsdl);
    }
View Full Code Here

   
    /** Tests caching. */
    @Test
    public void givenWsdlAdapter_whenWsdlIsRequestedTwice_shouldReturnAdaptedWsdl() throws Exception {
        String initialWsdl = wsdlWithLocation("/example/service");
        WsdlLocationToRequestUrlAdapter adapter = createAdapter(initialWsdl);
        ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
        adapter.writeWSDL(baos, request);
        baos = new ByteArrayOutputStream(1024);
        adapter.writeWSDL(baos, request);
        String responseWsdl = new String(baos.toByteArray());

        String expectedWsdl = wsdlWithLocation("http://test.example.com:80/example/service");
        XMLAssert.assertXMLEqual(expectedWsdl, responseWsdl);
    }
View Full Code Here

        File wsdlFile = new File(WSDL_MULTI_LOC_FILE_PATH);
        baseWsdl = FileUtils.readFileToString(wsdlFile);
        String initialWsdl = baseWsdl.replace("$serviceLocation1$", "/service1");
        initialWsdl = initialWsdl.replace("$serviceLocation2$", "/example2/service2");
        initialWsdl = initialWsdl.replace("$serviceLocation3$", "http://foo.com/baa");
        WsdlLocationToRequestUrlAdapter adapter = createAdapter(initialWsdl);
        ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
        adapter.writeWSDL(baos, request);
        baos = new ByteArrayOutputStream(1024);
        adapter.writeWSDL(baos, request);
        String responseWsdl = new String(baos.toByteArray());

        String expectedWsdl = baseWsdl.replace("$serviceLocation1$", "http://test.example.com:80/service1");
        expectedWsdl = expectedWsdl.replace("$serviceLocation2$", "http://test.example.com:80/example2/service2");
        expectedWsdl = expectedWsdl.replace("$serviceLocation3$", "http://test.example.com:80/baa");
View Full Code Here

        return baseWsdl.replace("$serviceLocation$", location);
    }
   
    private WsdlLocationToRequestUrlAdapter createAdapter(String wsdl) throws IOException {
        InputStreamWsdlProvider wsdlProvider = new InputStreamWsdlProvider(new ByteArrayInputStream(wsdl.getBytes()));
        return new WsdlLocationToRequestUrlAdapter(wsdlProvider);
    }
View Full Code Here

    public void givenWsdlAdapter_whenWsdlIsRequested_shouldRespondWithAdaptedWsdl() throws Exception {
        File wsdlFile = new File(WSDL_FILE_PATH);
        String initialWsdl = FileUtils.readFileToString(wsdlFile);
        initialWsdl = initialWsdl.replace("$serviceLocation$", "/example/service");
        InputStreamWsdlProvider wsdlProvider = new InputStreamWsdlProvider(new ByteArrayInputStream(initialWsdl.getBytes()));
        WsdlProvider adapter = new WsdlLocationToRequestUrlAdapter(wsdlProvider);
        when(service.getWsdlProvider()).thenReturn(adapter);
        request.setScheme("http");
        request.setServerName("test.example.com");
        request.setServerPort(80);
       
View Full Code Here

TOP

Related Classes of org.jibx.ws.wsdl.WsdlLocationToRequestUrlAdapter

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.