wood burning stoves
The moose likes Web Services Certification (SCDJWS/OCEJWSD) and the fly likes unauthorized error while accessing remote WS. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Services Certification (SCDJWS/OCEJWSD)
Bookmark "unauthorized error while accessing remote WS." Watch "unauthorized error while accessing remote WS." New topic

unauthorized error while accessing remote WS.

kumar mahesh

Joined: Nov 28, 2007
Posts: 16

I am trying to invoke a remote WS written in .Net through my Java code. Whenever i try to access it, the below error is thrown.

Apr 10, 2009 11:14:05 AM org.apache.axis.utils.JavaUtils isAttachmentSupported
WARNING: Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
faultCode: {http://xml.apache.org/axis/}HTTP
faultString: (401)Unauthorized
{}:return code: 401
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>You are not authorized to view this page</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252">
<STYLE type="text/css">
BODY { font: 8pt/12pt verdana }
H1 { font: 13pt/15pt verdana }
H2 { font: 8pt/12pt verdana }
A:link { color: red }
A:visited { color: maroon }
</HEAD><BODY><TABLE width=500 border=0 cellspacing=10><TR><TD>

<h1>You are not authorized to view this page</h1>
You do not have permission to view this directory or page using the credentials that you supplied because your Web browser is sending a WWW-Authenticate header field that the Web server is not configured to accept.
<p>Please try the following:</p>
<li>Contact the Web site administrator if you believe you should be able to view this directory or page.</li>
<li>Click the <a href="javascript:location.reload()">Refresh</a> button to try again with different credentials.</li>
<h2>HTTP Error 401.2 - Unauthorized: Access is denied due to server configuration.<br>Internet Information Services (IIS)</h2>
<p>Technical Information (for support personnel)</p>
<li>Go to <a href="http://go.microsoft.com/fwlink/?linkid=8180">Microsoft Product Support Services</a> and perform a title search for the words <b>HTTP</b> and <b>401</b>.</li>
<li>Open <b>IIS Help</b>, which is accessible in IIS Manager (inetmgr),
and search for topics titled <b>About Security</b>, <b>Authentication</b>, and <b>About Custom Error Messages</b>.</li>



at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:744)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at com.org.org.www.i.o.br.e.OssWebServiceSoapStub.readByRange(OssWebServiceSoapStub.java:127)
at com.pkg1.ReadService.main(ReadWS.java:36).

My java code is given below and i have also included the client-config.wsdd file in the WebContent folder of eclipse.


<?xml version="1.0" encoding="UTF-8"?>
<deployment name="commonsHTTPConfig"

<transport name="http" pivot="javarg.apache.axis.transport.http.CommonsHTTPSender" />
<transport name="local" pivot="javarg.apache.axis.transport.local.LocalSender" />
<transport name="java" pivot="javarg.apache.axis.transport.java.JavaSender" />


Kindly reply.

Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
It looks like the username and/or password you supplied for authentication is bad.
Make sure the .NET web service requires authentication and, if that is the case, verify the login and password.
Good luck!
kumar mahesh

Joined: Nov 28, 2007
Posts: 16

The username and password are perfect. Infact i am able to browse the WS using the username and pwd.
Is there something else i need to look upon?.

kindly reply.

I agree. Here's the link: http://aspose.com/file-tools
subject: unauthorized error while accessing remote WS.
It's not a secret anymore!