Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9220695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:24:35+00:00 2026-06-18T03:24:35+00:00

I’m calling a web service using JAX-WS. I want to convert the content into

  • 0

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.

<header xmlns="">
  <store>
    <store_id>1</store_id>
    <store_name>ACME</store_name>
  </store>
</header>

I then created a class as follows:

@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;
}

My JAXB 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();

I get the following error:

Exception in thread "main" javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"store"). Expected elements are <{http://tempuri.org/}header>

I’ve tried countless things to fix this. Any help would be great!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T03:24:36+00:00Added an answer on June 18, 2026 at 3:24 am

    Try wrapping the DOM element in an instance of DOMSource and doing the following:

    DOMSource domSource = new DOMSource(e);
    JAXBElement<store> element =
        unmarshaller.unmarshal(domSource, store.class);
    

    By supplying the class you wish to unmarshal to, the JAXB impl does not need to determine the unmarshal class based on the root element.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using JSon response to parse title,date content and thumbnail images and place
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a French site that I want to parse, but am running into
I'm interested in microtypography issues on the web. I want a tool to fix:
I want to show the soap response to UIWebview.. my soap response is, <p><img
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have thousands of HTML files to process using Groovy/Java and I need to
I am using jsonparser to parse data and images obtained from json response. When
I want to count how many characters a certain string has in PHP, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.