7 Replies Latest reply on May 26, 2006 4:07 PM by burrsutter

    POJO Complex Type mappings

    rbarndt

      When using the JSR-181 annotations, JBoss 4.0.4 GA with JBossWS 1.0. I want to retiurn a complex type...Any exmaple how to do this....Looking for both the server implementation and example and client....The help would be greatly appreciated, migrating my web services from AXIS 1.X....Thx Rich.

        • 1. Re: POJO Complex Type mappings
          burrsutter

          Here is one sample that I worked up for the server-side:

          package org.jboss.samples; //note: not part of anything official
          
          import javax.jws.WebMethod;
          import javax.jws.WebService;
          import javax.jws.soap.SOAPBinding;
          import javax.jws.soap.SOAPBinding.Use;
          
          @WebService
          @SOAPBinding(style = SOAPBinding.Style.RPC)
          public class POJOService {
           @WebMethod(operationName="GetPersonByID")
           public Person getPerson(String id)
           {
           System.out.println("Looking for " + id);
           Person somebody = new Person();
           somebody.setName("Burr Sutter");
           somebody.setAge(24);
           somebody.setBirthDate(new java.util.Date());
           return somebody;
           }
          
           @WebMethod (operationName="GetAllPeopleArray")
           public Person[] getPeople2() {
           Person[] results = new Person[2];
           Person a = new Person();
           a.setName("Burr Sutter");
           a.setAge(24);
           a.setBirthDate(new java.util.Date());
           results[0] = a;
           Person b = new Person();
           b.setName("Thomas Diesler");
           b.setAge(23);
           b.setBirthDate(new java.util.Date());
           results[1] = b;
          
           return results;
           }
          }



          My client code is in VB.NET so I suspect that isn't helpful to you. I might get around to building a Java client to this service over the weekend.

          Burr



          • 2. Re: POJO Complex Type mappings
            rbarndt

            Burr,

            Thank you, The code side looks good, how to deploy, what goes in the war..What are the entries in the web.xml file....Post your working code with war? Thx for the reply...

            • 3. Re: POJO Complex Type mappings
              matabu

              Hi rbarndt.

              Look at this: http://labs.jboss.com/portal/jbossws/user-guide/en/html/endpoints.html#jsr181-endpoints

              Only pack your webservice classes into your classes folder of the war file and edit the web.xml as described on the website i mentioned above. Then deploy... I think that should work :)

              Greets, Andy

              • 4. Re: POJO Complex Type mappings
                rbarndt

                Anyd, Thx....What about the in your example the person class? Where does it go? Sorry about the confusion just dont know where it is going to find it? War? If in the war just its root or specific path?

                Rich

                • 5. Re: POJO Complex Type mappings
                  matabu

                  Hmmm...

                  I only packed the webservice stuff into a jar file which is packed with an war file into an ear file :)

                  it has this structure:

                  earfile
                  +-- warfile
                  +-- many stuff from jspwiki ;)
                  +-- jarfile
                  +----- many folders
                  +----- mase
                  +----- several other class folders
                  +----- webservice
                  +-------- MaseSystemService
                  +-------- MaseSystemServiceImpl
                  +-------- MaseSystemServiceUtil
                  +-------- (<- this is only a helper to convert my objects into the primitive +-------- objects)
                  +-------- data <- in this folder I have my objects

                  If you want to have a look at the sources you can download them at sourceforge (http://sourceforge.net/projects/mase) Choose the MASE3 project from the subversion repository... (in the cvs is only old stuff)

                  But I am not sure if all stuff works fine... because I am a newbie in this field ;) And I think I am slowly getting crazy because my ws doesn'T work with C#.NET :( But as I said with this nice Eclipse plugin I am able to use my methods

                  By the way this project works only with JbossAS 4.0.4CR2... My colleague is working for the migration to the GA version but he is still sticking all stuff together ;)

                  Greets Andy

                  • 6. Re: POJO Complex Type mappings
                    matabu

                    Oh sry.. i confused the post...

                    I mentioned the Eclipse plugin at an other thread not in here. But if you are also intersted you can find more information in here:

                    http://www.eclipse.org/webtools/jst/components/ws/M4/tutorials/WebServiceExplorer.html

                    Greets Andy

                    • 7. Re: POJO Complex Type mappings
                      burrsutter

                      I'm following this "formula" for building 181 Web Services and Person.class lives in the same directory/package as the POJOService class.

                      Here is a link to the process that I follow:
                      http://www.jboss.com/index.html?module=bb&op=viewtopic&t=82232

                      Burr