Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP MSSoap.SoapClient30
Message
From
11/12/2017 15:21:56
 
 
To
11/12/2017 11:44:01
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
01656273
Message ID:
01656287
Views:
84
Not directly on your question, but at least on topic:
I had to implement a couple of SOAP connections created this decade to vfp. Vfp soap client ran always into trouble fast, from security mangling/injection done automatically by newer standards to XML not in scope of programming back then.

My advice: If you have a well running example in .Net, Java or Python create a wrapper and access that via COM. If installation woes/fears do not allow that, do it manually either via XmlHTTP for very basic stuff or one of Rick's classes, as he conquered some of the pitfalls.

been there ;-)


>Good Afternoon Dear Experts.
>
>I am trying to set up a VFP communication with a Webservice WSDL.
>At the same time, I'm developing in .NET and I have the following code:
>
>
>        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?
>At this point I already have the following, but it is giving error in line 22:
>
>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:
>OLE IDispatch exception code 0 from?: The formatter issued an exception while trying to undo the serialization of the message: An error occurred while trying to unsubscribe from the http://tempuri.org/:logOnArgs parameter. The InnerException message was' Error at line 1 position 561. Waiting for the 'Element' state. Found 'Text' with the name '', namespace ''. '. See InnerException for more details ...
>
>Thanks so much for your help!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform