fair enough! ;-)

On 12/21/06, Benson Margulies <[EMAIL PROTECTED]> wrote:

 I'm not enough of an XMLSchema expert to know.


 ------------------------------

*From:* Ruth, Brice D [mailto:[EMAIL PROTECTED]
*Sent:* Thursday, December 21, 2006 4:38 PM
*To:* [email protected]
*Subject:* RE: [xfire-user] WSDL Contains 'minOccurs="0"' For Required
Fields



if minOccurs == 1, shouldn't nillable = false?



-----Original Message-----
*From:* Benson Margulies [mailto:[EMAIL PROTECTED]
*Sent:* Thursday, December 21, 2006 3:29 PM
*To:* [email protected]
*Subject:* RE: [xfire-user] WSDL Contains 'minOccurs="0"' For Required
Fields

Try creating an XML file like the following, named ClassName.aegis.xml.



<mappings xmlns:ns="urn:no-such-urn ">

      <mapping name="ns:ClassName">

        <property name='propname' minOccurs='1' nillable='true'/>

      </mapping>

</mappings>



Or see the bottom of http://xfire.codehaus.org/Aegis+Binding.
 ------------------------------

*From:* Preston Lee [mailto:[EMAIL PROTECTED]
*Sent:* Thursday, December 21, 2006 4:25 PM
*To:* [email protected]
*Subject:* RE: [xfire-user] WSDL Contains 'minOccurs="0"' For Required
Fields



Ok, I think I'm heading in the right direction now,  but after adding
@XmlElement(nillable = false) to the reader methods of my DTOs (using
org.codehaus.xfire.aegis.type.java5.XmlElement), nothing seems to change.
Also no effect using @XmlElement(nillable = false, required = true) with the
javax.xml.bind.annotation.XmlElement version.  I really do want to keep
them as elements, so I'm reluctant to use XmlAttribute.



I haven't defined any binding customizations, so based on the
documentation I think I'm using aegis. (Not sure how to check though.) What
does "nillable = false" do if not affect minOccurs="0"?



Preston


 ------------------------------

*From:* Brice Ruth [mailto:[EMAIL PROTECTED]
*Sent:* Wednesday, December 20, 2006 8:11 PM
*To:* [email protected]
*Subject:* Re: [xfire-user] WSDL Contains 'minOccurs="0"' For Required
Fields

With JAXB2 (and maybe with the other bindings, too) - you can specify
annotations, for XmlElement, you can provide 'nillable=true/false' and with
XmlAttribute, you can specify 'required=true/false'.

I'm guessing this is the path you'll need to go down, either customizing
your POJOs with annotations specific to the binding you're using (jaxb2,
xmlbeans, aegis, etc.) or customizing the xsd generated by XFire and
providing a custom xsd instead of letting XFire generate it from that point
forward.

There may be other routes/mechanisms, but that's all I've found.

Cheers,
Brice

On 12/20/06, *Preston Lee* < [EMAIL PROTECTED]> wrote:

I have an XFire service being consumed by a .net application which is
giving me grief. It seems to boil down to the minOccurs="0" attribute
being added to required elements of objects passed as parameters to my
service methods.

Here's a relevant section of the WSDL which shows the undesired
minOccurs="0" attribute (type names have changed for IP reasons)..

--BEGIN WSDL SNIPPET--
<xsd:complexType name="DataDto">
  <xsd:sequence>
    <xsd:element minOccurs="0" name="id" type="xsd:long" />
    <xsd:element minOccurs="0" name="date" type="xsd:dateTime" />
    <xsd:element minOccurs="0" name="someString" nillable="true"
type="xsd:string" />
    <xsd:element minOccurs="0" name="anotherString" nillable="true"
type="ns1:AnotherType" />
  </xsd:sequence>
</xsd:complexType>
--END--

The non-trivial model objects being accepted by the service, as well as
all fields of those objects, need to be set, so I'm pretty sure I don't
want 'minOccurs="0"' to be valid. When the .net guy generates his
classes, he ends up with "setIdSpecified" as well as "setId", for
example, since id is a primitive type and there isn't another way to
differentiate between 0 and null. (I don't think the .net generator
would do this if minOccurs was gone.) Is there an annotation I need to
add to fields of my DTOs which marks them as "required"? Help greatly
appreciated! Thanks,

Preston

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email




--
Brice Ruth
Software Engineer, Madison WI




--
Brice Ruth
Software Engineer, Madison WI

Reply via email to