【问题标题】:How can I solve this error, with BeanPropertyTarget?如何使用 BeanPropertyTarget 解决此错误?
【发布时间】:2012-01-28 13:14:54
【问题描述】:

感谢任何帮助,我还是 Java 和 Web 服务的新手。

问题是:我将 WSDL 导入到我的项目中,当我使用它时它运行正常,而在另一种情况下,我在使用 wsdl 时遇到错误:

ERROR [org.apache.axis.encoding.ser.BeanPropertyTarget] - Could not convert [B to bean field 'texto', type java.lang.String

 ERROR [org.apache.axis.client.Call] - Exception: org.xml.sax.SAXException: java.lang.ClassCastException@a39be8

. (stuff)
. (more stuff)
. (more stuff)

Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@a39be8
at sun.reflect.GeneratedMethodAccessor33.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.    apache.axis.utils.BeanPropertyDescriptor.set(BeanPropertyDescriptor.java:142)
at org.apache.axis.encoding.ser.BeanPropertyTarget.set(BeanPropertyTarget.java:75)
... 73 more

知道如何解决这个问题吗?

我读到了here

使用 -w 参数创建客户端存根时可以解决此问题。

java org.apache.axis.wsdl.WSDL2Java -w name.wsdl

错误将不再发生。

这适用于我的情况吗?如果是,我该怎么做?我正在使用 apache-ant 进行部署。

【问题讨论】:

    标签: java web-services apache ant wsdl2java


    【解决方案1】:

    curl -H "Content-Type: text/xml; charset=utf-8" -H "SOAPAction:(your action url)" -d@(request input file path) (webservices url) > (response output file路径)

    将此命令与适当的输入一起使用。如果你得到正确的输出,那么你在解析响应时就会出错。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-12-11
      • 2018-12-06
      • 2017-12-12
      • 2012-02-14
      • 2015-04-12
      • 2016-06-21
      • 2020-11-16
      • 1970-01-01
      相关资源
      最近更新 更多