Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. package jboss.ws.ep;
  2.  
  3. import javax.annotation.Resource;
  4. import javax.jws.HandlerChain;
  5. import javax.jws.WebParam;
  6. import javax.jws.WebParam.Mode;
  7. import javax.jws.WebService;
  8. import javax.jws.soap.SOAPBinding;
  9. import javax.xml.ws.BindingType;
  10. import javax.xml.ws.Holder;
  11. import javax.xml.ws.WebServiceContext;
  12.  
  13. import jboss.ws.bean.AuthHeader;
  14. import jboss.ws.bean.Person;
  15. import jboss.ws.fault.UserDefinedWSException;
  16.  
  17. @WebService
  18. @BindingType(value = "http://schemas.xmlsoap.org/wsdl/soap/http?mtom=true")
  19. @SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
  20. @HandlerChain(file="/jax-ws-handlers.xml")
  21. public class Hello {
  22.  
  23.     @Resource
  24.     WebServiceContext context;
  25.  
  26.     public String sayHelloException() throws UserDefinedWSException{
  27.         if (true) {
  28.             throw new UserDefinedWSException("WS Exception");
  29.         }
  30.  
  31.         return "Exception ......";
  32.     }
  33.  
  34.     public String sayHello(
  35.             @WebParam(name = "Person") Person person,
  36.             @WebParam(name = "AuthHeader", header = true, mode = Mode.INOUT) Holder<AuthHeader> holder) {
  37.         ((AuthHeader) holder.value).setStatus("header out");
  38.  
  39.         try {
  40.             Thread.sleep(5000);
  41.         } catch (InterruptedException e) {
  42.         }
  43.  
  44.         return "Hello " + person + " by JBoss 6 WS with CXF implementation.";
  45.     }
  46.  
  47. }