Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

mark issac
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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;
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!