• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem passing query string....

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This has nothing to do with Struts.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic