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 "Yu, Joel, Contractor" <Jo...@asamra.hoffman.army.mil> on 2004/05/19 19:40:30 UTC

xsd:choice problem with axis 1.1

I have an xsd:choice type defined as follow:

<xsd:complexType name="JobBodyType">
 <xsd:annotation>
  <xsd:documentation>Required. Either the entire job body may be submited,
or the body may be broken out into it's parts as XML. If the entire job body
is to be submitted, it should be enclosed in a TextJobBody Tag. Do not
submit both an entire body, and an XML version of the job
body.</xsd:documentation> 
  </xsd:annotation>
 <xsd:choice>
  <xsd:element name="XmlJobBody" type="XmlJobBodyType" /> 
  <xsd:element name="TextJobBody" type="xsd:string" /> 
 </xsd:choice>
</xsd:complexType>

For the wsdl2java generated object for this type, I called
setXmlJobBody(XmlJobBodyType xmlJob) to set the XmlJobBody, I did not call
setTextJobBody.  The request message axis build however inculdes TextJobBody
as shown in the request message show below:
 
<JobBody>
      <XmlJobBody>
		...........
		..........
      </XmlJobBody>
      <TextJobBody xsi:nil="true"/>
 </JobBody>


this produces the following error:

AxisFault
 faultCode: Client.InvalidDocument  faultSubcode: 
 faultString: Error validating request, error=Document fails validation at
line 1, column 7478 ,error=cvc-complex-type.2.4.d: Invalid content was found
starting with element &apos;TextJobBody&apos;. No child element is expected
at this point.  faultActor: 
 faultNode: 
 faultDetail: 
	{http://xml.apache.org/axis/}stackTrace: AxisFault
 faultCode: Client.InvalidDocument
 faultSubcode: 
 faultString: Error validating request, error=Document fails validation at
line 1, column 7478 ,error=cvc-complex-type.2.4.d: Invalid content was found
starting with element &amp;apos;TextJobBody&amp;apos;. No child element is
expected at this point.  faultActor: 
 faultNode: 
 faultDetail: 


My question is, what does xsi:nil="true" mean?  is this request message
invalide to include an entry for both XmlJobbody and TextJobBody since this
is suppose to be a xsd:choice type?

thanks