Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » Problem Generating the web service client proxy using WTP+ CXF (The client with WTP + CXF is Buggy)
Problem Generating the web service client proxy using WTP+ CXF [message #641530] Thu, 25 November 2010 21:35 Go to next message
Maatari  is currently offline Maatari Friend
Messages: 4
Registered: November 2010
Junior Member
Dear All,

I wonder if one of you may help with the following problem:

[ I can't generate a client proxy web service using WTP + CXF ]

I have a web service that i generate from a service end point interface. After what I try to generate a client proxy to use my webservice.

When I use the spring approach, everything work. Following the example ins the apeache cxf book, I create a client-beans.xml with the jaxws:client tag etc..

However when i try to leverage the WTP tools for an automatic generation of the client, the generated code bug. More specifically

I get the following error when I try to invoke my service from within the client proxy generated.

Invoking hi...
DefaultValidationEventHandler: [ERROR]: unexpected element (uri:"http://testOfcxf/", local:"return"). Expected elements are <{}return>
Location: line 1
Nov 25, 2010 10:05:00 PM org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
WARNING: Interceptor for {http://testOfcxf/}HiserviceImplService#{http://testOfcxf/}H i has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Unmarshalling Error: unexpected element (uri:"http://testOfcxf/", local:"return"). Expected elements are <{}return>
at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncode
at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncode
at va:154)
at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMes sage(
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(Phase
at org.apache.cxf.endpoint.ClientImpl.onMessage( :733)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStrea m.handleResponseInternal(
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStrea m.handleResponse(
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStrea m.close(
at org.apache.cxf.transport.AbstractConduit.close(AbstractCondu
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit. java:662)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageS enderEndingInterceptor.handleMessage(MessageSenderIntercepto
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(Phase
at org.apache.cxf.endpoint.ClientImpl.invoke( 6)
at org.apache.cxf.endpoint.ClientImpl.invoke( 3)
at org.apache.cxf.endpoint.ClientImpl.invoke( 5)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.j ava:73)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProx
at $Proxy28.hi(Unknown Source)
at testofcxf.HiService_HiserviceImplPort_Client.main(HiService_
Caused by: javax.xml.bind.UnmarshalException


Meanwhile I have been able to solve the issue using some tricks. And that is where i would need some help.

To understand the trick. It is important first to let you know that my WTP has the following behaviour:

Weather I generate a web service or a clientproxy web service, the generator generate two times several classes that in my opinion shall be generate once for the service and reuse in the client proxy. To be more specific I have the following SEI and its implementation

@WebService(name = "HiService", targetNamespace = "http://testOfcxf/")
public interface HiService {

@WebMethod(operationName = "Hi", action = "urn:Hi")
@RequestWrapper(className = "testOfcxf.jaxws.Hi", localName = "Hi", targetNamespace = "http://testOfcxf/")
@ResponseWrapper(className = "testOfcxf.jaxws.HiResponse", localName = "HiResponse", targetNamespace = "http://testOfcxf/")
public String Hi(@WebParam(name = "arg0") String name);


@WebService(targetNamespace = "http://testOfcxf/", endpointInterface = "testOfcxf.HiService", portName = "HiserviceImplPort", serviceName = "HiserviceImplService")
public class HiserviceImpl implements HiService {

public String Hi(String name) {

return "hello" + name;


Then from the file and when I generate the all web service I obtain among other the annotation as expose above, but also (because of the @wrappers that I don't yet fully understand)
the class and

(Because the trick comes with Hi response I will only expose HiResponse here)

@XmlRootElement(name = "HiResponse", namespace = "http://testOfcxf/")
@XmlType(name = "HiResponse", namespace = "http://testOfcxf/")

public class HiResponse {

@XmlElement(name = "return", namespace = "http://testOfcxf/")
private java.lang.String _return;

public java.lang.String getReturn() {
return this._return;

public void setReturn(java.lang.String new_return) {
this._return = new_return;



Until here as stated before everything is fine.

When I generate the client, weather I do it in the same source forlder as my service in another package, in the same package or in another project, the framework generate me the following class:,,, (as far as i know this late impl class is never reference in the client code) which are the class of the service generated before but sligthly differently. The other class are ", and ObjectFactory"

While I understand that if you are in another project regenerating certain class are necessary I don't understand why it does so differently. And apparently this is the source of my problem as my trick as work at this level.

Here is the HiResponse Java file:

@XmlType(name = "HiResponse", propOrder = {
public class HiResponse {

@XmlElement(name = "return")
protected String _return;

* Gets the value of the return property.
* @return
* possible object is
* {@link String }
public String getReturn() {
return _return;

* Sets the value of the return property.
* @param value
* allowed object is
* {@link String }
public void setReturn(String value) {
this._return = value;



As it can be seen in this case the @XmlRootElement is missing for instance as well as the name space. (For the namespace I'm not sure but I think they are cathed up in the factory)

So to solve my problem my solution has been to replace the classes that are in double. However I have done so only with HiResponse as there were clearly a problem with the return. But maybe I might face other issue. Indeed all the class generated in double are as different to their original from the service as it is illustrated with the Hiresponse class.

Therefore can someone englight me with this. I would like to know if I'm doing the right thing. If the behavior or the WTP is as expected? I have latest version of eclise, java 6 and etc...fully up to date.

Is it possible to have the two process generate the same thing. (client and service generation) or to stop the client from regenerating the server class? I used both Develop and assemble for a test.

Furthermore why renerating HiServiceImpl while it is not the one used ?

Many thanks

Re: Problem Generating the web service client proxy using WTP+ CXF [message #641855 is a reply to message #641530] Sun, 28 November 2010 20:16 Go to previous messageGo to next message
Shane Clarke is currently offline Shane ClarkeFriend
Messages: 67
Registered: July 2009
Hi Maatari

There was a change in CXF 2.2.11 to do with the response wrapper code generation.


@javax.jws.WebResult(name = "return", targetNamespace="")

to your to SEI method and regenerate your service.

The WTP tools for using the CXF runtime to develop web services are just a frontend to the CXF java2ws and wsdl2java tools.

The wizards take the input that you provide and the options that you select and then delegate to the CXF tools to do the code generation.

When using the WTP Web Services wizard to develop a service and client with the CXF runtime. First java2ws runs with your SEI/Impl. It gets deployed to your web/app server and then wsdl2java runs against the deployed service to generate a client.

You can disable the generation of an implementation class when generating a client by unchecking the "Generate Implementation" preference in the preferences (Web Services > CXF 2.x Preferences > WSDL2Java) before launching the WTP Wizard or uncheck the preference in the wizard page in the "WSDL2Java Generation Options" section.

Re: Problem Generating the web service client proxy using WTP+ CXF [message #642504 is a reply to message #641530] Wed, 01 December 2010 15:48 Go to previous message
Maatari  is currently offline Maatari Friend
Messages: 4
Registered: November 2010
Junior Member
Many thanks.
Previous Topic:CSS Brace Position
Next Topic:WSDL + SOAP12 and Eclipse WSDL editor problem
Goto Forum:

Current Time: Fri Oct 23 00:15:59 GMT 2020

Powered by FUDForum. Page generated in 0.01889 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top