This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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
Author

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

mark issac
Greenhorn

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= "194.33.22.33//administrator";
String Password= "Qwert6y";
conn.setUserName(Username);
conn.setPassword(Password);


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

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







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 = "http://tempuri.org/echoString";
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 );
try{
// 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(
"org.apache.xerces.parsers.SAXParser");

ClientHandler ch = new ClientHandler();
ch.setElementToSearchFor("echoStringResult");
// 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: http://aspose.com/file-tools
 
subject: Prob. logging in calling a Webservice on Dot-net server
 
Similar Threads
SaxParseException
Not Authorized as response connecting Webservice in a trusted Domain
Call .NET Web Service From JAVA Client
whats wrong with this ??? ASP.NET service and Java Client
internal method call.getEnvelopeString() fails. unable to identify cause of failure