用CXF调用Axis1发布的webservice出错,崩溃中

wallflower 2011-06-13 11:48:53
场景:使用CXF客户端(由wsdl2java生成)来访问axis1生成的webservice。每当webservice返回值的对象里有数组的时候,就出错:
javax.xml.ws.soap.SOAPFaultException: Unmarshalling Error: unexpected element (uri:"", local:"name"). Expected elements are <{http://localhost:8080/AxisTest/services/GetArray}name>,<{http://localhost:8080/AxisTest/services/GetArray}strArray>
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:146)
at $Proxy23.getArrayBean(Unknown Source)
at cxf.client.helloarray.HelloWorldArray_GetArray_Client.main(HelloWorldArray_GetArray_Client.java:46)

但是该webservice用axis自己生成的客户端访问是没有问题的,并且axis发布的其他webservice(不包含数组格式的数据)用CXF访问也是没有问题。从表面上猜想可能是因为命名空间的问题,但是从wsdl来看似乎又没有问题

wsdl如下:
<wsdl:definitions targetNamespace="http://localhost:8080/AxisTest/services/GetArray">

<!--
WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)
-->

<wsdl:types>

<schema elementFormDefault="qualified" targetNamespace="http://localhost:8080/AxisTest/services/GetArray">

<complexType name="ArrayOf_xsd_string">

<sequence>
<element maxOccurs="unbounded" minOccurs="0" name="item" type="xsd:string"/>
</sequence>
</complexType>

<complexType name="ArrayBean">

<sequence>
<element name="name" nillable="true" type="xsd:string"/>
<element name="strArray" nillable="true" type="impl:ArrayOf_xsd_string"/>
</sequence>
</complexType>
<element name="getArrayBeanReturn" type="impl:ArrayBean"/>
</schema>
</wsdl:types>

<wsdl:message name="getArrayBeanResponse">
<wsdl:part element="impl:getArrayBeanReturn" name="getArrayBeanReturn"/>
</wsdl:message>
<wsdl:message name="getArrayBeanRequest">

</wsdl:message>

<wsdl:portType name="HelloWorldArray">

<wsdl:operation name="getArrayBean">
<wsdl:input message="impl:getArrayBeanRequest" name="getArrayBeanRequest"/>
<wsdl:output message="impl:getArrayBeanResponse" name="getArrayBeanResponse"/>
</wsdl:operation>
</wsdl:portType>

<wsdl:binding name="GetArraySoapBinding" type="impl:HelloWorldArray">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

<wsdl:operation name="getArrayBean">
<wsdlsoap:operation soapAction=""/>

<wsdl:input name="getArrayBeanRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>

<wsdl:output name="getArrayBeanResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>

<wsdl:service name="HelloWorldArrayService">

<wsdl:port binding="impl:GetArraySoapBinding" name="GetArray">
<wsdlsoap:address location="http://localhost:8080/AxisTest/services/GetArray"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
...全文
975 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
天天都在码字 2012-01-04
  • 打赏
  • 举报
回复
补充一下,我测试的是如何使用cxf调用 rpc/encoded格式的客户端,并不是针对axis。另附上wsdl文件
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://order.crm.deppon.com" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://order.crm.deppon.com" xmlns:intf="http://order.crm.deppon.com" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)-->
<wsdl:types>
<schema targetNamespace="http://order.crm.deppon.com" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="Order">
<sequence>
<element name="goodName" nillable="true" type="xsd:string"/>
<element name="id" nillable="true" type="xsd:string"/>
<element name="number" nillable="true" type="xsd:string"/>
<element name="status" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
</schema>
</wsdl:types>

<wsdl:message name="getStatusResponse">

<wsdl:part name="getStatusReturn" type="xsd:string">

</wsdl:part>

</wsdl:message>

<wsdl:message name="getStatusRequest">

<wsdl:part name="number" type="xsd:string">

</wsdl:part>

</wsdl:message>

<wsdl:message name="getOrderRequest">

<wsdl:part name="number" type="xsd:string">

</wsdl:part>

</wsdl:message>

<wsdl:message name="getOrderResponse">

<wsdl:part name="getOrderReturn" type="impl:Order">

</wsdl:part>

</wsdl:message>

<wsdl:portType name="OrderService">

<wsdl:operation name="getOrder" parameterOrder="number">

<wsdl:input message="impl:getOrderRequest" name="getOrderRequest">

</wsdl:input>

<wsdl:output message="impl:getOrderResponse" name="getOrderResponse">

</wsdl:output>

</wsdl:operation>

<wsdl:operation name="getStatus" parameterOrder="number">

<wsdl:input message="impl:getStatusRequest" name="getStatusRequest">

</wsdl:input>

<wsdl:output message="impl:getStatusResponse" name="getStatusResponse">

