Hi Greg,

AFAIK you need to have an import when you're referencing an inner class without qualifying it with an outer class name, even when the outer class is in the same package as where you're making the reference. If the Status class that IPojoClass is referencing is *not* PojoClass.Status it might explain why you're not getting any content for the Status when generating from the interface. Have you tried adding "implements IPojoClass" to PojoClass, just to make sure the linkages are correct?

Jibx2Wsdl does call BindGen, why is part of why I suspect something else is going on here (though it does use other options, so it's possible that's somehow having an effect). If you still can't see anything wrong on your end, please enter a Jira bug for Jibx2Wsdl at http://jira.codehaus.org/secure/BrowseProject.jspa?id=10410 and attach a zip of your project so I can try this out for myself.

Thanks,

 - Dennis


Greg Guydo wrote:
Dennis,

In Matt's case, IPojoClass and PojoClass are in the same package, thus no need for an import. The issue there seems to be that BindGen doesn't like operating on an interface, but works just fine operating on the implementing class.

However, that is not the real problem. The main issue is that while running BindGen on PojoClass produces the correct schema, running Jibx2Wsdl on PojoClass does not. Operating under the assumption that Jibx2Wsdl calls on BindGen, how can this be??

Thanks,
Greg

On Mon, Aug 3, 2009 at 3:03 PM, Dennis Sosnoski <d...@sosnoski.com <mailto:d...@sosnoski.com>> wrote:

    Hi Matt,

    There's some sort of inconsistency here. Your interface defines
    methods taking and returning objects of type Status, yet the
    definition you've provided for Status is as an inner class within
    PojoClass (meaning it couldn't be referenced directly from the
    interface, as you've shown). What's the definition of the Status
    class referenced by the interface, which is where you're
    experiencing the actual problems? (Hint: check the imports of the
    IPojoClass)

     - Dennis


    Matt Schmidt wrote:

        Also, when I run BindGen on this class, I do get the correct
        schema for the enum. However, it does not work with an
        interface. I get the same, malformed schema as before, along
        with the warning:

        "Warning: generating mapping for interface
        com.test.matt.IPojoClass without checking properties."

        public interface IPojoClass {
               public Status getStatus();
        public void setStatus(Status status);
        }

        So that leads me to two questions:

        1) It was my understanding that Jibx2Wsdl used BindGen to
        generate the bindings. Why then does it give me 2 different
        schemas?

        2) Is there some sort of visibilty problem for the Status enum
        type? BindGen works correctly in PojoClass (where Status is
        defined), but not in IPojoClass (they are in the same package)


        Thanks for the help...

        On Mon, Aug 3, 2009 at 9:30 AM, Matt Schmidt
        <mschmid...@gmail.com <mailto:mschmid...@gmail.com>
        <mailto:mschmid...@gmail.com <mailto:mschmid...@gmail.com>>>
        wrote:

           For simplicity, I've created a very bare class that only has 1
           member, the enumeration....


           package com.test.matt;

           public class PojoClass {
           protected enum Status {
           ACCEPTED("ACCEPTED"),
           REJECTED("REJECTED");
           private final String status;
           Status (String status) {
           this.status = status;
           }
           @Override
           public String toString() {
           return status;
           }
           }
           private Status test;
           public Status getStatus() {
           return test;
           }
           public void setStatus(Status status) {
           test = status;
           }
           }


           And I am running Jibx2Wsdl with the following command:

           java -cp <jibx-tools.jar>;<my jar>
           org.jibx.ws.wsdl.tools.Jibx2Wsdl com.test.matt.PojoClass

           which gives me the following xsd: (the wsdl looks ok)

           <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
           xmlns:tns="http://com.test/matt"; elementFormDefault="qualified"
           targetNamespace="http://com.test/matt";>
             <xs:complexType name="pojoClassStatus">
               <xs:sequence/>
             </xs:complexType>
           </xs:schema>


           thanks...



           On Fri, Jul 31, 2009 at 9:59 PM, Dennis Sosnoski
        <d...@sosnoski.com <mailto:d...@sosnoski.com>
           <mailto:d...@sosnoski.com <mailto:d...@sosnoski.com>>> wrote:

               Hi Matt,

               I don't know of any reason why Jibx2Wsdl would generate the
               schema fragment you've shown for an enum reference. How
        does
               your code use the enum? And what's the enum definition look
               like, for that matter?

                - Dennis


               Matt Schmidt wrote:

                   It's been a few days, but I finally got around to
        trying
                   out Jibx2Wsdl. Unfortunately, it does not produce the
                   correct schema for enums either. My simple status enum
                   produces the following xml:

                   <xs:complexType name="pojoClassStatus">
                      <xs:sequence/>
                   </xs:complexType>

                   How can I generate this correctly?


                   On Tue, Jul 21, 2009 at 12:59 PM, Dennis Sosnoski
                   <d...@sosnoski.com <mailto:d...@sosnoski.com>
        <mailto:d...@sosnoski.com <mailto:d...@sosnoski.com>>
                   <mailto:d...@sosnoski.com <mailto:d...@sosnoski.com>
        <mailto:d...@sosnoski.com <mailto:d...@sosnoski.com>>>> wrote:

                      robert lazarski wrote:

                          Yes, use Jibx2Wsdl from jibx instead of
        java2wsdl.
                   jibx seems
                          to support enums:
http://jibx.sourceforge.net/tutorial/binding-advanced.html

                          A somewhat dated article here shows how to use
                   Jibx2Wsdl - try
                          googling for something with the latest release.

http://www.infoq.com/articles/sosnoski-code-first Beat me to it, Robert!

                      There's a newer (and more in-depth) article on
        Jibx2Wsdl at
http://www.ibm.com/developerworks/java/tutorials/j-jibx1/
                   There's
                      also a companion one covering code generation from
                   schema with
                      JiBX at
http://www.ibm.com/developerworks/java/tutorials/j-jibx2/

                       - Dennis

                      --    Dennis M. Sosnoski
                      Java XML and Web Services
                      Axis2 Training and Consulting
                      http://www.sosnoski.com - http://www.sosnoski.co.nz
                      Seattle, WA +1-425-939-0576 - Wellington, NZ
        +64-4-298-6117





Reply via email to