wsimport not using complex input types

穿精又带淫゛_ 提交于 2019-12-05 19:39:33

问题


When I use wsimport to generate proxies for some services, the resulting method signature for each port does not seem to use the complex types specified in the WSDL; but yet I've noticed that with some other services it does.

This has happened on multiple services, but the most recent example is Amazon's AWSEConsumerService (link to WSDL). When I generate the service proxy code using wsimport, I get method signatures such as the following for each port.

@WebMethod(operationName = "ItemLookup", action = "http://soap.amazon.com/ItemLookup")
@RequestWrapper(localName = "ItemLookup", targetNamespace = "http://webservices.amazon.com/AWSECommerceService/2011-08-01", className = "com.aws.CommerceService.ItemLookup")
@ResponseWrapper(localName = "ItemLookupResponse", targetNamespace = "http://webservices.amazon.com/AWSECommerceService/2011-08-01", className = "com.aws.CommerceService.ItemLookupResponse")
public void itemLookup(
    @WebParam(name = "MarketplaceDomain", targetNamespace = "http://webservices.amazon.com/AWSECommerceService/2011-08-01")
    String marketplaceDomain,
    @WebParam(name = "AWSAccessKeyId", targetNamespace = "http://webservices.amazon.com/AWSECommerceService/2011-08-01")
    String awsAccessKeyId,
    @WebParam(name = "AssociateTag", targetNamespace = "http://webservices.amazon.com/AWSECommerceService/2011-08-01")
    String associateTag,
    @WebParam(name = "Validate", targetNamespace = "http://webservices.amazon.com/AWSECommerceService/2011-08-01")
    String validate,
    @WebParam(name = "XMLEscaping", targetNamespace = "http://webservices.amazon.com/AWSECommerceService/2011-08-01")
    String xmlEscaping,
    @WebParam(name = "Shared", targetNamespace = "http://webservices.amazon.com/AWSECommerceService/2011-08-01")
    ItemLookupRequest shared,
    @WebParam(name = "Request", targetNamespace = "http://webservices.amazon.com/AWSECommerceService/2011-08-01")
    List<ItemLookupRequest> request,
    @WebParam(name = "OperationRequest", targetNamespace = "http://webservices.amazon.com/AWSECommerceService/2011-08-01", mode = WebParam.Mode.OUT)
    Holder<OperationRequest> operationRequest,
    @WebParam(name = "Items", targetNamespace = "http://webservices.amazon.com/AWSECommerceService/2011-08-01", mode = WebParam.Mode.OUT)
    Holder<List<Items>> items);

I would expect this method take the single complex parameter specified by the WSDL (in this case an ItemLookup object). Am I fundamentally misunderstanding something or is there something abnormal happening with the code generation?


回答1:


I ran into a similar problem with AWS. I followed the API setup description for Java (page 10 of this pdf

In step 2 (it says for Eclipse 3.2) you should create a file (sugessted name is jaxws-custom.xml) with the following content:

<jaxws:bindings wsdlLocation="http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl" xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">
 <jaxws:enableWrapperStyle>false</jaxws:enableWrapperStyle>
</jaxws:bindings>

and then run the wsimport command with the option -b jaxws-custom.xml

I haven't figured out what exactly the problem is, but that did the trick for me.



来源:https://stackoverflow.com/questions/8013365/wsimport-not-using-complex-input-types

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!