vb访问java webservice,返回Exception occurred while trying to invoke service method

weiweiplay 2011-06-25 02:17:03
我做了一个VB访问webservice的程序,总是返回Exception occurred while trying to invoke service method sendSourceFrameByRtuId提示,服务器监测提示取不到我传的参数,请高手指教

Public Function SendData(ByVal Rtu As clsRtu, Data() As Byte, ByVal Length As Long, _
ByVal Delay As Long, Optional bString As Boolean = False) As enumCommSendConstants

Dim vData As String

If gSys.Config.WebServiceKind = enumWebServiceKindID Then
vData = "<?xml version=""1.0"" encoding=""gbk""?> "
vData = vData & " <para> "
vData = vData & " <terminalId>" & Rtu.Serial & "</terminalId> "
vData = vData & " <frameContent>" & gSys.Math.BytesToHex1(Data, 0, Length) & "</frameContent> "
vData = vData & " <timeOut>" & Delay & "</timeOut> "
vData = vData & " <needResponse>1</needResponse> "
vData = vData & " </para>"
Else
vData = "<?xml version=""1.0"" encoding=""gbk""?> "
vData = vData & " <para> "
vData = vData & " <rtuAddress>" & Rtu.AddressMessage & "</rtuAddress> "
vData = vData & " <frameContent>" & gSys.Math.BytesToHex1(Data, 0, Length) & "</frameContent> "
vData = vData & " <timeOut>" & Delay & "</timeOut> "
vData = vData & " <needResponse>1</needResponse> "
vData = vData & " </para>"
End If

SendData = Send(vData)
End Function

Private Function Send(ByVal vData As String) As enumCommSendConstants
Dim strTest As String
Dim strXml As String
'
On Error GoTo ErrHandle
'
If gSys.Config.WebServiceKind = enumWebServiceKindID Then
strTest = "<?xml version=""1.0"" encoding=""utf-8""?> "
strTest = strTest & " <soap12:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap12=""http://schemas.xmlsoap.org/soap/envelope/""> "
strTest = strTest & " <soap12:Body> "
strTest = strTest & " <sendSourceFrameByRtuId xmlns=""http://yzxf.webservice.dareway.com/""><sourceXml>" & vData & "</sourceXml></sendSourceFrameByRtuId>"
strTest = strTest & " </soap12:Body> "
strTest = strTest & " </soap12:Envelope> "
Else
strTest = "<?xml version=""1.0"" encoding=""utf-8""?> "
strTest = strTest & " <soap12:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap12=""http://schemas.xmlsoap.org/soap/envelope/""> "
strTest = strTest & " <soap12:Body> "
strTest = strTest & " <sendSourceFrameByRtuAddress xmlns=""http://yzxf.webservice.dareway.com/""><sourceXml>" & vData & "</sourceXml></sendSourceFrameByRtuAddress>"
strTest = strTest & " </soap12:Body> "
strTest = strTest & " </soap12:Envelope> "
End If
strXml = strTest

mDoc.loadXML strXml
mXml.Open "POST", gSys.Config.WebServiceAdd, True
mXml.setRequestHeader "Content-Type", "text/xml"
mXml.Send (strXml)
Flag = True

Send = enumCommSendSucceed

Exit Function
ErrHandle:
Send = enumCommSendChannelError
End Function
...全文
735 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
weiweiplay 2011-06-25
  • 打赏
  • 举报
回复
在线等
weiweiplay 2011-06-25
  • 打赏
  • 举报
回复
自己顶

1,502

社区成员

发帖
与我相关
我的任务
社区描述
VB 网络编程
社区管理员
  • 网络编程
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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