Webservice authentication
ah123 Sep 7, 2004 6:08 PMIn the deploy.wsdd file I added the following for authentication. In addition I have users.lst file which includes these users:
<requestFlow name="checks"> <handler type="java:org.apache.axis.handlers.SimpleAuthenticationHandler"/> <handler type="java:org.apache.axis.handlers.SimpleAuthorizationHandler"/> </requestFlow> <parameter name="allowedRoles" value="user1,user2"/>
However after I generate the stub class (through wsdl2java), AxisSoapBindingStub has the following method:
public requestManagerService.Person testPerson(java.lang.String in0, requestManagerService.Person in1) throws java.rmi.RemoteException { if (super.cachedEndpoint == null) { throw new org.apache.axis.NoEndPointException(); } org.apache.axis.client.Call _call = createCall(); _call.setOperation(_operations[1]); _call.setUseSOAPAction(true); _call.setSOAPActionURI(""); _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); _call.setOperationName(new javax.xml.namespace.QName("http://localhost:8080/axis/servlet/AxisServlet", "testPerson")); setRequestHeaders(_call); setAttachments(_call); java.lang.Object _resp = _call.invoke(new java.lang.Object[] {in0, in1}); if (_resp instanceof java.rmi.RemoteException) { throw (java.rmi.RemoteException)_resp; } else { extractAttachments(_call); try { return (requestManagerService.Person) _resp; } catch (java.lang.Exception _exception) { return (requestManagerService.Person) org.apache.axis.utils.JavaUtils.convert(_resp, requestManagerService.Person.class); } } }
Note, this is generated code. When I try to access from my client class the webservice I get (401)Unauthorized exception, not allowing me to make the call. But if I modified the above stub method by providing _call.setUser and _call.setPassport, with the correct user/pass it works correctly.
My question is how to pass this information from the client code, since I don't have direct access to the _call variable in the generated class. Or do I generate the stub incorrectly?
Thanks a lot.
ah.