Package com.meterware.httpunit

Examples of com.meterware.httpunit.WebResponse


        WebRequest req = new PostMethodWebRequest("http://localhost/services/SoapActionService",
                                                  getResourceAsStream("empty.xml"),
                                                  "text/xml");
        req.setHeaderField("SOAPAction", "one");

        WebResponse response = newClient().getResponse(req);
        assertTrue(response.getText().indexOf("oneout") != -1);
      
        req = new PostMethodWebRequest("http://localhost/services/SoapActionService",
                                       getResourceAsStream("empty.xml"),
                                       "text/xml");
        req.setHeaderField("SOAPAction", "two");
       
        response = newClient().getResponse(req);
        assertTrue(response.getText().indexOf("twoout") != -1);

    }
View Full Code Here


        WebRequest req = new PostMethodWebRequest("http://localhost/services/SoapActionService",
                                                  getResourceAsStream("empty.xml"),
                                                  "text/xml");
        req.setHeaderField("SOAPAction", "\"one\"");

        WebResponse response = newClient().getResponse(req);
        assertTrue(response.getText().indexOf("oneout") != -1);
      
        req = new PostMethodWebRequest("http://localhost/services/SoapActionService",
                                       getResourceAsStream("empty.xml"),
                                       "text/xml");
        req.setHeaderField("SOAPAction", "\"two\"");
       
        response = newClient().getResponse(req);
        assertTrue(response.getText().indexOf("twoout") != -1);

    }
View Full Code Here

            {
                return "WSDL";
            }
        };
       
      WebResponse response = newClient().getResponse(getReq);

        WebRequest req = new PostMethodWebRequest("http://localhost/services/EchoImpl",
                                                  getClass().getResourceAsStream("/org/codehaus/xfire/echo11.xml"),
                                                  "text/xml");

        response = newClient().getResponse(req);

        assertEquals("text/xml", response.getContentType());
        assertEquals("UTF-8", response.getCharacterSet());
       
        Document doc = readDocument(response.getText());
        addNamespace("m", "urn:Echo");
        assertValid("//m:echo", doc);

        assertTrue(MockSessionHandler.inSession);
    }
View Full Code Here

    {
        WebRequest req = new PostMethodWebRequest("http://localhost/services/EchoImpl",
                                                  getClass().getResourceAsStream("/org/codehaus/xfire/echo12.xml"),
                                                  "text/xml");

        WebResponse response = newClient().getResponse(req);

        assertEquals("application/soap+xml", response.getContentType());
        assertEquals("UTF-8", response.getCharacterSet());
       
        Document doc = readDocument(response.getText());
        addNamespace("m", "urn:Echo");
        assertValid("//m:echo", doc);

        assertTrue(MockSessionHandler.inSession);
    }
View Full Code Here

        throws Exception
    {
        ServletUnitClient client = newClient();
        client.setExceptionsThrownOnErrorStatus(false);
       
        WebResponse res = client.getResponse("http://localhost/services/NoSuchService");
        assertEquals(404, res.getResponseCode());
        assertTrue(res.isHTML());
    }
View Full Code Here

        throws Exception
    {
        ServletUnitClient client = newClient();
        client.setExceptionsThrownOnErrorStatus(false);
       
        WebResponse res = client.getResponse("http://localhost/services/EchoImpl");

        assertTrue(res.isHTML());
        assertEquals("<html><body>Invalid SOAP request.</body></html>", res.getText());
    }
View Full Code Here

    {
        WebRequest req = new PostMethodWebRequest("http://localhost/services/AsyncService",
                                                  getClass().getResourceAsStream("/org/codehaus/xfire/echo11.xml"),
                                                  "text/xml");

        WebResponse response = newClient().getResponse(req);
        assertTrue(response.getText().length() == 0);
    }
View Full Code Here

    public void testWSDLDisabled()
        throws Exception
    {
        try
        {
            WebResponse response = newClient().getResponse(new TestWebRequest(
                    "http://localhost/services/Echo"));

            DOMUtils.writeXml(response.getDOM(), System.out);
        }
        catch (HttpNotFoundException e)
        {
            assertEquals(e.getResponseCode(), 404);
            assertTrue(e.getResponseMessage().indexOf("wsdl") > 0);
View Full Code Here

    public void testWSDLEnabled()
        throws Exception
    {
        try
        {
            WebResponse response = newClient().getResponse(new TestWebRequest(
                    "http://localhost/services/Echo1"));

            DOMUtils.writeXml(response.getDOM(), System.out);
        }
        catch (HttpNotFoundException e)
        {
            assertTrue(false);
        }
View Full Code Here

        // Check for a simple connection
        WebConversation wc = new WebConversation();
        WebRequest wreq = new GetMethodWebRequest(
                "http://localhost:10005/examples/TestWriteAfterServlet");
        WebResponse wresp1 = wc.getResponse(wreq);
        Logger.logDirectMessage(Logger.INFO, "log", "Output: " + wresp1.getText(), null);
        assertTrue(wresp1.getText().endsWith("Hello"));
        winstone.shutdown();
        Thread.sleep(500);
    }
View Full Code Here

TOP

Related Classes of com.meterware.httpunit.WebResponse

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.