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
Post a Comment