On Mon June 29 2009 10:54:11 am [email protected] wrote:
> On 2009-06-29 07:15:50 -0700, wytas wrote:
> > [email protected] wrote:
> > > Does this mean that I should request the WebService developer to make
> > > this element not mandatory?
> >
> > The optional field must have minOccurs="0" set:
> >
> > <xsd:element name="EndDate" type="xsd:dateTime" minOccurs="0"/>
> >
> > And of course it must be done by service provider.
> >
> > I don't know if You could ask :) because it may be that EndDate *must* be
> > specified for business logic to run. It depends on the business logic on
> > the server side.
>
> I was asking because the WebService publisher told me that I may not
> specify that EndDate but they told me to send the element as I said:
> <urn:EndDate></urn:EndDate>
> otherwise I get an error.
>
> I just wanted to know if the correct way in this use case is to have
> minOccurs="0" or it is OK to not specify the EndDate with:
> <urn:EndDate></urn:EndDate>
>
> Do you guys know an URL that I can point the WebService publisher that they
> should add minOccurs="0" to allow me not specify that dateTime field?
Well, if EndDate must be specified on the wire, minOccurs=0 is not
appropriate. nillable=true is probably more appropriate. However, that
would make the element on the wire look like:
<urn:EndDate xsi:nill="true"></urn:EndDate>
and I'm not sure if that will cause them issue.
If it has to be "blank" or a real date, then it gets a LOT more complex.
<xsd:element name="EndDate">
<xsd:simpleType>
<xsd:union memberTypes="xsd:dateTime">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:union>
</xsd:simpleType>
</xsd:element>
--
Daniel Kulp
[email protected]
http://www.dankulp.com/blog