专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > Web Service

CXF 实现的web service,VFP调用报错

发布时间:2010-05-20 14:01:29 文章来源:www.iduyao.cn 采编人员:星星草
CXF 实现的web service,VFP调用出错
我用cxf实现了web service,用java客户端测试成功,但客户的生产系统是用VFP开发的,客户通过VFP访问我的web service时却报错,我自己用VFP进行测试,确认会报如下错误:

OLE IDispatch exception code 0 from Client: Client:Incorrect number of parameters supplied for SOAP request HRESULT=0x80070057: 参数不正确。
 - Client:Unspecified client error. HRESULT=0x80070057: 参数不正确。

我将接口简化为只有一个test方法,该方法只传入一个字符串变量,返回一个字符串结果,但报错依旧。wsdl内容如下:

<wsdl:definitions xmlns:ns1="http://schemas.xmlsoap.org/soap/http" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://ws.fitcolg.bepanda/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="StudentServiceImplService" targetNamespace="http://ws.fitcolg.bepanda/">
<wsdl:types>
<xsd:schema xmlns:tns="http://ws.fitcolg.bepanda/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://ws.fitcolg.bepanda/">
<xsd:element name="test" type="tns:test"/>
<xsd:complexType name="test">
<xsd:sequence>
<xsd:element minOccurs="0" name="username" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="testResponse" type="tns:testResponse"/>
<xsd:complexType name="testResponse">
<xsd:sequence>
<xsd:element minOccurs="0" name="testResult" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:message name="testResponse">
<wsdl:part element="tns:testResponse" name="parameters"></wsdl:part>
</wsdl:message>
<wsdl:message name="test">
<wsdl:part element="tns:test" name="parameters"></wsdl:part>
</wsdl:message>
<wsdl:portType name="StudentService">
<wsdl:operation name="test">
<wsdl:input message="tns:test" name="test"></wsdl:input>
<wsdl:output message="tns:testResponse" name="testResponse"></wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="StudentServiceImplServiceSoapBinding" type="tns:StudentService">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="test">
<soap:operation soapAction="http://ws.fitcolg.bepanda/" style="document"/>
<wsdl:input name="test">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="testResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="StudentServiceImplService">
<wsdl:port binding="tns:StudentServiceImplServiceSoapBinding" name="StudentServiceImplPort">
<soap:address location="http://localhost:8080/stu/ws"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

我测试的VFP代码如下:
         local loSoap
         loSoap.MSSoapInit('http://localhost:8080/stu/ws?wsdl')
         loSoap.test("tom") ----- 这一行报错,且调试得知未正常请求进入到webservice的后台方法
如果将loSoap.test("tom")这一句的参数去掉,即变为:
         loSoap.test() ---- 则能进入到webservice的后台方法,且客户端没有报错
如果将loSoap.test()这一句的结果输出,即变为:
         messagebox(loSoap.test()) ---- 则客户端又报同样的错,但也能请求进入到webservice的后台方法


出错情况总结:
1、loSoap.test() --- 既不传入参,也不接收返回值,则没有报错,能正常调webservice方法
2、loSoap.test("tom") --- 传入参,则客户端报错,且没有调webservice方法
3、messagebox(loSoap.test()) --- 不传入参,但接收返回值,则能正常调webservice方法,但客户端报错

综上,只要没有参数传递,就正常,一有参数传入或接收,就客户端报错。

求教各位大侠了,先谢了!

------解决方案--------------------
VFP 太老了。连String都不支持的话,就不要用WebService了。

你用cxf 开发Rest Service直接通过Http/XML 或者 Plain/text 调用把。
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: