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 9142967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:54:27+00:00 2026-06-17T09:54:27+00:00

I’m currently converting a number of web services from plain xml. I’ve load them

  • 0

I’m currently converting a number of web services from plain xml. I’ve load them in soapUI, created a client port and mock service and the request response is working perfectly. So right now I’m trying to create/convert the xml complex type objects into java, but I’m failing.

In soapUI I have this as a response:

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cli="http://client.serviceweb.xxx">
   <soapenv:Header/>
   <soapenv:Body>
      <cli:versionResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <result xsi:type="java:ResultatVersion" xmlns:java="java:xxx.serviceweb">
            <messagexxx xsi:type="xsd:string">message</messagexxx>
            <resultatxxx xsi:type="xsd:int">1</resultatxxx>
            <version xsi:type="java:Version">
               <numero xsi:type="xsd:string">1.0.0</numero>
            </version>
         </result>
      </cli:versionResponse>
   </soapenv:Body>
</soapenv:Envelope>

Any idea how to convert that to a java object? Looking at the original xml there’s a parent object that contains the field message and result, but I don’t understand the version part.

How about this one?

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xxx="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cli="http://client.serviceweb.xxx">
   <soapenv:Header/>
   <soapenv:Body>
      <cli:testResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <result xsi:type="java:ResultatImage" xmlns:java="java:xxx.serviceweb.xxx.xxx">
            <messagexxx xsi:type="xxx:string">message</messagexxx>
            <resultatxxx xsi:type="xxx:int">result</resultatxxx>
            <image xsi:type="xxx:base64Binary">cid:1325182441595</image>
         </result>
      </cli:testResponse>
   </soapenv:Body>
</soapenv:Envelope>

I already have a working Jaxb client that I have used previously and is already working, but can’t figure out how to call the above samples.

I’m having:

javax.xml.bind.UnmarshalException: unexpected element (uri:"http://schemas.xmlsoap.org/soap/envelope/", local:"Envelope"). Expected elements are <{}resultatImage>

Seems like the response is not mapping to the ResultatImage class that I’ve created.

Any thoughts?

How I send the request and unmarshall the response.

try {
    JAXBContext jc = JAXBContext
            .newInstance("com.ipiel.response");
    Unmarshaller u = jc.createUnmarshaller();
    client = new MyClient(httpClient, targetHost, u);
    client.test();
} catch (Exception e) {
    e.printStackTrace();
}

public void test() {
    String url = "/xxxClientsPort/test";
    HttpPost httpPost = new HttpPost(url);

    HttpResponse response = httpClient.execute(targetHost, httpPost);
    log.info("response: " + response);
    if (response.getStatusLine().getStatusCode() == 200) {
        HttpEntity respEntity = response.getEntity();
        if (respEntity != null) {
            InputStream instream = respEntity.getContent();
            try {
                ResultatImage responseEntity = (ResultatImage) unmarshaller
                        .unmarshal(instream);
                /*
                 * FileWriter writer = new FileWriter(new
                 * File("c:\\tmp\\output")); IOUtils.copy(instream, writer,
                 * "UTF-8"); String theString = writer.toString();
                 * writer.flush(); writer.close();
                 * System.out.println(theString);
                 */
            } finally {
                instream.close();
            }
        }
    }
}

package com.ipiel.response has the class Resultat and ResultatImage, both marked as @XmlRootElement. Also it contains the ObjectFactory marked as @XmlRegistry

Thanks,

czetsuya

  • 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-17T09:54:28+00:00Added an answer on June 17, 2026 at 9:54 am

    The main problem here was that I was generating the java classes inside SoapUI using the wrong version of Axis. I was trying with Axis2, but later found out that the webservice is actually running on Axis1. So if you ever encounter a similar problem, check first if the webservice version and the library of your client is the same.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I am currently running into a problem where an element is coming back from
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
I want use html5's new tag to play a wav file (currently only supported
I'm interested in microtypography issues on the web. I want a tool to fix:
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

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.