100分求:VB.net函数转成delphi,也就是SOAP的应用! ( 积分: 100 )

  • 主题发起人 主题发起人 lijianzhou
  • 开始时间 开始时间
L

lijianzhou

Unregistered / Unconfirmed
GUEST, unregistred user!
下面是用vb.net做的函数,请问如何转成delphi,感谢!

Public Function FxQx(ByVal trid As String, ByVal dq As String, ByVal serverid As String, ByVal zhujiao As String, ByVal box As RichTextBox) As String
Try
Dim xxid As String
Randomize()
xxid = Trim(trid) + "00000" + Trim(Format(Int(Rnd() * 100000), "00000"))
Dim xhttp As MSXML2.XMLHTTP
xhttp = CreateObject("Microsoft.XMLHTTP")
xhttp.open("POST", "http://11.11.11.11/dsmp/dsmp.wsdl", False)
Dim XmlBody As String = ""
XmlBody = XmlBody + &quot;<?xml version=&quot;&quot;1.0&quot;&quot; encoding=&quot;&quot;UTF-8&quot;&quot; ?> &quot; &amp; vbCrLf
XmlBody = XmlBody + &quot;<SOAP-ENV:Envelope xmlns:SOAP-ENV=&quot;&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&quot; xmlns:SOAP-ENC=&quot;&quot;http://schemas.xmlsoap.org/soap/encoding/&quot;&quot; xmlns:xsi=&quot;&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&quot; xmlns:xsd=&quot;&quot;http://www.w3.org/2001/XMLSchema&quot;&quot; SOAP-ENV:encodingStyle=&quot;&quot;http://schemas.xmlsoap.org/soap/encoding/&quot;&quot; xmlns=&quot;&quot;http://www.monternet.com/dsmp/schemas/&quot;&quot;>&quot; &amp; vbCrLf
XmlBody = XmlBody + &quot;<SOAP-ENV:Header>&quot; &amp; vbCrLf
XmlBody = XmlBody + &quot;<TransactionID xmlns=&quot;&quot;http://www.monternet.com/dsmp/schemas/&quot;&quot; xsi:type=&quot;&quot;xsd:string&quot;&quot;>&quot; &amp; xxid &amp; &quot;</TransactionID> &quot; &amp; vbCrLf
XmlBody = XmlBody + &quot;</SOAP-ENV:Header>&quot; &amp; vbCrLf
XmlBody = XmlBody + &quot;<SOAP-ENV:Body>&quot; &amp; vbCrLf
XmlBody = XmlBody + &quot;<UnSubscribeServiceReq xmlns=&quot;&quot;http://www.monternet.com/dsmp/schemas/&quot;&quot;>&quot; &amp; vbCrLf
XmlBody = XmlBody + &quot;<Version>1.5.0</Version>&quot; &amp; vbCrLf
XmlBody = XmlBody + &quot;<MsgType>UnSubscribeServiceReq</MsgType>&quot; &amp; vbCrLf
XmlBody = XmlBody + &quot;<Send_Address>&quot; &amp; vbCrLf
XmlBody = XmlBody + &quot;<DeviceType>400</DeviceType> &quot; &amp; vbCrLf
XmlBody = XmlBody + &quot;<DeviceID>&quot; &amp; trid &amp; &quot;</DeviceID>&quot; &amp; vbCrLf
XmlBody = XmlBody + &quot;</Send_Address>&quot; &amp; vbCrLf
XmlBody = XmlBody + &quot;<Dest_Address>&quot; &amp; vbCrLf
XmlBody = XmlBody + &quot;<DeviceType>0</DeviceType>&quot; &amp; vbCrLf
XmlBody = XmlBody + &quot;<DeviceID>&quot; &amp; dq &amp; &quot;</DeviceID>&quot; &amp; vbCrLf
XmlBody = XmlBody + &quot;</Dest_Address>&quot; &amp; vbCrLf
XmlBody = XmlBody + &quot;<FeeUser_ID>&quot; &amp; vbCrLf
XmlBody = XmlBody + &quot;<UserIDType>1</UserIDType>&quot; &amp; vbCrLf
XmlBody = XmlBody + &quot;<MSISDN>&quot; &amp; zhujiao &amp; &quot;</MSISDN>&quot; &amp; vbCrLf
XmlBody = XmlBody + &quot;<PseudoCode /> &quot; &amp; vbCrLf
XmlBody = XmlBody + &quot;</FeeUser_ID>&quot; &amp; vbCrLf
XmlBody = XmlBody + &quot;<DestUser_ID>&quot; &amp; vbCrLf
XmlBody = XmlBody + &quot;<UserIDType>1</UserIDType>&quot; &amp; vbCrLf
XmlBody = XmlBody + &quot;<MSISDN>&quot; &amp; zhujiao &amp; &quot;</MSISDN>&quot; &amp; vbCrLf
XmlBody = XmlBody + &quot;<PseudoCode />&quot; &amp; vbCrLf
XmlBody = XmlBody + &quot;</DestUser_ID>&quot; &amp; vbCrLf
XmlBody = XmlBody + &quot;<Service_ID>&quot; &amp; vbCrLf
XmlBody = XmlBody + &quot;<ServiceIDType>1</ServiceIDType>&quot; &amp; vbCrLf
XmlBody = XmlBody + &quot;<SPID>&quot; &amp; trid &amp; &quot;</SPID>&quot; &amp; vbCrLf
XmlBody = XmlBody + &quot;<SPServiceID>&quot; &amp; serverid &amp; &quot;</SPServiceID>&quot; &amp; vbCrLf
XmlBody = XmlBody + &quot;<AccessNo />&quot; &amp; vbCrLf
XmlBody = XmlBody + &quot;<FeatureStr />&quot; &amp; vbCrLf
XmlBody = XmlBody + &quot;</Service_ID>&quot; &amp; vbCrLf
XmlBody = XmlBody + &quot;</UnSubscribeServiceReq>&quot; &amp; vbCrLf
XmlBody = XmlBody + &quot;</SOAP-ENV:Body>&quot; &amp; vbCrLf
XmlBody = XmlBody + &quot;</SOAP-ENV:Envelope>&quot;
xhttp.send(XmlBody)
XmlBody = Nothing
Dim MSTO As MSXML2.DOMDocument
MSTO = xhttp.responseXML
xhttp = Nothing
Dim S As String
S = MSTO.selectSingleNode(&quot;//hRet&quot;).text
MSTO = Nothing
Return S
Catch ex As Exception
Return 9
box.Text += zhujiao &amp; &quot;-&quot; &amp; serverid &amp; &quot;??,????:????,?????,?????????????!&quot; + Chr(10)
End Try
End Function
 
請參考:http://www.delphibbs.com/delphibbs/dispq.asp?lid=3655365
這個沒什麼難度。
 
已经发送邮件给你.
 
接受答案了.
 
后退
顶部