webservice接口调用异常两种(Unexpected wrapper element,Unmarshalling Error: 意外的元素)
element
A Vue.js 2.0 UI Toolkit for Web
项目地址:https://gitcode.com/gh_mirrors/eleme/element
免费下载资源
·
webservice接口调用异常两种
(1)Unexpected wrapper element {xxx}xx found. Expected {xxx}xx.
后台错误:
20:47:45.824 [http-nio-8080-exec-8] WARN o.a.c.p.PhaseInterceptorChain - [doLog,475] - Interceptor for {http://impl.service.webservice.web.ruoyi.com/}TestOneServiceImplService#{http://service.webservice.web.ruoyi.com/}apiOne has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Unexpected wrapper element {http://impl.service.webservice.web.ruoyi.com}apiOne found. Expected {http://service.webservice.web.ruoyi.com/}apiOne.
at org.apache.cxf.wsdl.interceptors.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:107)
前台错误:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>Unexpected wrapper element {http://impl.service.webservice.web.ruoyi.com}apiOne found. Expected {http://service.webservice.web.ruoyi.com/}apiOne.</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
错误原因:
webservice接口上的@Webservice注解缺失 targetNamespace 属性(一般为接口实现类包路径倒序),增加该属性后解决。如图:
(2)Unmarshalling Error: 意外的元素 所需元素为<{}
后台错误:
Caused by: com.sun.istack.internal.SAXParseException2: 意外的元素 (uri:"http://impl.service.webservice.web.ruoyi.com", local:"data")。所需元素为<{}arg0>
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:726)
前台错误:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>Unmarshalling Error: 意外的元素 (uri:"http://impl.service.webservice.web.ruoyi.com", local:"data")。所需元素为<{}arg0> </faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
错误原因:
功能方法的注解@WebParam 缺失属性,必须包含name和targetNamespace属性,增加相关属性后解决。如图:
PS:注意点!!! 如果需要显示其参数名和参数类型等信息,还需要添加其他注解及属性,完整版请查看我博文:(springboot 创建webservice服务接口:https://blog.csdn.net/yssa1125001/article/details/115679689)
最终效果如图,可以看到相关参数被成功接收到:
GitHub 加速计划 / eleme / element
10
1
下载
A Vue.js 2.0 UI Toolkit for Web
最近提交(Master分支:4 个月前 )
c345bb45
8 个月前
a07f3a59
* Update transition.md
* Update table.md
* Update transition.md
* Update table.md
* Update transition.md
* Update table.md
* Update table.md
* Update transition.md
* Update popover.md 9 个月前
更多推荐
已为社区贡献7条内容
所有评论(0)