java - How to resolve javax.xml.bind.UnmarshallException? -
i new restful web services , after going through documentation in state invoke web service. looks receiving 200 status service producer when @ response object getting javax.xml.bind.unmarshallexception
. exception when code reaches read entity. little lost not sure or @ in order resolve error.
xml representation of object
@xmlrootelement( name = "somethig", namespace = "http://respone.something.com" ) @releaseinfo( version = "v4", description = "response validate email service" ) public class thirdpartyvalidateemailaddressresponse extends baseresponse { private string emailaddressprovided; private string emailaddressreturned; private string mailboxname; private string domainname; private string topleveldomain; private string topleveldomaindesc; private boolean syntaxcorrected; private boolean casestandardized; private boolean domainnameupdated;
client code:
public validateemailaddressserviceresponse validateemailaddress( validateemailaddressservicerequest request ) throws exception { webtarget service = config.createwebresource(request.getserviceurl()); validateemailaddressserviceresponse resp = new validateemailaddressserviceresponse(); service = service.path(something).path(something).path(something).register(thirdpartyvalidateemailresponsexmlreader.class); validateemailaddressservicerequestparameter parameter = null; parameter = request.getparameter(validateemailaddressservicerequestparameter.parameters.emailaddress.name()); if (parameter != null) { service = service.queryparam(validateemailaddressservicerequestparameter.parameters.emaila invocation.builder b = applyheaders(service, request.getheaders(), request.gethttpheaders()); if(request.getaccepts() != null){ b = b.accept(request.getaccepts().value()); } response response = b.get(response.class); try { resp = (validateemailaddressserviceresponse) handlebaseresponse(resp, response); // managing business or error response thirdpartyvalidateemailaddressresponse thirdpartyresponse = null; if (shouldprocessentity(something+ + something, resp)) { if (contenttype.xml.equals(request.getaccepts()) || contenttype.json.equals(request.getaccepts())) { thirdpartyresponse = response.readentity(thirdpartyvalidateemailaddressresponse.class); } else { throw new exception("invalid content type found while processing response"); } } else { thirdpartyresponse = new thirdpartyvalidateemailaddressresponse(); thirdpartyresponse.setmessages(createmessagesfromhttpstatus(resp)); response.close(); } } catch (ioexception e) { throw new eisclientexception("exception in processing validateemailaddress", e); } return resp; }
looks fails right here
thirdpartyresponse = response.readentity(thirdpartyvalidateemailaddressresponse.class);
stack trace:
mig.eis.client.eisclientexception: javax.xml.bind.unmarshalexception - linked exception: [org.xml.sax.saxparseexception; premature end of file.]
please let me know if else needed side debug issue.
thanks
Comments
Post a Comment