Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

sending xml over http - security issue

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey all,
I am trying to send an XML file over HTTP by using a java program
(to a webmethods integration server).
but i get the following warning :
[WARN] HttpMethodBase - -No credentials available for the 'webMethods' authentication realm at host
the return code i get is 401 , acces denied...
What do I do wrong?
Can anybody help me on this? Code is listed below
thanks...
File input = new File("C:\Data\javamail\example.xml");
HttpClient httpclient = new HttpClient();
// Execute request
httpclient.getState().setCredentials( "webMethods","http://host",new UsernamePasswordCredentials("user", "paswd"));
PostMethod post = new PostMethod("http://host/invoke/service");
// Request content will be retrieved directly
// from the input stream
post.setRequestBody(new FileInputStream(input));
if (input.length() < Integer.MAX_VALUE) {
post.setRequestContentLength((int)input.length());
} else {
//post.setRequestContentLength(EntityEnclosingMethod.CONTENT_LENGTH_CHUNKED);
}
post.setRequestHeader("Content-type", "text/xml; charset=ISO-8859-1");
int result = httpclient.executeMethod(post);
post.releaseConnection();
 
Danger, 10,000 volts, very electic .... tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic