1 Reply Latest reply: Jan 24, 2012 12:38 PM by spyhunter99 RSS

web service response modification when authentication failed.

jilani2423 Newbie

Hi,

 

I have a jax ws based webservice with handler in place for user authentication.

 

I am returning false in handleMessage when the user is not authorised. So it si not calling the web service implementation method, but it is returning the reponse as request not the custome response. How to write the custoom response when authentication failed using handler.

 

My wsdl request format:

 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:n1="http://www.n1.com">

   <soapenv:Header/>

   <soapenv:Body>

      <n1:getData>

         <authenticationKey>

            <n1:userID>userID</n1:userID>

            <n1:password>password</n1:password>

         </authenticationKey>

         <SearchCriteria>

......

 

My wsdl response, when the authentication failed

 

<soapenv:Envelope xmlns:n1='http://www.n1.com' xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'><soapenv:Header></soapenv:Header><soapenv:Body>

      <n1:getData>

         <authenticationKey>

            <n1:userID xmlns:n1='http://www.n1.com'>invaliduserid</n1:userID>

            <n1:password xmlns:n1='http://www.n1.com'>password</n1:password>

         </authenticationKey>

         <SearchCriteria>

.....

 

What I need in response is

 

<soapenv:Envelope xmlns:n1='http://www.n1.com' xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'><soapenv:Header></soapenv:Header><soapenv:Body>

      <n1:getData>

            <n1:userID xmlns:n1='http://www.n1.com'>authentication failed</n1:userID>

.....

 

Please suggest me the approach to get the required response.

 

Thank You,

Jilani