You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by "Adam.Leggett" <Ad...@upco.co.uk> on 2001/06/07 11:46:15 UTC

Problem with basic http authentication

Hi folks,

I am trying to put the rpcrouter under basic authentication but my SOAP
client calls are failing.
In my web.xml i've adding the following:

<security-constraint>
      <web-resource-collection>
        <web-resource-name>MySecureBit1</web-resource-name>
        <description>no description</description>
        <url-pattern>/servlet/rpcrouter</url-pattern>
        <http-method>GET</http-method>
        <http-method>POST</http-method>
      </web-resource-collection>
      <auth-constraint>
        <description>no description</description>
        <role-name>tomcat</role-name>
      </auth-constraint>
    </security-constraint>

    <login-config>
      <auth-method>BASIC</auth-method>
      <realm-name>soap</realm-name>
    </login-config>
    <security-role>
      <description>the tomcat role</description>
      <role-name>tomcat</role-name>
    </security-role>

This works fine in a browser without problems.
I used the following in my client to allow access to the router:

public Call buildCall(String uri, String methodName, Vector params) {

	SOAPHTTPConnection conn = new SOAPHTTPConnection();
	conn.setUserName("tomcat");
	conn.setPassword("tomcat");
	
	Call call = new Call();
	call.setSOAPTransport(conn);
	call.setTargetObjectURI(uri);
	call.setMethodName(methodName);
	call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
	call.setParams(params);

	return call;
}


However, when i run the client i get the following message:

[SOAPException: faultCode=SOAP-ENV:Client;
msg=socket closed (code=0); 
targetException=java.net.SocketException: socket closed (code=0)]



My tomcat log indicates that BASIC auth has taken place:

Context log: path="/soap" BASIC auth dG9tY2F0OnRvbWNhdA== tomcat:tomcat
Context log: path="/soap" BASIC Auth:  tomcat
Context log: path="/soap" Controled access for tomcat R( /soap +
/servlet/rpcrouter + null) Ct (Wrapper(default
S:org.apache.tomcat.servlets.DefaultServlet) Roles:  tomcat )

Thanks in advance.



Adam Leggett
UPCO
Direct Line: 0113 20 10 631
Fax: 0113 20 10 666
<http://www.upco.co.uk>
The contents of this email are intended for the named addressees and may
contain confidential and / or privileged material. If received in error,
please contact UPCO on +44 (0)113 20 10 600 and then delete the entire email
from your system. Unauthorised review, distribution, disclosure or other use
of this information could constitute a breach of confidence. Your
co-operation in this matter is greatly appreciated.



---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org