cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <>
Subject Re: wsdl2java - @WebResult targetNamespace being generated as blank
Date Thu, 26 Sep 2013 19:15:09 GMT

Couple thoughts:

1) A full example would be useful.   I'd like to see if wsimport would generate the same thing.

2) Can you also try using CXF for the JAX-WS runtime?  You're using the JDK internal JAX-WS
implementation.  I saw a similar  bug just yesterday in the internal jaxws impl that worked
fine with CXF.


On Sep 26, 2013, at 12:18 PM, Euan Milton <> wrote:

> Hi,
> We have an application which needs to consume an external web service. To do this we
have generated the set of Java artifacts from the WSDL via Maven using the wsdl2java goal
provided by the cxf-codegen-plugin plugin.
> In the application we want to set the endpoint to use for the web service call at runtime
(to cater for different web service endpoint URLs in test environments) and so have written
some code as follows to do this for us:
> private <T> T createServiceObject(final Class<T> p_seiClass) throws MalformedURLException
>        final Service serviceFactory = Service.create(new URL(wsdlLocation), new QName(targetNamespace,
serviceName));        final T service = serviceFactory.getPort(p_seiClass);        ((BindingProvider)
service).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "endpoint");
>        return service;    }
> When the code runs it fails on the serviceFactory.getPort line with the following exception:
> class ZZZ.YYYwebservice.v5.types.ProcessUIRequestResponse
do not have a property of the name ProcessUIRequestResult    at$DocLit.<init>(
   at<init>(    at
   at    at com.XXX.XXX.XXX.YYY.integration.facade.jaxws.ProcessUIRequestFacadeJaxws.createServiceObject(
   at com.XXX.XXX.XXX.YYY.integration.facade.jaxws.ProcessUIRequestFacadeJaxws.processUIRequest(
   at com.XXX.XXX.XXX.YYY.integration.facade.jaxws.ProcessUIRequestFacadeJaxwsTest.test(
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)    at sun.reflect.NativeMethodAccessorImpl.invoke(
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(
   at java.lang.reflect.Method.invoke(    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(
   at org.junit.runners.model.FrameworkMethod.invokeExplosively( 
  at org.junit.internal.runners.statements.InvokeMethod.evaluate(   
at org.junit.runners.ParentRunner.runLeaf(    at org.junit.runners.BlockJUnit4ClassRunner.runChild(
   at org.junit.runners.BlockJUnit4ClassRunner.runChild(  
 at org.junit.runners.ParentRunner$    at org.junit.runners.ParentRunner$1.schedule(
   at org.junit.runners.ParentRunner.runChildren(    at org.junit.runners.ParentRunner.access$000(
   at org.junit.runners.ParentRunner$2.evaluate(    at org.junit.internal.runners.statements.RunBefores.evaluate(
   at org.junit.internal.runners.statements.RunAfters.evaluate(    at
   at    at
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(
by: javax.xml.bind.JAXBException: ProcessUIRequestResult is not a valid property on class
ZZZ.YYYwebservice.v5.types.ProcessUIRequestResponse    at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getElementPropertyAccessor(
   ... 37 more
> At the bottom I can see javax.xml.bind.JAXBException: ProcessUIRequestResult is not a
valid property on class ZZZ.YYYwebservice.v5.types.ProcessUIRequestResponse which suggests
that something is wrong with the generated file.
> I looked at that file and can't see anything obvious (ProcessUIRequestResult is defined
in the class and has a getter and setter).
> So, my investigation progressed further to look at the SEI that was generated:
> /** * This class was generated by Apache CXF 2.5.2 2013-09-26T13:05:17.389+01:00 Generated
source version: 2.5.2 *  */@WebService(targetNamespace = "http://zzz/yyywebservice/v5/types/",
name = "Types")@XmlSeeAlso({ zzz.yyyentityview.ObjectFactory.class,,
       zzz.yyyentityview.validation.ObjectFactory.class, zzz.serializable_dictionary.ObjectFactory.class,, zzz.yyybase.ObjectFactory.class, zzz.yyybase.enums.ObjectFactory.class,
       zzz.yyyentityview.client.ObjectFactory.class, ObjectFactory.class })public interface
Types {
>    @WebResult(name = "ProcessUIRequestResult", targetNamespace = "")    @ResponseWrapper(localName
= "ProcessUIRequestResponse", targetNamespace = "http://zzz/yyywebservice/v5/types/", className
= "zzz.yyywebservice.v5.types.ProcessUIRequestResponse")    @RequestWrapper(localName = "ProcessUIRequest",
targetNamespace = "http://zzz/yyywebservice/v5/types/", className = "zzz.yyywebservice.v5.types.ProcessUIRequest")
   @WebMethod(operationName = "ProcessUIRequest", action = "http://zzz/yyywebservice/v5/ProcessUIRequest")
   public zzz.yyybase.BaseVO processUIRequest(            @WebParam(name = "ProcessUIRequest",
targetNamespace = "http://zzz/yyywebservice/v5/types/") zzz.yyybase.BaseVO processUIRequest);
>    @WebResult(name = "GetActivityStatusEntityResult", targetNamespace = "")    @ResponseWrapper(localName
= "GetActivityStatusEntityResponse", targetNamespace = "http://zzz/yyywebservice/v5/types/",
className = "zzz.yyywebservice.v5.types.GetActivityStatusEntityResponse")    @RequestWrapper(localName
= "GetActivityStatusEntity", targetNamespace = "http://zzz/yyywebservice/v5/types/", className
= "zzz.yyywebservice.v5.types.GetActivityStatusEntity")    @WebMethod(operationName = "GetActivityStatusEntity",
action = "http://zzz/yyywebservice/v5/GetActivityStatusEntity")    public zzz.yyybase.ActivityStatusVOBase
getActivityStatusEntity(            @WebParam(name = "ProcessUIRequest", targetNamespace =
"http://zzz/yyywebservice/v5/types/") zzz.yyybase.BaseVO processUIRequest);}
> You can see that the targetNamespace of the @WebResult annotation is blank.  When I manually
edit the class and add what I would expect the targetNamespace to be (based on looking in
the XSDs), I can sucessfully invoke the web service.
> Having done some research into what the @WebResult tag represents, it is related to the
wsdl:part definition.  Tracing through the WSDL and XSD definitions from wsdl:port which is
defined as follows (in one of the WSDL files):
> <wsdl:message name="ProcessUIRequestSoapIn">    <wsdl:part name="parameters"
element="tns:ProcessUIRequest"/>  </wsdl:message>  <wsdl:message name="ProcessUIRequestSoapOut">
   <wsdl:part name="parameters" element="tns:ProcessUIRequestResponse"/>  </wsdl:message>
> This WSDL has the tns and targetNamespace defined as "http://zzz/yyywebservice/v5/types/"
(which is what I add to the @WebResult to get the call working).
> The definitions of ProcessUIRequest and ProcessUIRequestResponse are found in an included
schema as follows:
> <xs:element name="ProcessUIRequest">    <xs:complexType>      <xs:sequence>
       <xs:element minOccurs="0" maxOccurs="1" name="ProcessUIRequest" type="q1:BaseVO"
xmlns:q1="http://tcp/ssgbase/"/>      </xs:sequence>    </xs:complexType> 
</xs:element>  <xs:element name="ProcessUIRequestResponse">    <xs:complexType>
     <xs:sequence>        <xs:element minOccurs="0" maxOccurs="1" name="ProcessUIRequestResult"
type="q2:BaseVO" xmlns:q2="http://tcp/ssgbase/"/>      </xs:sequence>    </xs:complexType>
> This schema also has the the tns and targetNamespace defined as "http://zzz/yyywebservice/v5/types/"
> From what I can see, everything in the WSDL and XSD definitions look fine and I'm now
at a bit of a dead end.  Does anyone have pointers for where I can look next?
> Regards,
> Euan

Daniel Kulp -
Talend Community Coder -

View raw message