Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within XML
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Ron McLeod
Paul Clapham
Tim Cooke
Devaka Cooray
Sheriffs:
Liutauras Vilda
paul wheaton
Rob Spoor
Saloon Keepers:
Tim Moores
Stephan van Hulst
Tim Holloway
Piet Souris
Mikalai Zaikin
Bartenders:
Carey Brown
Roland Mueller
Forum:
XML and Related Technologies
Problems with unmarshalling using JAXB
Ayan Biswas
Ranch Hand
Posts: 104
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Here is my code to unmarshall
JAXBContext jc = JAXBContext.newInstance("com.cts.mib.security");//this package contains the object factory class Unmarshaller u = jc.createUnmarshaller(); JAXBElement element = (JAXBElement) u.unmarshal(xmlInputStream);//xmlInputStream contains the xml to be unmarshalled com.cts.mib.security.DWLAdminService dwlService = (com.cts.mib.security.DWLAdminService) element.getValue(); return dwlService;
Here is my OjectFactory class
@XmlRegistry public class ObjectFactory { private final static QName _QNAME = new QName("", "DWLAdminService"); public ObjectFactory() { } public DWLAdminService createItem() { return new DWLAdminService(); } @XmlElementDecl(namespace = "", name = "DWLAdminService") public JAXBElement<DWLAdminService> createItem(DWLAdminService value) { return new JAXBElement<DWLAdminService>(_QNAME, DWLAdminService.class, null, value); } }
And here is my DWLAdminService class
@XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "DWLAdminService", propOrder = { "responseControl", "txResponse", "tcrmTx", }) @XmlRootElement() public class DWLAdminService extends BaseBean implements Serializable { private static final long serialVersionUID = 1L; @XmlElement(name = "ResponseControl") private ResponseControl responseControl = null; @XmlElement(name = "TxResponse") private TxResponse txResponse = null; @XmlElement(name = "TCRMTx") private TCRMTx tcrmTx = null; public ResponseControl getResponseControl() { return responseControl; } public void setResponseControl(ResponseControl responseControl) { this.responseControl = responseControl; } public TxResponse getTxResponse() { return txResponse; } public void setTxResponse(TxResponse txResponse) { this.txResponse = txResponse; } public TCRMTx getTcrmTx() { return tcrmTx; } public void setTcrmTx(TCRMTx tcrmTx) { this.tcrmTx = tcrmTx; } }
While unmarshalling I find that the fileds in TxResponse does not get set but fields in responseControl get set.!!What can be the possible reason for that..?
AyanBiswas
John Jai
Rancher
Posts: 1776
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Ayan - Please
UseOneThreadPerQuestion
. I have deleted the other same question you posted.
today's feeble attempt to support the empire
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Problems with JAXB-generated javadoc code
Exception on while deploying Ear using Glassfish+Apache CXF 2.3.1+Eclipse Helios
return complex typ
JAX-WS and REST, anyone?
More...