Java Castor Unmarshal byte array -


good day community,

i have question regarding castor unmarshaling in java. mentioned using castor unmarshal webservice response contains byte array (byte[]) .. please refer below:

public class viewreportresponse {  private string reportid; private byte[] report;  //getters , setters here ... 

i have used castor before unmarhsal webservice responses, admittedly, responses strings. problem lyes byte array returned believe castor chokes on unmarshaling it.

my castor-mapping file provided below:

<class name="com.domain.reporting.client.service.viewreportresponse">      <map-to xml="viewreportresponse"              xsi:schemalocation="http://domain.com/schemas/reportingservice/generatereport"              ns-uri="http://domain.com/schemas/reportingservice/generatereport"             ns-prefix="ns2" />      <field name="reportid">         <bind-xml name="reportid"                    node="element"                    type="string"/>     </field>      <field name="report">         <bind-xml name="report"                    node="element"                    type="bytes" />     </field> 

i'm not sure missing, message received fails @ point of unmarshaling.

i've attached clip of error below.

org.springframework.oxm.unmarshallingfailureexception: castor unmarshalling exception; nested exception org.exolab.castor.xml.marshalexception: unable find fielddescriptor 'report' in classdescriptor of viewreportresponse. 

please assistance appreciated. thank-you kindly

solved:

the general problem not maping , byte[]. problem related use of namespace in case.

<field name="reportid">  <bind-xml name="ns:reportid" xmlns:ns="http://domain.com/schemas/reportingservice/generatereport"     node="element"     type="string"/>  

<field name="report">  <bind-xml name="ns:report" xmlns:ns="http://domain.com/schemas/reportingservice/generatereport"     node="element"     type="bytes"/>  

this post solved , closed.


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -