gpt4 book ai didi

java - wsimport 不使用复杂的输入类型

转载 作者:塔克拉玛干 更新时间:2023-11-03 03:20:59 28 4
gpt4 key购买 nike

当我使用 wsimport 为某些服务生成代理时,每个端口的生成方法签名似乎没有使用 WSDL 中指定的复杂类型;但我注意到它在其他一些服务中也是如此。

这发生在多个服务上,但最近的例子是亚马逊的 AWSEConsumerService ( link to WSDL )。当我使用 wsimport 生成服务代理代码时,我得到了每个端口的方法签名,如下所示。

@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);

我希望此方法采用 WSDL 指定的单个复杂参数(在本例中为 ItemLookup 对象)。我是从根本上误解了什么,还是代码生成发生了异常?

最佳答案

我在 AWS 上遇到了类似的问题。我遵循了 Java 的 API 设置说明(第 10 页 pdf

在第 2 步中(针对 Eclipse 3.2)您应该创建一个包含以下内容的文件(建议名称为 jaxws-custom.xml):

<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>

然后使用选项 -b jaxws-custom.xml 运行 wsimport 命令

我还没有弄清楚到底是什么问题,但这对我有用。

关于java - wsimport 不使用复杂的输入类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8013365/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com