Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #5356

Testing the Post request

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nx02.iad01.newshosting.com!newshosting.com!69.16.185.21.MISMATCH!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!x3g2000yqj.googlegroups.com!not-for-mail
From Pete <vw_bora@sky.com>
Newsgroups comp.lang.java.programmer, comp.lang.java.help, comp.client-server
Subject Testing the Post request
Date Sat, 18 Jun 2011 04:41:54 -0700 (PDT)
Organization http://groups.google.com
Lines 44
Message-ID <df9cb1d7-c953-49ed-851b-c309a034a3a9@x3g2000yqj.googlegroups.com> (permalink)
NNTP-Posting-Host 90.202.43.193
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
X-Trace posting.google.com 1308397755 15918 127.0.0.1 (18 Jun 2011 11:49:15 GMT)
X-Complaints-To groups-abuse@google.com
NNTP-Posting-Date Sat, 18 Jun 2011 11:49:15 +0000 (UTC)
Complaints-To groups-abuse@google.com
Injection-Info x3g2000yqj.googlegroups.com; posting-host=90.202.43.193; posting-account=WJOPywoAAACR5fu5y-AcGCF6AHoK1Cxw
User-Agent G2/1.0
X-Google-Web-Client true
X-Google-Header-Order ARLUEHNKC
X-HTTP-UserAgent Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; Sky Broadband; GTB7.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; InfoPath.2; .NET CLR 3.5.30729; .NET4.0C; .NET CLR 3.0.30729; AskTB5.6),gzip(gfe)
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:5356 comp.lang.java.help:778 comp.client-server:2

Cross-posted to 3 groups.

Show key headers only | View raw


Hi,
Below is a bit of code that I intend to use to perform a http "Post"
request to an another application - which is still under development.
I would like to verify the implemention of this method ie it will
perform a http POST request with the xml content to the specified URL.
I want to avoid mocking the HttpClient class. I would like to
effectively see this method perform the a actions and and some stub
application receive the request ( get I presume). Any help, with
example code pls, would be very much appreciated.

Thank You.

Pete

code =>
	public void sendResponse() {

		String url = "URL";

		String xmldata = "xml data";

		PostMethod post = new PostMethod(url);

		final RequestEntity entity = new StringRequestEntity(xmldata);
		post.setRequestEntity(entity);

		// Specify content type and encoding
		post.setRequestHeader("Content-type", "text/xml;
charset=ISO-8859-1");

		// Get HTTP client
		HttpClient httpclient = new HttpClient();

		// Execute request
		try {

			int result = httpclient.executeMethod(post);

		} catch (Exception e) {
			System.out.print("exception encountered " + e.toString());
		} finally {
			post.releaseConnection();
		}
	}

Back to comp.lang.java.programmer | Previous | NextNext in thread | Find similar


Thread

Testing the Post request Pete <vw_bora@sky.com> - 2011-06-18 04:41 -0700
  Re: Testing the Post request Stanimir Stamenkov <s7an10@netscape.net> - 2011-06-18 17:42 +0300
    Re: Testing the Post request Pete <vw_bora@sky.com> - 2011-06-18 08:54 -0700
      Re: Testing the Post request Stanimir Stamenkov <s7an10@netscape.net> - 2011-06-18 19:33 +0300
        Re: Testing the Post request Pete <vw_bora@sky.com> - 2011-06-18 10:40 -0700
          Re: Testing the Post request Stanimir Stamenkov <s7an10@netscape.net> - 2011-06-18 23:36 +0300
            Re: Testing the Post request Pete <vw_bora@sky.com> - 2011-06-18 15:33 -0700
              Re: Testing the Post request Abu Yahya <abu_yahya@invalid.com> - 2011-06-19 23:10 +0530
      Re: Testing the Post request markspace <-@.> - 2011-06-18 11:11 -0700

csiph-web