File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Axis2, client handler not getting called Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Axis2, client handler not getting called" Watch "Axis2, client handler not getting called" New topic
Author

Axis2, client handler not getting called

Anjali S Sharma
Ranch Hand

Joined: Jun 29, 2005
Posts: 279
I have developed a webservice in Axis2 1.5 which will be called by a Java client. The client needs to pass username and password in SOAP Header. For this I am using Rampart 1.5.

Till now I have followed these steps

1. Copy rampart-1.5.mar and rahas-1.5.mar in modules directory of both client and service.
2. Copy Rampart jars in the lib directory of both service and client.
3. In client following was done
-- Following was added to axis2.xml
-- Following is ClientCredentialsHandler.java






4. In the webservice following was done
-- Following was added to services.xml



-- Following is ServiceCredentialsHandler.java

When I execute the client, it gives me the following error



It seems the client handler is not getting called as I cannot see the sysouts that were a part of the client handler.
Is there any setting that I need to do?

thank you
shivendra tripathi
Ranch Hand

Joined: Aug 26, 2008
Posts: 263
Try printing in client code. If client side handler is not getting called post your client code with jvm arguments.


SCJP 1.5(97%) My Blog
Anjali S Sharma
Ranch Hand

Joined: Jun 29, 2005
Posts: 279
Here is client code (as posted above)



VM arguments in eclipse are
-Daxis2.repo="C:\ServiceTestClient1\WebContent\WEB-INF"
Nothing in client is getting printed.
shivendra tripathi
Ranch Hand

Joined: Aug 26, 2008
Posts: 263
You didn't post client code instead you have posted client handler code. I wanted to see if you are using axis2.xml (with rampart and callback class details) correctly in client code/ jvm arguments.
Anjali S Sharma
Ranch Hand

Joined: Jun 29, 2005
Posts: 279
Apologies for posting the wrong code. Here is the client code

shivendra tripathi
Ranch Hand

Joined: Aug 26, 2008
Posts: 263
Looks like you are not engaging your modified axis2.xml. Pass this as jvm argument -Daxis2.xml="E:\MyTest\axis2.xml"
Anjali S Sharma
Ranch Hand

Joined: Jun 29, 2005
Posts: 279
shivendra tripathi wrote:Looks like you are not engaging your modified axis2.xml. Pass this as jvm argument -Daxis2.xml="E:\MyTest\axis2.xml"


You are absolutely correct. Now we have gone past that error. But it is giving the following error now

Anjali S Sharma
Ranch Hand

Joined: Jun 29, 2005
Posts: 279
In Tomcat logs it is showing the following

Anjali S Sharma
Ranch Hand

Joined: Jun 29, 2005
Posts: 279
This means that the service handler is getting called but it is getting the password as null there.
Here is the service handler

shivendra tripathi
Ranch Hand

Joined: Aug 26, 2008
Posts: 263
Post server side error log not the client side. Engage tcp monitor and post the envelope being send by client as well as response send back by server if any.
Anjali S Sharma
Ranch Hand

Joined: Jun 29, 2005
Posts: 279
Thank you.

Server side logs are as follows



Server side handler code is as follows



Here is the request


and here is the reponse

shivendra tripathi
Ranch Hand

Joined: Aug 26, 2008
Posts: 263
Thanks for the info, it was very useful.
There is problem in server side handler code. Code written by you is valid if password is coming as plain text. Since in your case it's coming as digest modify your code as follows.



modify above with this



This should throw exception if you try passing invalid password.

You can use getUsage() method of pwcb to know if password is plain text or digest. If it's WSPasswordCallback.USERNAME_TOKEN(implies digest) use


if it is WSPasswordCallback.USERNAME_TOKEN_UNKNOWN that says plain text is coming so use







Anjali S Sharma
Ranch Hand

Joined: Jun 29, 2005
Posts: 279
Thanks a lot.

Now I am getting the following

shivendra tripathi
Ranch Hand

Joined: Aug 26, 2008
Posts: 263
This is some problem related to sending the attachment with response. For time being just remove the code where you are doing attachment stuff and see if security stuff works fine.
Anjali S Sharma
Ranch Hand

Joined: Jun 29, 2005
Posts: 279
shivendra tripathi wrote:This is some problem related to sending the attachment with response. For time being just remove the code where you are doing attachment stuff and see if security stuff works fine.


You are absolutely correct. If I remove the attachment stuff the code works fine. Security is working absolutely fine.
If I remove the security stuff then attachments works fine. If I keep both then attachments give the above problem.

Please guide me as to how I can resovle this.

thank you
Anjali S Sharma
Ranch Hand

Joined: Jun 29, 2005
Posts: 279
The problem was because of tcpmon. I closed tcpmon, now it is working fine.

Thanks a lot for your help.
shivendra tripathi
Ranch Hand

Joined: Aug 26, 2008
Posts: 263
Welcome
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Axis2, client handler not getting called
 
Similar Threads
WSHandler: cannot create instance of password callback
WSE security authentication problem.
SOAP Header missing using Rampart w/ Axis2 Generated Stub
digest authentication on client side implementation.
Axis2 - Unable to engage rampart