File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes Prob. logging in calling a Webservice on Dot-net server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Prob. logging in calling a Webservice on Dot-net server" Watch "Prob. logging in calling a Webservice on Dot-net server" New topic

Prob. logging in calling a Webservice on Dot-net server

mark issac

Joined: Oct 07, 2004
Posts: 5
Hi I have a problem when I try to acces a webservice. Calling the Webservice I get a message that said I am no Authorized to acces.
The following Code is used to accessed the Webservice.

Can anybody suggest were look. On the server-side or in the following Javacode. Since My Experiance is not big with Java-Coding I appreciate any alternativ loging method if there a better than beneath.

public synchronized String echoString( String inputString )
throws SOAPException {
String retval = "";

SOAPHTTPConnection conn = new SOAPHTTPConnection();
String Username= "";
String Password= "Qwert6y";

if (url == null) {
throw new SOAPException(Constants.FAULT_CODE_CLIENT,
"A URL must be specified via " +

// Instantiate the message and the envelope.
// The message sends the envelope and gets
// the response.
Message message = new Message();
Envelope env = new Envelope();

DataHandler soapMsg = null;

// Get this from the soapAction attribute on the
// soap peration element that is found within the SOAP
// binding information in the WSDL.
String SOAPActionURI = "";
MessageBody theBody = new MessageBody();

// Set the argument.
theBody.echoString = inputString;

// Replace the default body with our own.
env.setBody( theBody );
message.send( getEndPoint(), SOAPActionURI, env );
// Because the Body.unmarshall handler is static,
// you cannot replace the basic machinery easily.
// Instead, you must obtain and parse the
// message on your own.
soapMsg = message.receive();
XMLReader xr = XMLReaderFactory.createXMLReader(

ClientHandler ch = new ClientHandler();
// Set the ContentHandler.
xr.setContentHandler( ch );

// Parse the file.
xr.parse( new InputSource(
new StringReader( soapMsg.getContent().toString() ) ) );

// At this point, the result has been parsed and stored
// within the ClientHandler instance.
retval = ch.getResult();
} catch ( Exception e ) {
// You need to do something with the exception.
// Here, we print out the exception to the console.
System.out.println( "***Exception***: " + e.toString() );
return retval;
I agree. Here's the link:
subject: Prob. logging in calling a Webservice on Dot-net server
It's not a secret anymore!