I think there is a bug with the auto-complete="true", with the
auto-completed fields not propagating the namespace set on the class.

I have an xml mapping for a class which I have set auto-complete="true"
on as follows:
<class name="com.foo.ContractLookupDto" auto-complete="true">
  <map-to xml="getContractRequest"
ns-uri="http://example.com/services/"/>
</class>
The ContractLookupDto class contains a field 'contractId'.

When clients send xml to my unmarshaller it fails to unmarshal with the
following error:
 Castor unmarshalling exception: unable to find FieldDescriptor for
'contractId' in ClassDescriptor of getContractRequest.

When trying to debug, I created a ContractDto sample and marshalled it
to see what xml it produced.  I then noticed that when it auto-completes
the fields for my class, they have xmlns="" on them, which explains why
xml sent from the client fails.

This looks like a bug with the auto-complete implementation.
As a workaround, I found that after changing my mapping to 
<class name="com.foo.ContractLookupDto" auto-complete="true">
  <map-to xml="getContractRequest"
ns-uri="http://example.com/services/"/>
  <field name="contractId"/>
</class>
Now my ContractDto sample marshalls to xml correctly (i.e. without the
xmlns="") and clients can successfully send xml.

It would be great if someone could look into this bug, as I think it
significantly reduces the value of the auto-complete option.

Thanks.

Reply via email to