permaculture playing cards*
The moose likes Sockets and Internet Protocols and the fly likes sending xml over http - security issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "sending xml over http - security issue" Watch "sending xml over http - security issue" New topic
Author

sending xml over http - security issue

e vanduffel
Greenhorn

Joined: Nov 04, 2003
Posts: 12
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();
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: sending xml over http - security issue