Try without the entries in the web.xml
T.
-----Original Message-----
From: Kwan Hon Luen [mailto:hon_luen_at_YAHOO.COM]
Sent: 31 October 2002 09:21
To: JAXRPC-INTEREST_at_JAVA.SUN.COM
Subject: Re: java.rmi.RemoteException: cannot connect to server: Unauthori
zed
Hi , if you look at my client code, I have added in the two lines you
mentioned, with the authorised tags in the web.xml.
What could be the cause of the error?
----- Original Message -----
From: HYPERLINK "mailto:Ted.odonovan_at_ECET.COM"Ted O'Donovan
To: HYPERLINK
"mailto:JAXRPC-INTEREST_at_JAVA.SUN.COM"JAXRPC-INTEREST_at_JAVA.SUN.COM
Sent: Thursday, October 31, 2002 5:21 PM
Subject: Re: java.rmi.RemoteException: cannot connect to server: Unauthori
zed
Yeah you have basic authentication in your web.xml. You have two options,
enter the username & password of an authorised tomcat user (e.g. admin user
setup on installation) in your client code, i.e.
stub._setProperty(javax.xml.rpc.Stub.USERNAME_PROPERTY,
username);
stub._setProperty(javax.xml.rpc.Stub.PASSWORD_PROPERTY,
password);
or remove the authorisation tags from your web.xml, i.e.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
" HYPERLINK
"
http://java.sun.com/j2ee/dtds/web-app_2_3.dtd""
http://java.sun.com/j2ee/dtd
s/web-app_2_3.dtd">
<web-app>
<display-name>hello Application</display-name>
<description>A web application containing a JAX-RPC endpoint</description>
<servlet>
<servlet-name>JAXRPCEndpoint</servlet-name>
<display-name>JAXRPCEndpoint</display-name>
<description>Endpoint for hello Service</description>
<servlet-class>com.sun.xml.rpc.server.http.JAXRPCServlet</servlet-class>
<init-param>
<param-name>configuration.file</param-name>
<param-value>/WEB-INF/HelloService_Config.properties</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>JAXRPCEndpoint</servlet-name>
<url-pattern>/endpoint/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>60</session-timeout>
</session-config>
</web-app>
T.
-----Original Message-----
From: Kwan Hon Luen [mailto:hon_luen_at_YAHOO.COM]
Sent: 31 October 2002 04:19
To: JAXRPC-INTEREST_at_JAVA.SUN.COM
Subject: java.rmi.RemoteException: cannot connect to server: Unauthorized
Hi All,
Have some questions here, because I still cannot manage to connect via SSL.
I get the error below from the client code, can someone tell me what's wrong
here?
_____
java.rmi.RemoteException: cannot connect to server: Unauthorized; nested
exception is:
cannot connect to server: Unauthorized
at hello.HelloIF_Stub.sayHello(HelloIF_Stub.java:77)
at hello.HelloClient.main(HelloClient.java:10)
Caused by: cannot connect to server: Unauthorized
at
com.sun.xml.rpc.client.http.HttpClientTransport.invoke(HttpClientTran
sport.java:119)
at
com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:73)
at hello.HelloIF_Stub.sayHello(HelloIF_Stub.java:60)
... 1 more
_____
Here's the Client code:
package hello;
import javax.xml.rpc.Stub;
public class HelloClient
{
public static void main(String[] args)
{
try
{
System.setProperty ("javax.net.ssl.trustStore",
"f:\\SSL\\client.keystore");
System.setProperty("javax.net.ssl.trustStorePassword", "12345678");
java.security.Security.addProvider(new
com.sun.net.ssl.internal.ssl.Provider());
HelloIF_Stub stub = (HelloIF_Stub)( new
HelloService_Impl().getHelloIFPort() );
stub._setProperty(javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY,
" HYPERLINK
"
https://192.168.168.88:443/helloservice/endpoint/HelloIF")"
https://192.168.
168.88:443/helloservice/endpoint/HelloIF");
stub._setProperty(javax.xml.rpc.Stub.USERNAME_PROPERTY, "honluen");
stub._setProperty(javax.xml.rpc.Stub.PASSWORD_PROPERTY, "12345678");
HelloIF hello = (HelloIF)stub;
System.out.println(hello.sayHello("DSSS!"));
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
}
_____
Note: The Web Service machine is installed with tomcat with SSL enabled on
port 443.
On the Web Service machine:
Here's the web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
" HYPERLINK
"
http://java.sun.com/j2ee/dtds/web-app_2_3.dtd""
http://java.sun.com/j2ee/dtd
s/web-app_2_3.dtd">
<web-app>
<display-name>hello Application</display-name>
<description>A web application containing a JAX-RPC endpoint</description>
<security-constraint>
<web-resource-collection>
<web-resource-name>MyServiceName</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>manager</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
<servlet>
<servlet-name>JAXRPCEndpoint</servlet-name>
<display-name>JAXRPCEndpoint</display-name>
<description>Endpoint for hello Service</description>
<servlet-class>com.sun.xml.rpc.server.http.JAXRPCServlet</servlet-class>
<init-param>
<param-name>configuration.file</param-name>
<param-value>/WEB-INF/HelloService_Config.properties</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>JAXRPCEndpoint</servlet-name>
<url-pattern>/endpoint/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>60</session-timeout>
</session-config>
</web-app>
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.394 / Virus Database: 224 - Release Date: 03/10/2002
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.394 / Virus Database: 224 - Release Date: 03/10/2002
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.394 / Virus Database: 224 - Release Date: 03/10/2002
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.394 / Virus Database: 224 - Release Date: 03/10/2002