wsimport 不使用复杂的输入类型

发布于 2024-12-14 03:55:46 字数 2336 浏览 7 评论 0原文

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

多种服务都发生过这种情况,但最近的示例是 Amazon 的 AWSEConsumerService(链接到 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 对象)。我是否从根本上误解了某些内容,或者代码生成过程中是否发生了异常情况?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

俯瞰星空 2024-12-21 03:55:46

我在 AWS 上也遇到了类似的问题。我遵循了 Java 的 API 设置说明(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 命令

我还没有弄清楚问题到底是什么,但这对我来说很有效。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文