积极答复者
使用execl call wcf所遇到的問題

问题
-
當我使用ILIS有使用到InsertMachineData(ByVal LogMachine As DataSet) As Boolean便會呼叫失敗,有使用到DataSet,使用InsertMachineData(ByVal LogMachine As String) As Boolean就會呼叫成功,沒有使用到DataSet,有人有遇過這種情況嗎???
execl code
Private Sub CommandButton1_Click()
Dim mexMonikerString As String
Dim mexServiceMoniker As Object
'---------------------------------------------------------------
' MEX service moniker example
'---------------------------------------------------------------
' Create a string for the service moniker specifying the address
' to retrieve the service metadata from
mexMonikerString = "service:mexAddress='http://ip位址/Vb6CallWcf/basic/Lis.svc/mex'"
mexMonikerString = mexMonikerString + ", address='http://ip位址/Vb6CallWcf/basic/Lis.svc'"
mexMonikerString = mexMonikerString + ", binding=BasicHttpBinding_ILis, bindingNamespace='http://tempuri.org/'"
mexMonikerString = mexMonikerString + ", contract=ILis, contractNamespace='http://tempuri.org/'"
' Create the service moniker object
Set mexServiceMoniker = GetObject(mexMonikerString)
' Call the service operations using the moniker object
Me.Label1.Caption = mexServiceMoniker.ReturnString("Andy")
End SubetObject(mexMonikerString)
' Call the service operations using the moniker object
Me.Label1.Caption = mexServiceMoniker.ReturnString("Andy")
ILisImports System.ServiceModel Imports System.Data Imports System.Xml.Serialization <ServiceContract()> _ Public Interface ILis <OperationContract()> _ Function InsertMachineData(ByVal LogMachine As DataSet) As Boolean <OperationContract()> _ Function ReturnString(ByVal aa As String) As String End Interface
Lis.vbImports nckuh.lis.common Imports System.Data Imports System.Data.SqlClient Public Class Lis Implements ILis Public Function InsertMachineData(ByVal LogMachine As DataSet) As Boolean Implements ILis.InsertMachineData Dim LogMachineLog As New Set Return True End Function Public Function ReturnString(ByVal aa As String) As String Implements ILis.ReturnString Return aa + ":測試成功" End Function End Class
答案
-
Hi,
VB6起码要支持WCF,才能使用WCF类库提供的工具。
如果不支持的话,你传递的类型在发送给WCF服务以前就,客户端就不能序列化。
这样调用肯定失败的。
Frank Xu Lei--谦卑若愚,好学若饥
专注于.NET平台下分布式应用系统开发和企业应用系统集成
Focus on Distributed Applications Development and EAI based on .NET
欢迎访问老徐的中文技术博客:Welcome to My Chinese Technical Blog
欢迎访问微软WCF中文技术论坛:Welcome to Microsoft Chinese WCF Forum
欢迎访问微软WCF英文技术论坛:Welcome to Microsoft English WCF Forum- 已标记为答案 Frank Xu LeiModerator 2009年12月26日 6:40
-
Hi,
我也是認為vb6無法序列化要傳送過去的參數DataSet,所以才會產生這種錯誤,如果傳送一些String、Boolean的話是沒問題的,會回傳回來。
謝謝Frank指導- 已标记为答案 Frank Xu LeiModerator 2009年12月26日 6:40
全部回复
-
Hi,
有什么错误?
Frank Xu Lei--谦卑若愚,好学若饥
专注于.NET平台下分布式应用系统开发和企业应用系统集成
Focus on Distributed Applications Development and EAI based on .NET
欢迎访问老徐的中文技术博客:Welcome to My Chinese Technical Blog
欢迎访问微软WCF中文技术论坛:Welcome to Microsoft Chinese WCF Forum
欢迎访问微软WCF英文技术论坛:Welcome to Microsoft English WCF Forum -
Hi,
你的客户端代码是自己手写的?
是否是客户端添加WCF服务引用或者 SVCUtil.exe来生成的。
自己手动写客户端调用程序,容易出现错误,建议借助客户端添加WCF服务引用或者 SVCUtil.exe来生成。
Frank Xu Lei--谦卑若愚,好学若饥
专注于.NET平台下分布式应用系统开发和企业应用系统集成
Focus on Distributed Applications Development and EAI based on .NET
欢迎访问老徐的中文技术博客:Welcome to My Chinese Technical Blog
欢迎访问微软WCF中文技术论坛:Welcome to Microsoft Chinese WCF Forum
欢迎访问微软WCF英文技术论坛:Welcome to Microsoft English WCF Forum -
不好意思,請問一下vb6可以添加WCF服务引用或者 SVCUtil.exe的代碼嗎,這一個方法我沒try過
因為不想安裝Mssoap3.0在vb6上,才想要try看看直接用呼叫的方式來使用WCF
我的客戶端代碼如下:
Dim mexMonikerString As String
Dim mexServiceMoniker As Object
'---------------------------------------------------------------
' MEX service moniker example
'---------------------------------------------------------------
' Create a string for the service moniker specifying the address
' to retrieve the service metadata from
mexMonikerString = "service:mexAddress='http://ip位址/Vb6CallWcf/basic/Lis.svc/mex'"
mexMonikerString = mexMonikerString + ", address='http://ip位址/Vb6CallWcf/basic/Lis.svc'"
mexMonikerString = mexMonikerString + ", binding=BasicHttpBinding_ILis, bindingNamespace='http://tempuri.org/'"
mexMonikerString = mexMonikerString + ", contract=ILis, contractNamespace='http://tempuri.org/'"
' Create the service moniker object
Set mexServiceMoniker = GetObject(mexMonikerString)
' Call the service operations using the moniker object
Me.Label1.Caption = mexServiceMoniker.ReturnString("Andy")
End SubetObject(mexMonikerString)
' Call the service operations using the moniker object
Me.Label1.Caption = mexServiceMoniker.ReturnString("Andy") -
Hi,
VB6起码要支持WCF,才能使用WCF类库提供的工具。
如果不支持的话,你传递的类型在发送给WCF服务以前就,客户端就不能序列化。
这样调用肯定失败的。
Frank Xu Lei--谦卑若愚,好学若饥
专注于.NET平台下分布式应用系统开发和企业应用系统集成
Focus on Distributed Applications Development and EAI based on .NET
欢迎访问老徐的中文技术博客:Welcome to My Chinese Technical Blog
欢迎访问微软WCF中文技术论坛:Welcome to Microsoft Chinese WCF Forum
欢迎访问微软WCF英文技术论坛:Welcome to Microsoft English WCF Forum- 已标记为答案 Frank Xu LeiModerator 2009年12月26日 6:40
-
Hi,
我也是認為vb6無法序列化要傳送過去的參數DataSet,所以才會產生這種錯誤,如果傳送一些String、Boolean的話是沒問題的,會回傳回來。
謝謝Frank指導- 已标记为答案 Frank Xu LeiModerator 2009年12月26日 6:40
-
Hi,
不客气.欢迎常来交流~
看你使用繁体中文,是香港、澳门或者台湾的IT技术人员?
呵呵
Frank Xu Lei--谦卑若愚,好学若饥
专注于.NET平台下分布式应用系统开发和企业应用系统集成
Focus on Distributed Applications Development and EAI based on .NET
欢迎访问老徐的中文技术博客:Welcome to My Chinese Technical Blog
欢迎访问微软WCF中文技术论坛:Welcome to Microsoft Chinese WCF Forum
欢迎访问微软WCF英文技术论坛:Welcome to Microsoft English WCF Forum -
Hi,
很高兴认识你,欢迎以后常来交流~
Wizard Wu 也是来自台湾,有时候会和他讨论问题~
Frank Xu Lei--谦卑若愚,好学若饥
专注于.NET平台下分布式应用系统开发和企业应用系统集成
Focus on Distributed Applications Development and EAI based on .NET
欢迎访问老徐的中文技术博客:Welcome to My Chinese Technical Blog
欢迎访问微软WCF中文技术论坛:Welcome to Microsoft Chinese WCF Forum
欢迎访问微软WCF英文技术论坛:Welcome to Microsoft English WCF Forum