vb访问java webservice,返回Exception occurred while trying to invoke service method
我做了一个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