aspose file tools*
The moose likes Struts and the fly likes Problem passing query string.... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem passing query string...." Watch "Problem passing query string...." New topic
Author

Problem passing query string....

Srinivas Kasani
Greenhorn

Joined: Sep 26, 2008
Posts: 22
I'm trying to invoke a RESTful web service using Http GET. The URI, I'm trying to access is "http://server/<somename.aspx>?Action=add". But the code fails with the following error
"ERROR Loading adapter xmls: Object reference not set to an instance of an object."

Below is the sample code.
URL url = new URL("http://server/<somename.aspx>?Action=add");
connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod("GET");
connection.setDoInput(true);
connection.setConnectTimeout(10000);
connection.connect();

InputStream ins = connection.getInputStream();
byte buffer[] = new byte[8192];
int read;
sb = new StringBuffer();
while((read = ins.read(buffer))!= -1)
{
sb.append(new String(buffer, 0, read));
}

The same code was able to run, if I did not have the query string in my URL. Can you tell me what I'm doing wrong.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

This has nothing to do with Struts.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem passing query string....
 
Similar Threads
Problem reading the HttpConection response in some devices
Problem with querystring parameter using HTTP GET.
Transferring a file across a socket connection--HELP
trouble retrieving html of all web sites
Object > byteArray > String > byteArray > Object