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 调用把。
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。
其他相似内容:
-
这是一种动态图形人机界面(HMI)
传统的HMI人机界面一般是采用很多ActiveX控件堆放在一个画面上,每个ActiveX控件执行一个功能(例如曲...
-
数据库存了图片路径,获取时出了问题
我有两张页面,我的图片保存在sshh文件夹中,当主页要用到图片时候,路径是对的:web1/sshh/ss.jpg
但...
-
web Service 验证方式,该如何选择?
公司要开放WEB SERVICE,看了许多发现验证方式有:使用SoapHeader传递和验证用户、使用验证票(Autho...
-
Web Service 参数问题
我有三个工程,一个是类库A,一个WebService B,一个是应用程序 C
假设A中有一个类a,B中有两个ASMX b1,b...
-
打包WebService程序
我希望能把我的WebService程序制作成安装包,安装时能够自动建立网站运行,什么打包工具可以用,谢谢了!
------解...
-
Web Service 要增加附件 怎么做?
Web Service 通信时如果要增加图片或是声音文件 要怎么做?
最后附上代码
------解决方案--------...
-
wcf开发restful的服务
那位高手知道有wcf开发restful的服务的资料、源码、视频,请告知一下,不胜感激
------解决方案-------------...
-
ws在IIS上面发布之后,运行报错
我的代码如图,我就是写了一个简单的方法测试而已
在IIS上面发布之后如图
然后我右键预览,就出这个...
-
为什么ajax的webservice的后台文件必须放在App_Code目录下?
如题。放到其他地方就会报错。
------解决方案--------------------
...
-
刚接触WEBSERVICE,有问题特来请教前辈(关于发布)
最近公司要求使用WEBSERVICE,以方便以后的扩展,因此来学习下这个,但是现在看了蛮多例...