Error while unmarshalling Web Service response

Covefeabope

New Member
I'm calling a web service using JAX-WS. I want to convert the content into a Java Object.Here is the content portion of the web service response.\[code\]<header xmlns=""> <store> <store_id>1</store_id> <store_name>ACME</store_name> </store></header>\[/code\]I then created a class as follows:\[code\]@XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "store_id", "store_name" }) @XmlRootElement(name = "store") static public class store { @XmlElement(name = "store_id", required = true) protected String store_id; @XmlElement(name = "store_name", required = true) protected String store_name;}\[/code\]My JAXB code:\[code\]List result = service.getService1Soap12().getDivisions().getContent();ElementNSImpl e =(ElementNSImpl)result.get(0);JAXBContext context = JAXBContext.newInstance(store.class);Unmarshaller um = context.createUnmarshaller();JAXBElement element = (JAXBElement) um.unmarshal(e);store customer = (store) element.getValue();\[/code\]I get the following error:\[code\]Exception in thread "main" javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"store"). Expected elements are <{http://tempuri.org/}header>\[/code\]I've tried countless things to fix this. Any help would be great!
 
Back
Top