在vb6.0中如何调用.Net写的Web Service
我写了一个Web Service方法:
GetEmployee(byval employeeNo as string) as Employee
我在客户端和服务端Employee类的定义如下
Public Class
Public EmployeeNo as String
Public EmployeeName as String
End Class
我现在要在vb6.0客户端使用soap调用他
Set soapClient3 = New MSSOAPLib30.SoapClient30
On Error GoTo ErrorHandler
soapClient3.MSSoapInit2 App.Path & "/EmployeeService.wsdl", _
"", _
"EmployeeService", _
"EmployeeServiceSoap", _
"http://tempuri.org/"
If Err.Number <> 0 Then
MsgBox "initialization failed " + Err.Description
End If
dim employee as new Employee
employee=soapClient3.GetEmployee("123")
系统总是提示错误:object doesn't support this property or method.
但是我使用Call soapClient3.GetEmployee("123")系统正常。
请高手指点!
问题点数:100、回复次数:8Top
1 楼saucer(思归)回复于 2003-12-02 20:39:37 得分 80
look into
Microsoft SOAP Toolkit Type Mappers
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnservice/html/service06042002.aspTop
2 楼net_lover(【孟子E章】)回复于 2003-12-02 20:47:13 得分 15
http://xml.sz.luohuedu.net/xml/ShowDetail.asp?id=0BC0AD5B-0C3B-4B9C-958E-68B7D94AC0F8Top
3 楼suhuoqiang(小心女人.Net)回复于 2003-12-03 02:37:20 得分 5
look into
Microsoft SOAP Toolkit Type Mappers
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnservice/html/service06042002.asp
http://xml.sz.luohuedu.net/xml/ShowDetail.asp?id=0BC0AD5B-0C3B-4B9C-958E-68B7D94AC0F8Top
4 楼Maurice(Maurice)回复于 2003-12-03 10:48:58 得分 0
还是不行,执行到employee=soapClient3.GetEmployee("123")时系统提示错误:object doesn't support this property or method.
我使用本地调式返回的xml文件如下:
<?xml version="1.0" encoding="utf-8" ?>
- <Employee xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://tempuri.org/">
<EmployeeNo>103</EmployeeNo>
<EmployeeName>David Xong</EmployeeName>
</Employee >
为什么我在vb6中不能把返回值赋给Employee类?
我要如何调用才能成功?
Top
5 楼saucer(思归)回复于 2003-12-03 11:02:42 得分 0
for complex types, you need to specify a custom type mapper, otherwise you have to deal with XML yourselfTop
6 楼Maurice(Maurice)回复于 2003-12-03 11:06:38 得分 0
谢谢,如何建立自定义的类型映射?用xml又如何处理?
我试过把执行结果返回给一个xmldocument,系统提示同样的错误。Top
7 楼saucer(思归)回复于 2003-12-03 11:42:26 得分 0
>>>如何建立自定义的类型映射
read the above article
>>>用xml又如何处理?
try to find out what is being returned by soapClient3.GetEmployee("123"), most likely it is an IXMLNodeListTop
8 楼Maurice(Maurice)回复于 2003-12-03 12:47:23 得分 0
Its type is system_ComObject.
Let me try. Anyway, thank you very much.Top




