Examples of PostMethodWebRequest


Examples of com.meterware.httpunit.PostMethodWebRequest

    public void testSoapAction()
            throws Exception
    {
        HttpUnitOptions.setLoggingHttpHeaders(true);

        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

Examples of com.meterware.httpunit.PostMethodWebRequest

    public void testQuotedSoapAction()
            throws Exception
    {
        HttpUnitOptions.setLoggingHttpHeaders(true);

        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

Examples of com.meterware.httpunit.PostMethodWebRequest

        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        sendAtts.write(bos);

        InputStream is = new ByteArrayInputStream(bos.toByteArray());

        PostMethodWebRequest req = new PostMethodWebRequest("http://localhost/services/AttachmentEcho",
                                                            is,
                                                            sendAtts.getContentType());

        return req;
    }
View Full Code Here

Examples of com.meterware.httpunit.PostMethodWebRequest

            }
        };
       
      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);
View Full Code Here

Examples of com.meterware.httpunit.PostMethodWebRequest

    }

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

        WebResponse response = newClient().getResponse(req);
View Full Code Here

Examples of com.meterware.httpunit.PostMethodWebRequest

    }
   
    public void testFaultCode()
            throws Exception
    {
        WebRequest req = new PostMethodWebRequest("http://localhost/services/BadEcho",
                                                  getClass().getResourceAsStream("/org/codehaus/xfire/echo11.xml"),
                                                  "text/xml");

        Transport transport = getXFire().getTransportManager().getTransport(SoapHttpTransport.SOAP11_HTTP_BINDING);
        assertNotNull(transport.getFaultHandlers());
View Full Code Here

Examples of com.meterware.httpunit.PostMethodWebRequest

    }

    public void testAsync()
            throws Exception
    {
        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

Examples of com.meterware.httpunit.PostMethodWebRequest

        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        sendAtts.write(bos);

        InputStream is = new ByteArrayInputStream(bos.toByteArray());

        PostMethodWebRequest req = new PostMethodWebRequest("http://localhost/services/AttachmentEcho",
                                                            is,
                                                            sendAtts.getContentType());

        return req;
    }
View Full Code Here

Examples of com.meterware.httpunit.PostMethodWebRequest

    public void testJSONRPCBinding() throws Exception {
        JSONObject jsonRequest = new JSONObject("{ \"method\": \"sayHello\", \"params\": [\"Ray\"], \"id\": 1}");

        WebConversation wc = new WebConversation();
        WebRequest request =
            new PostMethodWebRequest(SERVICE_URL, new ByteArrayInputStream(jsonRequest.toString().getBytes("UTF-8")),
                                     "application/json");
        WebResponse response = wc.getResource(request);

        Assert.assertEquals(200, response.getResponseCode());
View Full Code Here

Examples of com.meterware.httpunit.PostMethodWebRequest

public class RestServletPojoInOutTest extends ServletCamelRouterTestSupport {

    @Test
    public void testServletPojoInOut() throws Exception {
        String body = "{\"id\": 123, \"name\": \"Donald Duck\"}";
        WebRequest req = new PostMethodWebRequest(CONTEXT_URL + "/services/users/lives", new ByteArrayInputStream(body.getBytes()), "application/json");
        ServletUnitClient client = newClient();
        client.setExceptionsThrownOnErrorStatus(false);
        WebResponse response = client.getResponse(req);

        assertEquals(200, response.getResponseCode());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.