Title: RE: How to control the Call object in code generated by WSDL2Java ?

Thanks for the explanation. The key aha for me was that username/password are really outside the bounds of the service.

Thanks again.
Naresh

-----Original Message-----
From: Russell Butek [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 10, 2002 5:01 PM
To: [EMAIL PROTECTED]
Subject: RE: How to control the Call object in code generated by
WSDL2Java ?


The interface strictly defines the service.  Nothing more.  If you're
setting username/password, you're going outside the bounds of the
interface.  So you have to cast it to something that knows what you're
doing.  If you'd prefer being a bit more generic, you COULD do:

��� // Set credentials
��� Stub stub = (Stub)node;
��� stub.setUsername(username);
��� stub.setPassword(password);

where "Stub" is org.apache.axis.client.Stub.  If you want to be even more
generic; if you want to strictly follow JAX-RPC rather than dive into AXIS
API's, you could do:

��� // Set credentials
��� Stub stub = (Stub)node;
   stub._setProperty(Stub.USERNAME_PROPERTY, username);
    stub._setProperty(Stub.PASSWORD_PROPERTY, password);

where "Stub" is javax.xml.rpc.Stub.  (You can see why we added the AXIS
API's.  setUserName(userName) is a whole lot easier to read.)

Russell Butek
[EMAIL PROTECTED]


Naresh Bhatia <[EMAIL PROTECTED]> on 05/10/2002 02:46:40 PM

Please respond to [EMAIL PROTECTED]

To:    "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
cc:
Subject:    RE: How to control the Call object in code generated by
       WSDL2Java   ?





I am a little uncomfortable with the suggested solution. It essentially
requires breaking all the encapsulation rules and going directly at the
stub implementation. I may be wrong, but this is what I had to do to amke
things work:

��� nodeService nodeService = new nodeServiceLocator();
��� Node node = nodeService.getMyService();

��� // Set credentials
��� MyServiceSoapBindingStub stub
= (org.oss.node.MyServiceSoapBindingStub)node;
��� stub.setUsername(username);
��� stub.setPassword(password);

��� node.doStuff();� // creates and invokes the Call object

1) Is this just a fact of life that I have to deal with :-)? or could the
interfaces be made richer to do this kind of stuff.

2) What do people do in their real code - use interfaces such as
javax.xml.rpc.Service, or concrete classes such as
org.apache.axis.client.Call, or both?

Just trying to get a feel for what direction I should be taking.

Thanks.
Naresh

-----Original Message-----
From: Tom Jordahl [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 10, 2002 3:19 PM
To: '[EMAIL PROTECTED]'
Subject: RE: How to control the Call object in code generated by
WSDL2Java ?


FYI

The --user and --password options are used to access the WSDL URI for the
tool.� WSDL may be protected by web server Basic Authentication.� They do
not embed this info in to the stubs.

The _setProperty() function is the right way to do this.

--
Tom Jordahl
Macromedia

-----Original Message-----
From: Alan Moore [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 10, 2002 3:06 PM
To: '[EMAIL PROTECTED]'
Subject: RE: How to control the Call object in code generated by
WSDL2Java ?

Run WSDL2Java with no parameters and you will see --user --password options
are available. I haven't used these options but I think that the user and
password will be embedded directly into the client side generated code for
XXXBindingStub.java.

Another option may be to use:

yourStub._setProperty( javax.xml.rpc.Call.USERNAME_PROPERTY, "username" );
yourStub._setProperty( javax.xml.rpc.Call.PASSWORD_PROPERTY, "password" );

Good luck!

alan

-----Original Message-----
From: Naresh Bhatia [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 10, 2002 10:36 AM
To: '[EMAIL PROTECTED]'
Subject: How to control the Call object in code generated by WSDL2Java?

I have used WSDL2Java to generate my Web Service. I need to set the
username
and password properties on the Call object before I send out the SOAP
message. How can I do that? Currently the client code that invokes the call
looks like this:
��� nodeService nodeService = new nodeServiceLocator();
��� Node node = nodeService.getMyService();
��� node.doStuff();� // creates and invokes the Call object
I don't know how to exert this level of control on the Call object that is
essentially created and invoked in the doStuff() method of the stub created
by WSDL2Java. Is this really possible?
Thanks.
Naresh


Reply via email to