1

I'm trying to generate a Java client for a webservice defined by http://v3.core.com.productserve.com/ProductServeService.wsdl

I've tried Java's wsimport and wsdl2java from both CXF and Axis2.

e.g.

wsimport -p productserve -XadditionalHeaders  http://v3.core.com.productserve.com/ProductServeService.wsdl

All three produce ApiPortType.java with the same problem. The return type for the getProductList method is void and has no @WebResult annotation. All other operations from the WSDL are mapped to java code fine.

I've looked through the WSDL in detail but can't spot what the problem might be and why all 3 tools fail to produce the correct return type for the operation.

Any ideas?

4

1 回答 1

5

This web service falls into the category of document literal wrapped web services. The following points are true:

  • Binding is document/literal
  • operation's (getProductList()) in/out messages contains one wsdl:part each
  • request part refers to XSD element with the same name as operation
  • response part refers to XSD element with the same name as operation + "Response"

So you have void return, but there are really 4 results:

  • Holder<List<Product>> oProduct
  • Holder<Integer> iTotalCount
  • Holder<List<RefineByGroup>> oActiveRefineByGroup
  • Holder<List<RefineByGroup>> oRefineByGroup

CXF (using wsimport) has generated WRAPPED style of operations. You can also generate BARE style using CXF's:

wsdl2java -bareMethods http://v3.core.com.productserve.com/ProductServeService.wsdl

This way, instead of:

@WebMethod
@RequestWrapper(localName = "getProductList", targetNamespace = "http://v3.core.com.productserve.com/", className = "productserve.GetProductList")
@ResponseWrapper(localName = "getProductListResponse", targetNamespace = "http://v3.core.com.productserve.com/", className = "productserve.GetProductListResponse")
public void getProductList(
...

you'll get:

@WebResult(name = "getProductListResponse", targetNamespace = "http://v3.core.com.productserve.com/", partName = "return")
@WebMethod
public GetProductListResponse getProductList(
    @WebParam(partName = "parameters", name = "getProductList", targetNamespace = "http://v3.core.com.productserve.com/")
    GetProductList parameters
) throws ApiException;
于 2012-06-22T09:37:07.367 回答