Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

sending xml over http - security issue  RSS feed

e vanduffel
Posts: 12
  • Mark post as helpful
  • send pies
  • 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
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) {
} else {
post.setRequestHeader("Content-type", "text/xml; charset=ISO-8859-1");
int result = httpclient.executeMethod(post);
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!