I am using Axis2 1.2 and the AntCodegenTask.

I have been struggling with the following error in some vendor supplied
wsdl. I use the wsdl2java ant task to generate the java code and then
get this compiler error.

compile:
    [mkdir] Created dir: /home/sjh/Misc/xml/soapTest/classes
    [javac] Compiling 8 source files to
/home/sjh/Misc/xml/soapTest/classes
    [javac]
/home/sjh/Misc/xml/soapTest/java/src/localhost/testwsdl/Message.java:28:
cannot resolve symbol
    [javac] symbol  : variable localSequenceTracker
    [javac] location: class localhost.testwsdl.Message
    [javac]                    localSequenceTracker = false;
    [javac]                    ^
    [javac] 1 error

Looking in the java the Message class extends an abstract class
AbstractMessage, which defines a protected variable "sequence". The
message class then tries to the tracker for this variable but does not
declare the tracker.

I have stripped the wsdl down to a simple test case, the key fragment is
shown below.

<!-- ==================== Test Fragment
=================================== -->
<!-- ==================== Types
=========================================== -->

  <wsdl:types>
    <xsd:schema
      targetNamespace="http://localhost/testWsdl";
      >

      <xsd:complexType name="abstractMessage" abstract="true">
        <xsd:attribute name="sequence" type="xsd:unsignedLong"/>
      </xsd:complexType>

      <xsd:complexType name="message">
        <xsd:complexContent>
          <xsd:extension base="test:abstractMessage">
            <xsd:choice>
              <xsd:element name="userId" type="xsd:string"/>
              <xsd:element name="content" type="xsd:string"/>
            </xsd:choice>
          </xsd:extension>
        </xsd:complexContent>
      </xsd:complexType>

      <xsd:element name="messageReq" type="test:message"/>
      <xsd:element name="messageResp" type="test:message"/>
    </xsd:schema>
  </wsdl:types>

<!-- ==================== Messages
======================================== -->

  <wsdl:message name="messageRequest">
    <wsdl:part name="parameters" element="test:messageReq"/>
  </wsdl:message>
  <wsdl:message name="messageResponse">
    <wsdl:part name="parameters" element="test:messageResp"/>
  </wsdl:message>

<!-- ==================== End Of Test Fragment
============================ --> 

The key features of this fragment that cause the bug are that
1) The variable in the abstract type is declared as an attribute, not an
element
2) The elements in the extended type are declared in choice tags.

Is this an AXIS2 bug or is just a bad XSD? If a bug should I create a
JIRA? I cannot see any reports of this in either the mailing list or the
JIRA repository.

Can anybody suggest a work around that would produce exactly the same
SOAP, as I am using this against a 3rd party interface (supplied by a
large San Francisco based router manufacturer that shall remain
nameless) so have no control over the format of the messages.

I did try to replicate this in 1.3 RC2 but I see that the wsdl2java task
was omitted. I notice as I am writing this that RC3 has just been
released so I will test against that later today.
 

Steve Hindmarch



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to