</wsdl:output>

</wsdl:operation>

</wsdl:portType>

<wsdl:binding name="OrderServiceSoapBinding" type="impl:OrderService">

<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>

<wsdl:operation name="getOrder">

<wsdlsoap:operation soapAction=""/>

<wsdl:input name="getOrderRequest">

<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://order.crm.deppon.com" use="encoded"/>

</wsdl:input>

<wsdl:output name="getOrderResponse">

<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://order.crm.deppon.com" use="encoded"/>

</wsdl:output>

</wsdl:operation>

<wsdl:operation name="getStatus">

<wsdlsoap:operation soapAction=""/>

<wsdl:input name="getStatusRequest">

<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://order.crm.deppon.com" use="encoded"/>

</wsdl:input>

<wsdl:output name="getStatusResponse">

<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://order.crm.deppon.com" use="encoded"/>

</wsdl:output>

</wsdl:operation>

</wsdl:binding>

<wsdl:service name="OrderServiceService">

<wsdl:port binding="impl:OrderServiceSoapBinding" name="OrderService">

<wsdlsoap:address location="http://localhost:8080/axisStudy/services/OrderService"/>

</wsdl:port>

</wsdl:service>

</wsdl:definitions>
天天都在码字 2012-01-04
  • 打赏
  • 举报
回复
最近也遇到同样的问题,需要cxf调用axis1的webservice,但是我使用cxf的wsdl2java工具生成客户端代码时,提示:
"WSDLToJAVA Error:Rpc/encoded wsdls are not supported with CXF"
这个情况让人很崩溃。请问楼主是怎么生成cxf的客户端的?
安心逍遥 2011-06-14
  • 打赏
  • 举报
回复
没弄过,只玩过dwr,友情帮顶。祝楼主好运...
内容概要:本文系统介绍了物理信息神经网络(PINNs)在求解布洛赫-托雷(Bloch-Torrey)方程的应用,结合PyTorch框架提供了完整的Python代码实现案例。文章深入阐述了如何将物理先验知识嵌入神经网络训练过程,通过构建复合损失函数,强制网络输出满足控制方程、初始条件与边界条件,从而实现对布洛赫-托雷方程的无网格化、高精度求解。该方法突破了传统数值方法在高维、多尺度及复杂几何场景下的计算瓶颈,展现出优异的泛化能力与计算效率,特别适用于医学成像、扩散磁共振等领域复杂的物理场建模与仿真任务。; 适合人群:具备深度学习与偏微分方程理论基础,从事科学计算、生物医学工程、材料科学或相关交叉学科研究的研究生、科研人员及算法工程师。; 使用场景及目标:①应用于扩散磁共振成像(dMRI)等医学影像技术的复杂扩散过程建模与反演;②为高维偏微分方程的高效求解提供数据驱动的新范式,提升仿真精度与计算速度;③作为PINNs在AI for Science领域的典型实践案例,推动物理引导的深度学习方法在实际科研项目的落地与拓展。; 阅读建议:建议读者结合提供的完整代码资源(可通过公众号“荔枝科研社”或百度网盘获取),动手复现并调试模型,深入理解PINNs的架构设计、损失函数构建与物理约束嵌入机制,同时可尝试将该方法迁移至其他类似物理系统的建模与求解任务进行创新性研究。
内容概要:本文围绕“基于多VSG独立微网的多目标二次控制MATLAB模型研究”展开,详细阐述了利用Simulink对多虚拟同步发电机(VSG)构成的独立微网系统进行建模与仿真,实现频率调节、电压支撑与有功无功功率均分等多目标协同优化的二次控制策略。研究引入先进的最优控制算法,解决微网在孤岛运行模式下的功率动态分配、频率电压恢复及系统稳定性问题,并通过MATLAB/Simulink平台构建完整仿真模型,验证所提控制策略在不同负载扰动下的有效性、鲁棒性与动态响应性能。; 适合人群:具备电力系统分析、现代控制理论基础以及MATLAB/Simulink仿真能力的电气工程、自动化等相关专业的硕士研究生、科研人员及从事微网控制系统开发的工程技术人才。; 使用场景及目标:① 深入理解多VSG在独立微网的并联运行机理与协同控制架构;② 掌握基于Simulink的微网二次控制系统的建模方法与仿真流程;③ 实现频率、电压与功率分配的多目标优化控制仿真验证;④ 为微网控制系统的设计、算法优化及科研课题提供可靠的仿真依据和技术参考。; 阅读建议:建议读者结合文控制策略,动手搭建Simulink模型,重点关注控制器参数整定对系统动态性能的影响,可通过对比不同工况下的仿真结果,进一步优化控制算法以提升系统鲁棒性与响应精度。

67,535

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