File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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
Author

unauthorized error while accessing remote WS.

kumar mahesh
Greenhorn

Joined: Nov 28, 2007
Posts: 16
Hi,

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.
AxisFault
faultCode: {http://xml.apache.org/axis/}HTTP
faultSubcode:
faultString: (401)Unauthorized
faultActor:
faultNode:
faultDetail:
{}: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 }
</STYLE>
</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.
<hr>
<p>Please try the following:</p>
<ul>
<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>
</ul>
<h2>HTTP Error 401.2 - Unauthorized: Access is denied due to server configuration.<br>Internet Information Services (IIS)</h2>
<hr>
<p>Technical Information (for support personnel)</p>
<ul>
<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>
</ul>

</TD></TR></TABLE></BODY></HTML>

{http://xml.apache.org/axis/}HttpErrorCode:401

(401)Unauthorized
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.


client-config.wsdd

<?xml version="1.0" encoding="UTF-8"?>
<deployment name="commonsHTTPConfig"
xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">

<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" />

</deployment>

Kindly reply.

Regards,
mahesh
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
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
Greenhorn

Joined: Nov 28, 2007
Posts: 16
Hi,

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.

Regards,
mahesh
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: unauthorized error while accessing remote WS.
 
Similar Threads
My first webservice call
can i use the AdminClient tool to deploy my ws package to wls or jboss?
getting exception access webservice located xmethods.net
how to write java web service client
unable to run the Axis client