Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Axis2, client handler not getting called

 
Anjali S Sharma
Ranch Hand
Posts: 279
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try printing in client code. If client side handler is not getting called post your client code with jvm arguments.
 
Anjali S Sharma
Ranch Hand
Posts: 279
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 279
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apologies for posting the wrong code. Here is the client code

 
shivendra tripathi
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 279
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 279
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Tomcat logs it is showing the following

 
Anjali S Sharma
Ranch Hand
Posts: 279
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 279
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 279
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot.

Now I am getting the following

 
shivendra tripathi
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 279
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 279
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem was because of tcpmon. I closed tcpmon, now it is working fine.

Thanks a lot for your help.
 
shivendra tripathi
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic