Jax-ws generation: @WebMethod vs. @ResponseWrapper

I have two very similar wsdl files that generate different Java codes. In the first case, I get a method with the annotation @WebMethod and the return value, in the second case, a method is generated with the annotation @ResponseWrapper and without return values. I would like to have return values.

1. Service1

<wsdl:operation name="foo"> <wsdl:input name="deleteUser" message="tns:deleteUserRequest"/> <wsdl:output name="deleteUserResponse" message="tns:deleteUserResponse"/> <wsdl:fault name="ServiceFault" message="tns:ServiceFault"/> </wsdl:operation> 

generates:

  @WebMethod @WebResult(name = "commonReturnType", targetNamespace = "http://www.foo.com/fooSchemaTypes-v3.0/", partName = "returnValue") public CommonReturnType foo( @WebParam(name = "fooType", targetNamespace = "http://www.foo.com/fooSchemaTypes-v3.0/", partName = "user") FooType user) throws ServiceFault ; 

2. FooBarService

  <wsdl:operation name="fooBar"> <wsdl:input name="fooBar" message="tns:fooBarRequest"></wsdl:input> <wsdl:output name="ackFileResponse" message="tns:fooBarResponse"></wsdl:output> <wsdl:fault name="ServiceFault" message="tns:fooBarFault"></wsdl:fault> </wsdl:operation> 

genereates:

  @WebMethod @RequestWrapper(localName = "fooBar", targetNamespace = "http://www.foo.com/fooBarSchemaTypes-v1.0/", className = "com.foo.fooBar.v1_0.GetFileType") @ResponseWrapper(localName = "fooBarResponse", targetNamespace = "http://www.foo.com/fooBarSchemaTypes-v1.0/", className = "com.foo.fooBar.v1_0.CommonReturnType") public void ackFile( @WebParam(name = "id", targetNamespace = "") String id, @WebParam(name = "timestamp", targetNamespace = "") XMLGregorianCalendar timestamp, @WebParam(name = "anotherId", targetNamespace = "") String anotherId, @WebParam(name = "fileId", targetNamespace = "") String fileId, @WebParam(name = "returnCode", targetNamespace = "", mode = WebParam.Mode.OUT) Holder<ReturnCode> returnCode, @WebParam(name = "errorMessage", targetNamespace = "", mode = WebParam.Mode.OUT) Holder<String> errorMessage); 

The code that generates the code is exactly the same.

If necessary, I can provide markup for messages and types. I hope the anonymity has not ruined the relevant parts.

I would like the second version also to have a return value. How can I achieve this?

+4
source share
1 answer

This helped (still not understanding why this is necessary in case 2, while 1 was not necessary):

 <!--JAX-WD Customization: disable wrapper style rules see also: http://docs.oracle.com/cd/E17802_01/webservices/webservices/docs/2.0/jaxws/customizations.html#2.2_Wrapper_Style --> <jaxws:bindings wsdlLocation="v1.0/dxpInsurerServiceV1.0.wsdl" xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"> <jaxws:enableWrapperStyle>false</jaxws:enableWrapperStyle> </jaxws:bindings> 

in jaxws-custom.xml

and this is in the ant -task generation:

also see wsimport without using complex input types

+4
source

All Articles