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";
static String UrlString = "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@jax-rpc.dev.java.net
For additional commands, e-mail: users-help@jax-rpc.dev.java.net