Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP MSSoap.SoapClient30
Message
From
12/12/2017 19:05:44
 
 
To
12/12/2017 15:43:07
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
01656273
Message ID:
01656360
Views:
101
António,
Right now, after alot of "hard code", I have the code complety functional.
Have a look:
	Local WS As MSXML2.ServerXMLHTTP60
	Local SOAPAddress As String
	Local SOAPRequest As String
	Local SOAPResponse As MSXML2.DOMDocument60
	Local SessionId As String
	Local StationName As String
	Local UserName As String
	Local UserPassword As String
	Local Status As String

	m.SOAPAddress = "http://rmn-armz01:1353/GP.CrossEnterpriseUnit.Integrator/ISession2"

	m.WS = Createobject("MSXML2.ServerXMLHTTP.6.0")
	m.WS.Open("Post", m.SOAPAddress, .F.)
	m.WS.SetRequestHeader("Content-Type", "text/xml; charset=utf-8")
	m.WS.SetRequestHeader("SOAPAction","http://tempuri.org/ISession2/Open")

	TEXT TO m.SOAPRequest NOSHOW TEXTMERGE
<s11:Envelope xmlns:s11='http://schemas.xmlsoap.org/soap/envelope/'>
  <s11:Body>
    <ns1:Open xmlns:ns1='http://tempuri.org/'>
      <ns1:oldSessionId></ns1:oldSessionId>
      <ns1:remoteClientType>WebserviceClient</ns1:remoteClientType>
    </ns1:Open>
  </s11:Body>
</s11:Envelope>
	ENDTEXT

	m.WS.Send(m.SOAPRequest)

	m.SOAPResponse = m.WS.responseXML
	m.SOAPResponse.setProperty("SelectionNamespaces", 'xmlns:a="http://schemas.datacontract.org/2004/07/GP.CrossEnterpriseUnit.Integrator"')
	m.Status = m.SOAPResponse.selectNodes("//a:Status").Item(0).Text
	If(m.Status!='cmdDone')
		msg("Erro ao abrir Webservice:" + Chr(13) + m.Status)
		Return
	Endif
	m.SessionId = m.SOAPResponse.selectNodes("//a:SessionId").Item(0).Text

	m.StationName = "WebService"
	m.UserName = "WebService"
	m.UserPassword = ""

	TEXT TO m.SOAPRequest NOSHOW TEXTMERGE
<s11:Envelope xmlns:s11='http://schemas.xmlsoap.org/soap/envelope/'>
  <s11:Body>
    <ns1:LogOn xmlns:ns1='http://tempuri.org/'>
      <ns1:sessionId><<m.SessionId>></ns1:sessionId>
      <ns1:logOnArgs>
        <ns2:OwnerName xmlns:ns2='http://schemas.datacontract.org/2004/07/GP.CrossEnterpriseUnit.Integrator'></ns2:OwnerName>
        <ns2:StationName xmlns:ns2='http://schemas.datacontract.org/2004/07/GP.CrossEnterpriseUnit.Integrator'><<m.StationName>></ns2:StationName>
        <ns2:UserName xmlns:ns2='http://schemas.datacontract.org/2004/07/GP.CrossEnterpriseUnit.Integrator'><<m.UserName>></ns2:UserName>
        <ns2:UserPassword xmlns:ns2='http://schemas.datacontract.org/2004/07/GP.CrossEnterpriseUnit.Integrator'><<m.UserPassword>></ns2:UserPassword>
      </ns1:logOnArgs>
    </ns1:LogOn>
  </s11:Body>
</s11:Envelope>
	ENDTEXT

	m.WS.Open("Post", m.SOAPAddress, .F.)
	m.WS.SetRequestHeader("Content-Type", "text/xml; charset=utf-8")
	m.WS.SetRequestHeader("SOAPAction","http://tempuri.org/ISession2/LogOn")
	m.WS.Send(m.SOAPRequest)

	m.SOAPResponse = m.WS.responseXML
	m.SOAPResponse.setProperty("SelectionNamespaces", 'xmlns:a="http://schemas.datacontract.org/2004/07/GP.CrossEnterpriseUnit.Integrator"')
	m.Status = m.SOAPResponse.selectNodes("//a:Status").Item(0).Text

	msg(m.Status)
I was getting the error 415 because the Content-Type is text/xml.
Then, I was getting the error 500 because the SOAPAction was missing.
Then, I was getting an error doing the selectNodes because the namespaces were wrong.

Now, with your help, patience and tips, it's functional!
I truelly appreciate your efort, António.

Muito obrigado mesmo :)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform