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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:31:14+00:00 2026-05-27T08:31:14+00:00

I am sending a request to webservice and am receiving correct response from web

  • 0

I am sending a request to webservice and am receiving correct response from web service in xml format with the correct value populated in the response element tage. Now I tried to unmarshal but the response object is being populated with null instead of the value I see in XML response.

Any obvious thing to check?
This is my code:

InputSource outputSource = getWebServiceHelper().send(source,messageIdentifier);

JAXBElement<Envelope> responseEnv = (JAXBElement<Envelope>) getWebServiceHelper().unmarshal(new SAXSource(outputSource));
JAXBElement<ResponseObjectType> result = (JAXBElement<ResponseObjectType>)responseEnv.getValue().getBody().getAny().get(0); 

The moment second line executes, the response attribute is becoming null. Despite being correct between xml tags!

Thanks a ton.
Chaitanya

  • 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-05-27T08:31:14+00:00Added an answer on May 27, 2026 at 8:31 am

    I found the solution myself through intense trial and error. Here is how I got it done.

    Running xjc creates 4 classes namely ObjectFactory.java, package-info.java, class representing webservice request and class representing webservice response.

    I overlooked to include package-info.java alongwith other 3 classes. This is the reason jaxb is unable to unmarshal the repsone.

    If I dont include ObjectFactory.java, I get exception at server startup thrown by org.springframework.oxm.jaxb.Jaxb2Marshaller bean defined in spring context file so I know I have to include it. But not including package-info.java fails silently causing frustration!

    I have read in Stackoverflow and elsewhere that for unmarshal() method to accept just one argument- javax.xml.transform.Source and unmarshal I need to use @XmlRootElement annotation but that doesn’t seem to be applicable to my case.

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

Sidebar

Related Questions

I'm developing simple Windows Service sending and receiving data from remote web service. I
I am sending a simple soap request to a .net webservice. However the response
From My Previous question sending request to apple - from iphone custom application Here,
I got some sample code from the net here: http://www.javadb.com/sending-a-post-request-with-parameters-from-a-java-class That works fine. It
I am sending password text to the http service request object.like <request><password>pass.text</password></request> now this
I'm sending a ACK response back to a SOAP request (via Salesforce) and I
If I have a client app sending requests to my web service, one after
I am creating a Web Service using ASP.NET C#. I am sending various data
I'm sending SOAP requests to an external web service. There are several fields that
I need to use compression when sending SOAP requests and receiving responses from the

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.