This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JAXB unmarshalling problem  RSS feed

 
Sathiesh Kumar Vs
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
 
prem pillai
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.
 
Wouter Oet
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!