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

  • Home
  • SEARCH
  • 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 3632060
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T00:28:38+00:00 2026-05-19T00:28:38+00:00

I have written spring webservice cleint example This is working fine with springws1.5 but

  • 0

I have written spring webservice cleint example This is working fine with springws1.5 but when running with spring ws 1.0.4 i am getting below exception. Please help me why we will get this exception and how to resolve. I need to use down version only as my spring version is 2.0.4. Please reply as soon as possible.

Unhandled exception: 
    org.springframework.oxm.jaxb.JaxbUnmarshallingFailureException: JAXB unmarshalling exception: unexpected element (uri:"http://yyy.org", local:"xxxResponse"). Expected elements are <{}xxx>,<{}xxxResponse>; nested exception is javax.xml.bind.UnmarshalException: unexpected element (uri:"yyy.org", local:"xxxResponse"). Expected elements are <{}xxx>,<{}xxxResponse>
    Caused by: 
    javax.xml.bind.UnmarshalException: unexpected element (uri:"http://yyy.org", local:"xxxResponse"). Expected elements are <{}xxx>,<{}xxxResponse>
     at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:603)
     at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:244)
     at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:239)
     at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:116)
     at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElement(UnmarshallingContext.java:1009)
     at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:446)
     at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:427)
     at com.sun.xml.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(InterningXmlVisitor.java:71)
     at com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:137)
     at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:240)
     at com.sun.xml.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:123)
     at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:314)
     at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:297)
     at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:107)
     at org.springframework.oxm.jaxb.Jaxb2Marshaller.unmarshal(Jaxb2Marshaller.java:395)
     at org.springframework.ws.support.MarshallingUtils.unmarshal(MarshallingUtils.java:62)
     at org.springframework.ws.client.core.WebServiceTemplate$2.extractData(WebServiceTemplate.java:276)
     at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:417)
     at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:265)
     at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:253)
     at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:245)
     at encompass.mtm.webservices.Code1ServiceClient.getAddressCheckResponse(Code1ServiceClient.java:24)

I have coded using following example
http://justcompiled.blogspot.com/2010/11/web-service-client-with-spring-ws.html
The following changes i have done:
Genereate classes using wsconsume batch file from jboss bin,
I have kept jars

saaj1.3.jar, spring-ws-core-1.0.4.jar,spring-xml-1.0.4.jar
spring-oxm-tiger-1.0.4.jar,spring-oxm-1.0.4.jar 

in jboss/../lib

Following is in my spring configuration file:

<bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory">
        <property name="messageFactory">
            <bean class="com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl"/>
        </property>
    </bean>

    <bean id="test1ObjectFactory" class="test.webservices.ObjectFactory"/>
    <bean id="test1ServiceMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
        <property name="contextPath" value="test.webservices" />
    </bean>
    <bean id="test1ServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate">
        <constructor-arg ref="messageFactory" />
        <property name="marshaller" ref="test1ServiceMarshaller"></property>
        <property name="unmarshaller" ref="test1ServiceMarshaller"></property>
        <property name="messageSender">
            <bean
                class="org.springframework.ws.transport.http.CommonsHttpMessageSender">
            </bean>
        </property>
        <property name="defaultUri" value="${webservice.url}" />
    </bean>
    <bean id="test1ServiceClient" class="test.webservices.test1ServiceClient">
        <constructor-arg ref="test1ServiceTemplate"></constructor-arg>
        <property name="test1ObjectFactory" ref="test1ObjectFactory"></property>
    </bean>

Now i have replaced everything and place webservice 1.5.0 jar. Stil i am facing this problem, Previously it worked. I haven’t done much chanegs. is any thing disturbed in my code? How to chesk ..How to track this. Any help is highly appreciated.
My ObjectFactory is simple:

@XmlRegistry
public class ObjectFactory {

    /**
     * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: test.webservices
     * 
     */
    public ObjectFactory() {
    }

    /**
     * Create an instance of {@link xxxResponse }
     * 
     */
    public XxxResponse createxxxResponse() {
        return new xxxResponse();
    }

    /**
     * Create an instance of {@link xxx }
     * 
     */
    public Xxx createXXX() {
        return new XXX();
    }

}

Input
Following are classlevel annotations

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "xxxData"
})
@XmlRootElement(name = "Xxx")

Response:

  @ XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "", propOrder = {
        "xxxResult"
    })
    @XmlRootElement(name = "XxxResponse")
  • 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-19T00:28:39+00:00Added an answer on May 19, 2026 at 12:28 am

    The exception you’re getting is telling you that the JAXB context is expecting to receive elements with no XML namespace. It’s expecting this because your JAXB-annotated classes do not have a namespace defined anywhere. You’d expect to find this declared as @XmlNamespace, somewhere in the bound classes (or in package-info.java), but you don’t have that anywhere.

    Spring-WS, however, is receiving responses that do have a namespace (the http://yyy.org in your example), and so the unmarshalling fails.

    What I can’t explain is how this ever worked with Spring-WS 1.5.x – the namespace mismatch should fail for every version.

    Whatever tool you used to generate the JAXB classes should have produced a package-info.java file that declared the namespace. Are you sure it’s not in there somewhere?

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

Sidebar

Related Questions

I have my application running properly in Jboss. To to write spring webservice client,
This is what I have written: if ((lstProperty[i].PropertyIdentifier as string).CompareTo(Name) == 0) Resharper put
I have written a site in Prototype but want to switch to jQuery. Any
I've written an ASP.NET webservice (.asmx style rather than WCF) and I have the
I have written an ASP.NET web service. It looks like this: WebServices.logic pLogic =
I have an application written in Spring 3.0 hooked up using Hibernate to a
I have found this example on StackOverflow: var people = new List<Person> { new
I have written a util class in Java for webservice call. My util class
Let's say I have an application written with spring framework, and I want to
I have a function I've written that was initially supposed to take a string

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.