• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to add header to soap response using axis2 and java?

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to add header to soap response using axis2? I have a client ----

and a service from where the header will be set as soap response as -



But the response message I am getting as -

<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header/><soapenv:Body><ns:sendResponseOrAckResponse xmlns:ns="http://service.ttg.tcs.com/xsd"><ns:return>org.apache.axis2.saaj.SOAPMessageImpl@179953c</ns:return></ns:sendResponseOrAckResponse></soapenv:Body></soapenv:Envelope>

In the response message see that the header is blank. I want the headers under the header tag and the body contents under the body tag. Right now the entire response comes under body tag.

Please help me to solve the problem.

Thanks in advance.
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sanjoy,

Please use AbstractHandler. Write a class extending AbstractHandler and orverride invoke() method. Invoke method will provide you with a provision to get soap envelope and set header in the response.

Thanks,
Kesava
 
Sanjoy De
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Kesava,

Thanks for your quick reply. Actually im new to webservice, so, can you please give me an example for adding header to soap message response?
That will be very helpful.

Thanks
 
Sanjoy De
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Kesava,

I have written a Handler, but dont know how to use that inside a webservice and how to call. Can you please help me?


Thanks,
Sanjoy
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your code would not call the handler explicitly. You would declare the handler as part of the request and/or response flow in the client-side and/or server-side deployment descriptors (the WSDD files).
reply
    Bookmark Topic Watch Topic
  • New Topic