Error while executing wsgen

843833
    HI,

    I am using JAXWS 2,1.......

    i am trying to develop my own example in that i am codding the implementation part

    the code is
    package Das.server;
    
    import javax.jws.WebService;
    import javax.xml.ws.BindingType;
    
    
    @javax.jws.WebService (endpointInterface="Das.server.DasImplPort")
    public class DasImpl {
    
        public String InvokeDasService (String serviceName){
    
              serviceName+="You got the Mark";
              return serviceName;
    
            }
    
    
    }
    and while i am trying to generate the artifacts using following command
    wsgen -d build -s build -classpath . Das.server.DasImpl
    it is giving me following error
    Problem encountered during annotation processing;
    see stacktrace below for more information.
    com.sun.tools.ws.processor.modeler.ModelerException: [failed to localize] The endpointInterface class Das.server.DasImplPort could not be found()
            at com.sun.tools.ws.processor.modeler.annotation.WebServiceAP.onError(WebServiceAP.java:211)         at com.sun.tools.ws.processor.modeler.annotation.WebServiceVisitor.getEndpointInterfaceDecl(WebServiceVisitor.java:384)
            at com.sun.tools.ws.processor.modeler.annotation.WebServiceVisitor.isLegalImplementation(WebServiceVisitor.java:494)
            at com.sun.tools.ws.processor.modeler.annotation.WebServiceVisitor.shouldProcessWebService(WebServiceVisitor.java:306)
            at com.sun.tools.ws.processor.modeler.annotation.WebServiceVisitor.visitClassDeclaration(WebServiceVisitor.java:109)
            at com.sun.tools.apt.mirror.declaration.ClassDeclarationImpl.accept(ClassDeclarationImpl.java:95)
            at com.sun.tools.ws.processor.modeler.annotation.WebServiceAP.buildModel(WebServiceAP.java:311)
            at com.sun.tools.ws.processor.modeler.annotation.WebServiceAP.process(WebServiceAP.java:252)
            at com.sun.mirror.apt.AnnotationProcessors$CompositeAnnotationProcessor.process(AnnotationProcessors.java:60)
            at com.sun.tools.apt.comp.Apt.main(Apt.java:454)
            at com.sun.tools.apt.main.JavaCompiler.compile(JavaCompiler.java:458)        at com.sun.tools.apt.main.Main.compile(Main.java:1075)
            at com.sun.tools.apt.main.Main.compile(Main.java:938)
            at com.sun.tools.apt.Main.processing(Main.java:95)
            at com.sun.tools.apt.Main.process(Main.java:85)
            at com.sun.tools.apt.Main.process(Main.java:67)
            at com.sun.tools.ws.wscompile.WsgenTool.buildModel(WsgenTool.java:161)
            at com.sun.tools.ws.wscompile.WsgenTool.run(WsgenTool.java:89)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at com.sun.tools.ws.Invoker.WsgenMain(Invoker.java:115)
            at com.sun.tools.ws.WsGen.main(WsGen.java:38)
    error: compilation failed, errors should have been reported
    so please do help me on this....

    Thanks a lot...
      • 1. Re: Error while executing wsgen
        843833
        Is the Das.server.DasImplPort class in your classpath?
        • 2. Re: Error while executing wsgen
          843833
          Hi,
          Thanks a lot for replying again.

          Look here i am describing the whole scenario....

          i am trying to develop an example same as fromjava sample.

          the only change is i am passing one string through client and the service will send the same string.....

          but the problem is in generating the artifacts. In sample doc there are so many ways to do that but i am bit confused after reading that.....

          because in tutorial the thing is so simple ..... we just need to run the samples using ant clean server -Dtomcat=true and ant clean client.

          but to run my own sample ...... i am bit confused in generating artifacts....

          so could you just tell me the procedure to run and deploy our own service and client..

          thanks a lot ........for replying....
          • 3. Re: Error while executing wsgen
            843833
            Have you tried reading the JAX-WS user's guide? https://jax-ws.dev.java.net/nonav/2.1/docs/UsersGuide.html and the rest of the documentation at: https://jax-ws.dev.java.net/nonav/2.1/docs/index.html

            The basic steps are:
            Server side:
            Implement a web service in java
            Compile it with apt
            create a sun-jaxws.xml file
            war it all up
            deploy it

            client side
            import the published wsdl using wsimport
            write client code to create an instance of the generated service class
            and gets a Port from the generated service class and then call methods on the port
            compile and run the client
            • 4. Re: Error while executing wsgen
              843833
              Thank again .........

              what you have suggested me is really helpful..

              i have crated the required artifacts as per your instructions.....

              but two problems i am facing right not those are

              1) after running the cmd
              wsimport i am getting the following warning
              C:\jaxws-ri\samples\Das>wsimport -d build/classes/Das/client http://localhost:80
              80/jaxws-Das/InvokeDasService?wsdl
              parsing WSDL...
              [WARNING] Ignoring SOAP port "DasImplPort": it uses non-standard SOAP 1.2 binding.
              
              You must specify the "-extension" option to use this binding.
                line 1 of http://localhost:8080/jaxws-Das/InvokeDasService?wsdl
              
              [WARNING] Service "DasImplService" does not contain any usable ports. try running wsimport with -extension switch.
                line 1 of http://localhost:8080/jaxws-Das/InvokeDasService?wsdl
              
              generating code...
              i know abt the frist warring but i am not aware of the second one so please do help at that place

              2)and i am not be able to compile my client program using javac.

              everytime it is giving me ......
              symbol  : class DasImplPort
              location: class Das.client.DasClient
                           DasImplPort port = new DasImplService().getDasImplPort();
                              ^
              C:\jaxws-ri\samples\Das\src\Das\client\DasClient.java:7: cannot find symbol
              symbol  : class DasImplService
              location: class Das.client.DasClient
                           DasImplPort port = new DasImplService().getDasImplPort();
              i have already set the classpath where DasImpl.class is....

              i am also sending the client code .....
              package Das.client;
              
              import javax.xml.ws.BindingProvider;
              public class DasClient {
                  public static void main (String[] args) {
              
                           DasImplPort port = new DasImplService().getDasImplPort();
                           log((BindingProvider)port);
              
                          String str="ContactService";
              
                          System.out.printf ("Invoking Service",str);
                          String result = port.InvokeDasService(str);
                          System.out.printf ("The result of %s\n\n", result);
              
              
                  }
                  private static final void log(BindingProvider port) {
                           if (Boolean.getBoolean("wsmonitor")) {
                               String address = (String)port.getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
                               address = address.replaceFirst("8080", "4040");
                               port.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, address);
                           }
                  }
              }
              so please do help me on this

              thank you.........
              • 5. Re: Error while executing wsgen
                843833
                HI

                i have solved the problem below...
                [WARNING] Ignoring SOAP port "DasImplPort": it uses non-standard SOAP 1.2 binding.
                 
                You must specify the "-extension" option to use this binding.
                  line 1 of http://localhost:8080/jaxws-Das/InvokeDasService?wsdl
                 
                [WARNING] Service "DasImplService" does not contain any usable ports. try running wsimport with -extension switch.
                  line 1 of http://localhost:8080/jaxws-Das/InvokeDasService?wsdl
                 
                generating code...
                by omiting the SOAP 1.2 annotations.

                but i am still facing the problem while compiling client code.......

                the code is still giving me the same errors
                symbol  : class DasImplPort
                location: class Das.client.DasClient
                             DasImpl port = new DasImplService().getDasImplPort();
                                ^
                C:\jaxws-ri\samples\Das\src\Das\client\DasClient.java:7: cannot find symbol
                symbol  : class DasImplService
                location: class Das.client.DasClient
                             DasImplPort port = new DasImplService().getDasImplPort();
                i am using javac command to compile my DasClient.java........

                so please help me in this
                thanks a lot...
                • 6. Re: Error while executing wsgen
                  843833
                  Is the DasImplService.class on your compile classpath?
                  • 7. Re: Error while executing wsgen
                    843833
                    ya it is in my classpath........
                    • 8. Re: Error while executing wsgen
                      843833
                      Will you please tell me the directory on your machine that holds the DasImplService.class file? Also please give me the exact command you are using run javac.
                      • 9. Re: Error while executing wsgen
                        843833
                        my sorce file is in
                        C:\jaxws-ri\samples\Das\src\Das\client that is DasClient.java

                        and the artifacts or DasImplService.class is in

                        C:\jaxws-ri\samples\Das\build\classes\Das\client

                        and my classpath is set to C:\jaxws-ri\samples\Das\build\classes\Das\client

                        since the classpath is set so i am using javac DasClient.java from command prompt and i have also tried it from TextPad editor.
                        • 10. Re: Error while executing wsgen
                          843833
                          Would you please include the listing of DasImplService.java?
                          • 11. Re: Error while executing wsgen
                            843833
                            Listing of DasServiceImpl.java
                            package Das.client;
                            
                            import java.net.MalformedURLException;
                            import java.net.URL;
                            import javax.xml.namespace.QName;
                            import javax.xml.ws.Service;
                            import javax.xml.ws.WebEndpoint;
                            import javax.xml.ws.WebServiceClient;
                            import javax.xml.ws.WebServiceFeature;
                            
                            
                            /**
                             * This class was generated by the JAXWS SI.
                             * JAX-WS RI 2.1-02/02/2007 03:56 AM(vivekp)-FCS
                             * Generated source version: 2.1
                             * 
                             */
                            @WebServiceClient(name = "DasImplService", targetNamespace = "http://server.Das/", wsdlLocation = "http://localhost:8080/jaxws-Das/InvokeDasService?wsdl")
                            public class DasImplService
                                extends Service
                            {
                            
                                private final static URL DASIMPLSERVICE_WSDL_LOCATION;
                            
                                static {
                                    URL url = null;
                                    try {
                                        url = new URL("http://localhost:8080/jaxws-Das/InvokeDasService?wsdl");
                                    } catch (MalformedURLException e) {
                                        e.printStackTrace();
                                    }
                                    DASIMPLSERVICE_WSDL_LOCATION = url;
                                }
                            
                                public DasImplService(URL wsdlLocation, QName serviceName) {
                                    super(wsdlLocation, serviceName);
                                }
                            
                                public DasImplService() {
                                    super(DASIMPLSERVICE_WSDL_LOCATION, new QName("http://server.Das/", "DasImplService"));
                                }
                            
                                /**
                                 * 
                                 * @return
                                 *     returns DasImpl
                                 */
                                @WebEndpoint(name = "DasImplPort")
                                public DasImpl getDasImplPort() {
                                    return (DasImpl)super.getPort(new QName("http://server.Das/", "DasImplPort"), DasImpl.class);
                                }
                            
                                /**
                                 * 
                                 * @param features
                                 *     A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy.  Supported features not in the <code>features</code> parameter will have their default values.
                                 * @return
                                 *     returns DasImpl
                                 */
                                @WebEndpoint(name = "DasImplPort")
                                public DasImpl getDasImplPort(WebServiceFeature... features) {
                                    return (DasImpl)super.getPort(new QName("http://server.Das/", "DasImplPort"), DasImpl.class, features);
                                }
                            
                            }
                            • 12. Re: Error while executing wsgen
                              843833
                              please use the following command:

                              javac -cp C:\jaxws-ri\samples\Das\build\classes\Das\client;%CLASSPATH% DasClient.java
                              • 13. Re: Error while executing wsgen
                                843833
                                It is still giving me the following error.....

                                this is command .....
                                C:\jaxws-ri\samples\Das\src\Das\client>javac -cp C:\jaxws-ri\samples\Das\build\classes\Das\client;%CLASSPATH% DasClient.java

                                DasClient.java:10: cannot find symbol
                                symbol  : class DasImpl
                                location: class Das.client.DasClient
                                                DasImpl port = new DasImplService().getDasImplPort();
                                                ^
                                DasClient.java:10: cannot find symbol
                                symbol  : class DasImplService
                                location: class Das.client.DasClient
                                                DasImpl port = new DasImplService().getDasImplPort();
                                                                   ^
                                2 errors
                                • 14. Re: Error while executing wsgen
                                  843833
                                  I don't know what to tell you anymore. It has to be a classpath issue as far as I can tell. Good luck.
                                  1 2 上一个 下一个