9 Replies Latest reply on Mar 7, 2007 12:46 AM by monowai

    Generate wsdl from JSR 181 POJO

    Dan Smith Newbie

      Is it possible to generate the WSDL file from a JSR-181 POJO endpoint using wstools or some other tool?

      I was able to do this using Suns wsgen tool, but when I use the client based on that generated WSDL I get a org.jboss.ws.jaxb.UnmarshalException thrown from the server.

        • 1. Re: Generate wsdl from JSR 181 POJO
          monowai Newbie

          I too am now strugling with this. Seems to be that the Axis project bundled one - Java2WSDL - but JBoss is no longer supporting that release (ws4?) in the jboss-ws version shipping since AS 4.0.4.

          It would be nice if the creation of WSDL files, or lack there of, were a little more clearly documented in what's offered. Even if it was just a simple NO! it would save a bit of searching :)

          Seems to be nothing in the Wiki FAQ. my search continues....

          • 2. Re: Generate wsdl from JSR 181 POJO
            monowai Newbie

            Having just posted that, checkout http://www.soapui.org, it may help you on the way.

            • 3. Re: Generate wsdl from JSR 181 POJO
              monowai Newbie

              I assume by the deafening silence on this, that this is either a really stupid question, or we're the only suckers doing this ¯\(°_o)/¯

              Here's how it works for me. Create a file called wstools-java-to-wsdl.xml based upon wstools-config.xml but have it include the <java-wsdl> tags. Here is an example based on the 181ejb example:

               <service name="TestService" style="rpc"
               <namespaces target-namespace="http://org.jboss.ws/samples/jsr181ejb"
               <mapping file="jaxrpc-mapping.xml"/>
               <webservices servlet-link="TrivialEndpoint"/>

              Then, run the wstools with the following arguments:

              -cp [FULL_PATH_TO_CLASS_FILE] -config ./resources/wstools-config.xml -dest ./resources/META-INF

              My paths are relative to the folder jbossws-samples-1.0.4.GA\jaxws\jsr181ejb folder.

              When run, it will create the META-INF/wsdl/TestServices.wsdl file.

              It seems that wstools is not selective in what it creates. If you specify <java-wsdl> in your main wstools-config file, and you run the JBOSS sample ANT build files, then the WSDL will be recreated each time, overwriting your <soap:address location=.../> tag, which is not what you probably want to happen. I haven't looked in to how this works yet.

              Likewise if the .wsdl file doesn't exist, then when you run your java2wsdl command, it will error complaining that it "can't load wsdl file" if your config contains the <wsdl-java> tags; Bit of a circular refrence going on there!


              • 4. Re: Generate wsdl from JSR 181 POJO
                David Win Newbie

                To make it easier, you guys may want to consider using SOAPUI


                if you use eclipse, you simply right click on the POJO and generate the webservice from it.

                • 5. Re: Generate wsdl from JSR 181 POJO
                  monowai Newbie

                  Indeed. Still it's nice to know what's going on behind the scenes, and a good UI is not really a substitute for clear doco.

                  I'm an Intellij user and with these IDE's being the memory hogs they are, running eclipse simply to maintain a few XML files is a bit of a pain; Soap's IntelliJ support is pretty basic, so I'll continue with the full UI I guess.

                  On the side, having just checked out the source for SOAPUI - and most of the jboss projects - it really feels like stepping back in time using ANT over Maven; All that configuration in your IDE, it's Like going from an automatic car to a manual. Geeze I've lost track of how many commons-collections and jaxb jars I've got lying around for all these o/s projects. Maven's on demand centralized repository structure is pure magic.

                  Oh well. The fun continues.

                  • 6. Re: Generate wsdl from JSR 181 POJO
                    Sammy Stag Newbie


                    I've been looking at this too over the last few days. The easiest way I can find is to do the following:

                    1) Compile your annotated JSR 181 pojo
                    2) Create a war file containing just the pojo class and web.xml
                    3) Deploy the war file and use your browser to get the WSDL by browsing to, for example, http://localhost:8080/jaxws-samples-jsr181pojo/TestService?wsdl
                    4) Save the WSDL and use this to generate the endpoint interface, JAX-RPC mapping, etc as per the example in the JBossWS user guide.

                    If you look at the war file created by the JSR181 POJO example, you will see that it doesn't include the supplied WSDL file. The WSDL file is provided just for use by wstools, and is basically identical to the one you will get from your browser.

                    jar tvf output/libs/jaxws-samples-jsr181pojo.war

                    It ought to be possible to get hold of the WSDL some other way, but I haven't figured it out yet. A bit of a shortcoming in the example I think.

                    • 7. Re: Generate wsdl from JSR 181 POJO
                      Sammy Stag Newbie

                      Two more comments to make about this:

                      1) In wstools-config.xml, "location" can be a URL, so you don't need to save the WSDL to a file.

                      2) In wstools-config.xml, you might need to substitute "location" for "file" depending on your version of jbossws-client.jar. The version supplied with JBoss 4.0.5 GA expects "file". The version (in the "thirdparty" directory) which the example compiles against expects "location".

                      • 8. Re: Generate wsdl from JSR 181 POJO
                        Thomas Diesler Master

                        This should be fixed in jbossws-1.2.0

                        • 9. Re: Generate wsdl from JSR 181 POJO
                          monowai Newbie


                          "thomas.diesler@jboss.com" wrote:
                          This should be fixed in jbossws-1.2.0

                          Having moved to 1.2, things seem a lot smoother. thanks for all the effort Thomas, I can only imagine what goes in to getting this right.

                          wsproduce and wsconsume seem to do a fine job and the reduced level of annotations to get things right is a real boon.

                          Allan's suggestions were also valuable. Obtaining the wsdl straight from the server makes a lot of sense, and the fact you don't need to generate this to deploy your webservices is v. useful

                          cheers all