Java Mailing List Archive

http://www.junlu.com/

Home » user.castor »

[castor-user] unable to find FieldDescriptor

PorridgeBear

2010-02-11

Replies: Find Java Web Hosting

Author LoginPost Reply

Hi,

I am consuming a very simple web service that returns a card type, e.g.
VISA, given a card number. I have no problem calling the web service and
acquiring the response. I cannot get Castor to map the response onto a plain
POJO. Details below:

XML Returned

<?xml version="1.0" encoding="UTF-8"?><GetCardTypeResponse
xmlns="http://localhost/SmartPayments/"><GetCardTypeResult>VISA</GetCardTypeResult></GetCardTypeResponse>

Mapping Class

 <class name="CardTypeResponse">
   <map-to xml="GetCardTypeResponse" />
   
   <field name="cardType" type="string">
     <bind-xml name="GetCardTypeResult" />
   </field>
 </class>

Class

public class CardTypeResponse {

 private String cardType;

 public String getCardType() {
   return cardType;
 }

 public void setCardType(String cardType) {
   this.cardType = cardType;
 }
}

Unmarshal Call

CardTypeResponse ct = (CardTypeResponse) this.unmarshaller.unmarshal(s);

Exception

Caused by: org.exolab.castor.xml.MarshalException: unable to find
FieldDescriptor for 'GetCardTypeResult' in ClassDescriptor of
GetCardTypeResponse{File: [not available]; line: 1; column: 119}
 at
org.exolab.castor.xml.Unmarshaller.convertSAXExceptionToMarshalException (Unmarshaller.java:761)
 at org.exolab.castor.xml.Unmarshaller.unmarshal (Unmarshaller.java:727)
 at
org.springframework.oxm.castor.CastorMarshaller.unmarshalReader (CastorMarshaller.java:384)
 ... 96 more
Caused by: org.xml.sax.SAXException: unable to find FieldDescriptor for
'GetCardTypeResult' in ClassDescriptor of GetCardTypeResponse
 at
org.exolab.castor.xml.UnmarshalHandler.startElement (UnmarshalHandler.java:2000)
 at
org.exolab.castor.xml.UnmarshalHandler.startElement (UnmarshalHandler.java:1418)
 at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
 at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown
Source)
 at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
 at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
 at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
 at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
 at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
 at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
 at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
 at org.exolab.castor.xml.Unmarshaller.unmarshal (Unmarshaller.java:715)
 ... 97 more
--
Sent from the Castor - User mailing list archive at Nabble.com.


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

  http://xircles.codehaus.org/manage_email


©2008 junlu.com - Jax Systems, LLC, U.S.A.