我创建了一个Web服务:
服务将自定义Java对象(DataBean)返回给客户端,但我偶然发现了客户端代码中的异常:
org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement {schemaTargetNs}message
Run Code Online (Sandbox Code Playgroud)
从我所研究的内容开始,我一再重复......我认为这是一个非常普遍的问题,但尚未就如何纠正它做出决定性的答案.
此论坛和其他论坛上的一些帖子声明需要修改WSDL(某些名称空间),或者客户端存根需要修改.有些人甚至声称亚行有一个错误.它肯定是早期版本的Axis中的一个错误,但邮件档案中有很多帖子说明错误是修复的.这些邮件存档与早期版本的Axis2有关.
现在我的问题是:
值得一提的是,我创建了一个类似的Web服务,它将"String"返回给客户端.它工作正常!因此,当涉及复杂数据类型时,它会失败.
Apache的网站上有一些信息,标题为" 已知限制 "......
它写道:" ADB意味着'简单'的数据绑定框架,并不意味着编译所有类型的模式.以下限制是最突出的.
那是问题吗?
以下是WSDL文件的片段,您可能对此感兴趣......
<wsdl:types>
<xs:schema xmlns:ax26="http://mywebservice/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="schemaTargetNs">
<xs:import namespace="http://mywebservice/xsd"/>
<xs:element name="getMsg">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="reqData" nillable="true" type="ax25:DataBean"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="getMsgResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true" type="ax25:DataBean"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://mywebservice/xsd">
<xs:complexType name="DataBean">
<xs:sequence>
<xs:element minOccurs="0" name="message" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" …
Run Code Online (Sandbox Code Playgroud) 在Eclipse中执行一个小应用程序时,我从Tomcat服务器收到Http Status 500错误,我在Eclipse中运行它...
HTTP Status 500 -
--------------------------------------------------------------------------------
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
java.lang.NullPointerException
org.apache.struts2.impl.StrutsActionProxy.getErrorMessage (StrutsActionProxy.java:69)
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185)
org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:500)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:434)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.8 logs.
Run Code Online (Sandbox Code Playgroud)
来自服务器的此消息表明错误是由"NullPointerException"引起的.最后一行说"Apache Tomcat/7.0.8日志中提供了完整的堆栈跟踪.我检查了在我的工作区中创建的日志($ {catalina.base}设置为我工作区中的文件夹)但是日志不是提供有关"NullPointerException"的任何细节.日志中唯一存在的是......
0:0:0:0:0:0:0:1 - - [03/May/2012:15:19:16 +0530] "GET /KurniawanChap02Struts/ HTTP/1.1" 500 1789
Run Code Online (Sandbox Code Playgroud)
我也试过增加"日志记录级别",但即便如此也无济于事.如何访问服务器的详细日志?