Dim client As ISession2.Session2Client = New ISession2.Session2Client() Dim session As ISession2.SessionOpenResult = client.Open(Nothing, ISession2.WsRemoteClientTypes.WebserviceClient) If (session.ErrorMessage Is Nothing And session.SessionId IsNot Nothing And session.Status = "cmdDone") Then Dim logOnArgs As ISession2.SessionLogOnArgs = New ISession2.SessionLogOnArgs() logOnArgs.UserName = "WebService" logOnArgs.UserPassword = "password" logOnArgs.StationName = "WebService" logOnArgs.OwnerName = Nothing Dim logOn As ISession2.SessionLogOnResult logOn = client.LogOn(session.SessionId, logOnArgs) If (logOn.ErrorMessage = Nothing And logOn.Status = "cmdDone") Then Dim sessionID = New Guid(session.SessionId) Dim material = New IMaterial.MaterialClient() Dim getMaterialResult = material.MaterialExists(sessionID, "materialID") If (getMaterialResult IsNot Nothing) Then MsgBox("material found") Else MsgBox("material not found") End If Else MsgBox("Error Log On: " & logOn.ErrorMessage) End If Else MsgBox("Error Opening: " & session.ErrorMessage) End If client.Close(session.SessionId)How can I translate this code into VFP?
If(Alltrim(m.m_chinis)=='bl') Local WSsession Local oldSessionID oWS = Createobject("MSSoap.SoapClient30") oWS.MSSoapInit("http://10.0.0.1:1353/GP.CrossEnterpriseUnit.Integrator/ISession2?wsdl") WSsession = oWS.Open(oldSessionID, "WebserviceClient") WSsessionResult = get_nodeValue_from_xml(WSsession.Item(0).ParentNode.XML,"a:Status") If(WSsessionResult=='cmdDone') WS_SessionId = get_nodeValue_from_xml(WSsession.Item(0).ParentNode.XML,"a:SessionId") msg(WS_SessionId) Try StationName = "WebService" UserName = "WebService" UserPassword = "Rmn123@456-" WSLogOn = oWS.LogOn(WS_SessionId, "StationName="+StationName+"&UserName="+UserName+"&UserPassword="+UserPassword) WSLogOnResult = get_nodeValue_from_xml(WSLogOn.Item(0).ParentNode.XML,"a:Status") msg(WSLogOnResult) Catch To oError msg("Linha " + astr(oError.Lineno) + Chr(13) + oError.Message) Endtry Else WS_Error = get_nodeValue_from_xml(WSsession.Item(0).ParentNode.XML,"a:ErrorMessage") msg(WS_Error) Endif Endif Function get_nodeValue_from_xml Lparameters myXML, myNodeName oXML= Createobject("MSXML2.DomDocument") oXML.LoadXML(myXML) oRootNode = oXML.documentElement * What is the root tag name? cRootTagName = oRootNode.tagName * Get all the nodes in the document with the special '*' * parameter, we could just pass in a tag name to get the * node list for that specific tag oNodeList = oRootNode.getElementsByTagName("*") * How many nodes did we retrieve nNumNodes = oNodeList.Length For nPos = 0 To (nNumNodes-1) Step 1 * Get the next node in the list oNode = oNodeList.Item(nPos) If(Alltrim(oNode.nodeName)==myNodeName) Return Alltrim(astr(oNode.Text)) Endif Endfor Return ''The message says: