gpt4 book ai didi

c# - 使用 wsimport 导入 .net webservice 时出错

转载 作者:搜寻专家 更新时间:2023-11-01 03:54:53 25 4
gpt4 key购买 nike

我有一个用 C# 编码的网络服务。我想在 Java 应用程序中使用它,所以我尝试使用这些参数使用 wsimport 导入它:

wsimport -keep -verbose -B-XautoNameResolution http://localhost:50358/WebService.asmx?wsdl

我的网络服务中有这样一个类:

 public class ReturnClass
{
int _returnCode;
DataTable _outputDataDT;


public int ReturnCode { set { _returnCode = value; } get { return _returnCode; } }
public DataTable OutputDataDT { set { _outputDataDT = value; } get { return _outputDataDT; } }

}

如果我使用数据表变量,wsimport 返回此错误:

[ERROR] Property "Any" is already defined. Use <jaxb:property> to resolve thi s conflict. line 16 of http://localhost:50358/WebService.asmx?wsdl

[ERROR] The following location is relevant to the above error line 17 of http://localhost:50358/WebService.asmx?wsdl

但是如果我删除数据表变量,它会起作用,但我需要数据表。

我该如何解决这个问题?

最佳答案

查看您的模式,JAXB 看到两个具有相同名称的属性,并且无法确定在生成的 Java 代码中如何调用这些字段。您需要创建一个外部自定义绑定(bind)文件。在 http://docs.oracle.com/javase/tutorial/jaxb/intro/custom.html 阅读更多相关信息wsimport 命令有一个 -b 选项,您可以使用它来指定绑定(bind)文件。

关于c# - 使用 wsimport 导入 .net webservice 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11156385/

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