Java Mailing List Archive

http://www.junlu.com/

Home » user.castor »

Re: [castor-user] unable to find FieldDescriptor

PorridgeBear

2010-02-12

Replies: Find Java Web Hosting

Author LoginPost Reply

Yes I assure you that is where I started but whilst laid out very well and
seemingly nice and comprehensive, did not (as far as I could ascertain) deal
with this scenario of adding the namespace to get things working in Spring.
Nor does the Spring documentation regards Castor mention anything specific
or concrete examples.

Instead I found an internet littered with so many people using Spring and
Castor with similar issues and yet not finding solutions.

I did end up trying adding namespaces to my mapping but it didn't work. I
guess we'll need to look at xfire or jaxb to achieve this which is a shame,
I liked the approach of Castor.

Best wishes


Werner Guttmann-6 wrote:
>
> Hi,
>
> how about www.castor.org/reference-guide.html
>
> Cheers
> Werner
>
> On 11.02.2010 22:11, Allistair wrote:
>> Is there any reference material for why/how? Or a quick example?
>> Struggled a lot with this today.
>>
>> First time Castor user and my contract ends at client site tomorrow and I
>> really wanted to demo to them how Spring/Castor could help them integrate
>> with a search server. A nice to have :)
>>
>> Cheers
>>
>> On 11 Feb 2010, at 21:01, Werner Guttmann wrote:
>>
>>> Okay. Then you will have to introduce namespace URLs and prefices to
>>> your mapping file.
>>>
>>> Cheers
>>> Wernr
>>>
>>> On 11.02.2010 21:32, PorridgeBear wrote:
>>>>
>>>> Hey,
>>>>
>>>> I am using Spring Web Services. I downloaded the full Spring WS with
>>>> dependencies and am using the Castor version supplied. I create a
>>>> Castor
>>>> bean and pass it a castor-mapping.xml.
>>>>
>>>> Thanks :)
>>>>
>>>>
>>>> Werner Guttmann-6 wrote:
>>>>>
>>>>> 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
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>   http://xircles.codehaus.org/manage_email
>
>
>
>

--
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.