2 Replies Latest reply on Aug 10, 2009 3:50 AM by delicjapatrycja

    wsconsume and implementing interface top-down

      Hi
      (It's my first post, I was trying to find something about my problem but I couldn't )

      I have some problem with deploy my Jax WS Web service.
      I'm trying to do this using top-down method - wsconsume. When I generate java classes from WSDL which I have written before, I get one which is the interface.
      How should I implement it ?
      How should I write the web.xml ? which class name should I write inside <servlet-class> </servlet-class> tags ?

      If i write the generated class name, how jax-ws knows where (in which java class) is implementing class ?
      If I write the class name inside, which impelements generated interface, I can't deploy the web service. (maybe I do something wrong?)


      part of Service class generated by Jax-WS:

      // [...]
      @WebService(name = "XXXService", targetNamespace = "http://xxx.com/XXX/ws")
      public interface XXXService {
      
      
       /**
       *
       * @param in
       * @return
       * returns int
       * @throws Method1FaultMsg
       */
       @WebMethod
       @WebResult(name = "out", targetNamespace = "")
       @RequestWrapper(localName = "method1", targetNamespace = "http://xxx.com/XXX/ws", className = "com.xxx.xxx.ws.Method1")
       @ResponseWrapper(localName = "method1Response", targetNamespace = "http://xxx.com/xxx/ws", className = "com.xxx.xxx.ws.Method1Response")
       public int method1(
       @WebParam(name = "in", targetNamespace = "")
       int in)
       throws Method1FaultMsg
       ;
      // [...]
      
      


      My implementation class:

      
      public class XXXServiceImpl implements com.xxx.xxx.ws.XXXService {
      
      
       @WebMethod
       @WebResult(name = "out", targetNamespace = "")
       @RequestWrapper(localName = "method1", targetNamespace = "http://xxx.com/xxx/ws", className = "com.xxx.xxx.ws.Method1")
       @ResponseWrapper(localName = "method1Response", targetNamespace = "http://xxx.com/xxx/ws", className = "com.xxx.xxx.ws.Method1Response")
       public int method1(int in) throws Method1FaultMsg
       {
       try
       {
       return in*2;
       }
       catch(Exception e)
       {
       new Method1FaultMsg("Server Exception", new ServerException(), e);
       }
       return in;
       }
      
      


      Any tips?

      Anyway, sorry for my English :/

        • 1. Re: wsconsume and implementing interface top-down
          meetoblivion

          i think you may have your implementation strategies mixed up.

          if you're using wsconsume, it assumes that you've already written the webservice, and wsconsume helps create the client interface.

          if you're using wsprovide, it assumes you've written the WSDL and need to generate the server side stubs.

          Why fits your scenario better?

          • 2. Re: wsconsume and implementing interface top-down

             

            "meetoblivion" wrote:
            i think you may have your implementation strategies mixed up.

            if you're using wsconsume, it assumes that you've already written the webservice, and wsconsume helps create the client interface.

            if you're using wsprovide, it assumes you've written the WSDL and need to generate the server side stubs.

            Why fits your scenario better?


            I'm using wsconsume (I have written WSDL).

            Now I know what I did wrong: I just forget the Annotation in my implementation class:

            @javax.jws.WebService(endpointInterface="com.xxx.xxx.ws.XXXService")

            The service works :)


            Now I will try to write client in .NET/C#
            If I would have a problem, I will ask here