java - How to add response header in JAX-WS -


i have developed web-service based web component, publishing service using web service , want add headers in response client can use header response result

my web service class ..

@webservice() public class fooservice{  @webmethod() public string foowebmethod(string input){ //----some code----   return resultstring;  }  } 

my web service client class ..

public class webservinvoker {  public static void main(string[] args) {              fooserviceservicelocator locator = new fooserviceservicelocator();              fooservice wsclient = locator.getfooserviceport();              wsclient.foowebmethod("some string");         } } 

now want send information user in web service response , have no idea how please me

add handler. 1 way below

@webservice() @handlerchain(file = "fooservice-handlerchain.xml") public class fooservice{       //your code  } 

then handler file

<handler-chains xmlns="http://java.sun.com/xml/ns/javaee">   <handler-chain>   <service-name-pattern xmlns:ns1="yournamespacepattern">ns1:fooservice</service-name-pattern>   <handler>      <handler-name>handlerclassname</handler-name>      <handler-class>packagename.handlerclassname</handler-class>   </handler> 

and handler class

 public class handlerclassname implements soaphandler<soapmessagecontext>  {   public handlerclassname () {  }  public set<qname> getheaders(){     return // set of headers; }   public boolean handlemessage(soapmessagecontext context) {      //handle message } 

}


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

php - Accessing static methods using newly created $obj or using class Name -