This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Journey To Enterprise Agility and have Daryl Kulak & Hong Li on-line!
See this thread for details.
Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

JAXB unmarshalling problem  RSS feed

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have a wsdl, out of which I generated the beans and wrote my serviceImpl.
The service as is working very much fine, but I have a need to use the beans in other java project. So If I move the beans to a common project with the same package and add the project dependency, I don't find any build errors.

But If I move them out of the package from where it is generated, I am getting the following exception

<soapenv:Fault>
<faultcode>soapenv:Client</faultcode>
<faultstring>javax.xml.bind.UnmarshalException
- with linked exception:
[javax.xml.bind.UnmarshalException: unexpected element (uri:"http://sample.com", local:"MySampleRQ"). Expected elements are <{}MySampleRQ>,<{}MySampleRS>]</faultstring>
<detail/>
</soapenv:Fault>

I am using JAXWS.

Please suggest how can i overcome this
 
Ranch Hand
Posts: 87
Java Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I got your probelm correctly , you have changed the package name of the classes generated by your wsdl-2-java tool and you are getting a binding error while running the service.

Generated class's package name is mapped to the namespace in the wsdl schema by default. So if you change the package name, those mappings will won't work.

I think you can specifiy a custom package name while generating the classes.. check your wsdl-2-java tool documentation.
 
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not "Beginning Java" material. Moving to Web Services.
 
Sathiesh Kumar Vs
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Prem,

I havent changed the package name. The service is in a web project for which I have an associated Java Project. I have moved the beans to that java project under the same package that is declared by the namespace in wsdl.
Also the web project has the java project in its build path dependency.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!