Java Mailing List Archive

http://www.junlu.com/

Home » user.castor »

Re: [castor-user] unable to find FieldDescriptor

Werner Guttmann

2010-02-11

Replies: Find Java Web Hosting

Author LoginPost Reply
Hi,

what frameworks are you using to integrate Castor XML for processing
SOAP messages ? Or is this really as simple as doing things manually ?

If you doing this completely manually, please do not forget to make the
namespaces known to Castor you seem to be using.

Cheers
Werner

On 11.02.2010 15:57, PorridgeBear wrote:
>
> 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

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

  http://xircles.codehaus.org/manage_email


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