You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Axel Bock <ax...@googlemail.com> on 2006/10/24 16:25:02 UTC

[Axis1.4] MinOccurs is ignored with string types?

Hi all,

I have a WSDL file with a schema definition like this:

 <xs:complexType name="Professional">
  <xs:sequence>
   <xs:element name="name" type="Name" />
   <xs:element name="contact" type="ContactData" minOccurs="0" />
   <xs:element name="qualification" type="Qualification" />
   <xs:element name="additionalQualification" type="Qualification"
minOccurs="0" />
   <xs:element name="organizationName" type="xs:string" minOccurs="0" />
  </xs:sequence>
 </xs:complexType>

Now when I generate Axis stubs with this definition I will get the following
code in Professional.java:

        typeDesc.setXmlType(new javax.xml.namespace.QName("
http://bpm.icw.com/regservices/v1-0-0/domain", "Professional"));
        org.apache.axis.description.ElementDesc elemField = new
org.apache.axis.description.ElementDesc();
        elemField.setFieldName("organizationName");
        elemField.setXmlName(new javax.xml.namespace.QName("
http://bpm.icw.com/regservices/v1-0-0/domain", "organizationName"));
        elemField.setXmlType(new javax.xml.namespace.QName("
http://www.w3.org/2001/XMLSchema", "string"));
        elemField.setNillable(false);
        typeDesc.addFieldDesc(elemField);
        elemField = new org.apache.axis.description.ElementDesc();
        // ...

As you can see the MinOccurs command is completely ignored on the
organization element. On the other optional complex types this is not a
problem, though. I adjusted the MinOccurs to 5 and the MaxOccurs to 7, and
even then no (min/max)Occurs property setting was present in the generated
code.

So now I think that maybe Axis has a problem with simple types like String
when it comes to generate code with occurrency information. Can anyone
confirm this, maybe? Or tell me what I'm doing wrong? Or - best of all :-) -
give me a workaround?


Greetings & thanks in advance,
Axel.

Re: [Axis1.4] MinOccurs is ignored with string types?

Posted by Axel Bock <ax...@googlemail.com>.
Hi Martin,

I did that, and it worked. But that's not a very good solution for us - we
rely on auto-code-generation here ;-) . Still it worked just fine for the
time being.


greetings & thanks,
Axel.


On 10/24/06, Martin Gainty <mg...@hotmail.com> wrote:
>
>  Axel-
>
> what happens if you set the minOccurs and maxOccurs attributes e.g.
> elemfield.setMinOccurs(SomeLowNumberLessThanHigherNumber);
> elemfield.setMaxOccurs(SomeHigherThanLowNumber);
>
> M-
> This e-mail communication and any attachments may contain confidential and
> privileged information for the use of the
> designated recipients named above. If you are not the intended recipient,
> you are hereby notified that you have received
> this communication in error and that any review, disclosure,
> dissemination, distribution or copying of it or its
> contents
>
> ----- Original Message -----
> *From:* Axel Bock <ax...@googlemail.com>
> *To:* axis-user@ws.apache.org
> *Sent:* Tuesday, October 24, 2006 10:25 AM
> *Subject:* [Axis1.4] MinOccurs is ignored with string types?
>
>
> Hi all,
>
> I have a WSDL file with a schema definition like this:
>
>  <xs:complexType name="Professional">
>   <xs:sequence>
>    <xs:element name="name" type="Name" />
>    <xs:element name="contact" type="ContactData" minOccurs="0" />
>    <xs:element name="qualification" type="Qualification" />
>    <xs:element name="additionalQualification" type="Qualification"
> minOccurs="0" />
>    <xs:element name="organizationName" type="xs:string" minOccurs="0" />
>   </xs:sequence>
>  </xs:complexType>
>
> Now when I generate Axis stubs with this definition I will get the
> following code in Professional.java:
>
>         typeDesc.setXmlType(new javax.xml.namespace.QName("http://bpm.icw.com/regservices/v1-0-0/domain
> ", "Professional"));
>         org.apache.axis.description.ElementDesc elemField = new
> org.apache.axis.description.ElementDesc();
>         elemField.setFieldName ("organizationName");
>         elemField.setXmlName(new javax.xml.namespace.QName("http://bpm.icw.com/regservices/v1-0-0/domain
> ", "organizationName"));
>         elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema",
> "string"));
>         elemField.setNillable(false);
>         typeDesc.addFieldDesc(elemField);
>         elemField = new org.apache.axis.description.ElementDesc();
>         // ...
>
> As you can see the MinOccurs command is completely ignored on the
> organization element. On the other optional complex types this is not a
> problem, though. I adjusted the MinOccurs to 5 and the MaxOccurs to 7, and
> even then no (min/max)Occurs property setting was present in the generated
> code.
>
> So now I think that maybe Axis has a problem with simple types like String
> when it comes to generate code with occurrency information. Can anyone
> confirm this, maybe? Or tell me what I'm doing wrong? Or - best of all :-) -
> give me a workaround?
>
>
> Greetings & thanks in advance,
> Axel.
>
>
>
>
>
>
>
>

Re: [Axis1.4] MinOccurs is ignored with string types?

Posted by Martin Gainty <mg...@hotmail.com>.
Axel-

what happens if you set the minOccurs and maxOccurs attributes e.g.
elemfield.setMinOccurs(SomeLowNumberLessThanHigherNumber);
elemfield.setMaxOccurs(SomeHigherThanLowNumber);

M-
This e-mail communication and any attachments may contain confidential and privileged information for the use of the 
designated recipients named above. If you are not the intended recipient, you are hereby notified that you have received
this communication in error and that any review, disclosure, dissemination, distribution or copying of it or its 
contents
  ----- Original Message ----- 
  From: Axel Bock 
  To: axis-user@ws.apache.org 
  Sent: Tuesday, October 24, 2006 10:25 AM
  Subject: [Axis1.4] MinOccurs is ignored with string types?


  Hi all, 

  I have a WSDL file with a schema definition like this: 
     <xs:complexType name="Professional">
      <xs:sequence>
       <xs:element name="name" type="Name" />
       <xs:element name="contact" type="ContactData" minOccurs="0" /> 
       <xs:element name="qualification" type="Qualification" />
       <xs:element name="additionalQualification" type="Qualification" minOccurs="0" />
       <xs:element name="organizationName" type="xs:string" minOccurs="0" /> 
      </xs:sequence>
     </xs:complexType>
  Now when I generate Axis stubs with this definition I will get the following code in Professional.java: 

          typeDesc.setXmlType(new javax.xml.namespace.QName("http://bpm.icw.com/regservices/v1-0-0/domain ", "Professional"));
          org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
          elemField.setFieldName ("organizationName");
          elemField.setXmlName(new javax.xml.namespace.QName("http://bpm.icw.com/regservices/v1-0-0/domain ", "organizationName"));
          elemField.setXmlType(new javax.xml.namespace.QName(" http://www.w3.org/2001/XMLSchema", "string"));
          elemField.setNillable(false);
          typeDesc.addFieldDesc(elemField);
          elemField = new org.apache.axis.description.ElementDesc();
          // ... 
   
  As you can see the MinOccurs command is completely ignored on the organization element. On the other optional complex types this is not a problem, though. I adjusted the MinOccurs to 5 and the MaxOccurs to 7, and even then no (min/max)Occurs property setting was present in the generated code. 

  So now I think that maybe Axis has a problem with simple types like String when it comes to generate code with occurrency information. Can anyone confirm this, maybe? Or tell me what I'm doing wrong? Or - best of all :-) - give me a workaround? 


  Greetings & thanks in advance, 
  Axel.