users@jax-rpc.java.net

Re: Communication problem between Apache-Axis WebService and JWSDP client

From: Merten Schumann <Merten.Schumann_at_asg.com>
Date: Wed, 21 Jul 2004 13:33:32 +0200

> Sorry for the late response but how can we set these properties on
dynamic proxy object when it is during the creation of Service object
itself we get the exception ?
 
One solution could be to add authentication only for the POST http
method, not for GET.
This is what I just tried, it works.
Thus HTTP GET (...?WSDL) will work without authentication but POSTed
SOAP actions will require authentication.
 
But I'm not sure if this is a solution for a real world application. I
think there's a specification to support SOAP via HTTP GET method. You
can specifiy in a web browser an URL to reach web service methods (if
they are simple enough, no complex types) ... This would then by-pass
authentication, which is not nice.
 
I tried to add an url-pattern "/foo?WSDL" with no authentication
additionaly to protected "/foo", but it did not work.
 
So, I would be interested in a solution too.
 
   Merten


________________________________

        From: Narinder Kumar [mailto:nkumarfr_at_aol.com]
        Sent: Tuesday, July 20, 2004 12:53 PM
        To: users_at_jax-rpc.dev.java.net
        Subject: Re: Communication problem between Apache-Axis
WebService and JWSDP client
        
        
        

                        That raises another question related to
Security/Authentication between WebService/Client :
                        
                        In my webservice implemented using JWSDP-1.3, I
use Tomcat BASIC Authentication mechanism in web.xml specifying a
username/password :
                        
                          <security-constraint>
                            <web-resource-collection>
        
<web-resource-name>PeemsWebService</web-resource-name>
                              <url-pattern>/PeemsWS</url-pattern>
                              <http-method>GET</http-method>
                              <http-method>POST</http-method>
                            </web-resource-collection>
                            <auth-constraint>
                              <role-name>peemsadmins</role-name>
                            </auth-constraint>
                            <user-data-constraint>
        
<transport-guarantee>NONE</transport-guarantee>
                            </user-data-constraint>
                          </security-constraint>
                        
                        When using Static client (implementation
specific), we can set the properties for username/password by doing :
                        
                                    Stub stub = (Stub) (new
MyWebService_Impl().getMyWebServiceIFPort());
        
stub._setProperty(javax.xml.rpc.Stub.USERNAME_PROPERTY, "peemsadmin");
        
stub._setProperty(javax.xml.rpc.Stub.PASSWORD_PROPERTY, "peemsadmin");
        
stub._setProperty(javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY,
endpointAddress);
                                    myPeems = (PeemsIF) stub;
                        
                        But when we follow the standard procedure of
creating a service proxy (Dynamic Client) through ServiceFactory, we get
HTTP 401 exception :
                        
                                static String endpointAddress =
"http://localhost:8080/peemswebservice/PeemsWS"
<http://localhost:8080/peemswebservice/PeemsWS> ;
                                static String UrlString =
"http://localhost:8080/peemswebservice/PeemsWS?WSDL"
<http://localhost:8080/peemswebservice/PeemsWS?WSDL> ;
                                static String nameSpaceUri = "urn:Foo";
                                static String serviceName =
"PeemsWebService";
                                static String portName = "PeemsIFPort";
                                URL peemsWSDLUrl = new URL(UrlString);
                                PeemsIF myProxy = null;
                                ServiceFactory serviceFactory =
ServiceFactory.newInstance();
                        
                                Service peemsWService =
serviceFactory.createService
                                                        (peemsWSDLUrl,
new QName(nameSpaceUri, serviceName));
                        
                        Exception : [java] modeler error: failed to
parse document at "http://localhost:8080/peemswebservic
                        e/PeemsWS?WSDL": java.io.IOException: Server
returned HTTP response code: 401 for URL: http:
                        //localhost:8080/peemswebservice/PeemsWS?WSDL
                        
                        My question is : How should we set
javax.xml.rpc.Stub.USERNAME_PROPERTY and
javax.xml.rpc.Stub.PASSWORD_PROPERTY while using Dynamic proxy client
procedure ?

                yes, you do need to set those properties. The dynamic
proxy implements the StubIF so the same properties should be used.
                
                

        
        Sorry for the late response but how can we set these properties
on dynamic proxy object when it is during the creation of Service object
itself we get the exception ?
        
        Regards
        Narinder
        
--------------------------------------------------------------------- To
unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net For
additional commands, e-mail: users-help_at_jax-rpc.dev.java.net