Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using web service
Message
De
02/10/2020 02:14:36
 
 
À
30/09/2020 18:46:27
Information générale
Forum:
Visual FoxPro
Catégorie:
Web Services
Divers
Thread ID:
01676303
Message ID:
01676424
Vues:
54
Antonio, thank you very mutch for your time. I'll try as soon as I get username/pass and learn more about web services. I think they restrict access to servis only from specific static IP adresses. I should receive list of functions I can call with parameters whitch would help.

>Thanks, I'l try.
>
>I dont understand part of sharing WSDL URL? If you need url for some additional help to me :-) there is it
>
>https://webapp2.rzzo.rs/rzzo/RzzoService?wsdl
>

Zoran, this URL points to the description of the service.

Now, a basic VFP program to contact the service and look for the connection status (CheckConnection is one of the operations of the Web Service, as described in its WSDL):
LOCAL SOAP AS String

LOCAL UserName AS String
LOCAL UserPassword AS String

m.UserName = "Zoran"
m.UserPassword = "demo"

TEXT TO m.SOAP FLAGS 1 TEXTMERGE
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns0="http://service.rzzo.rs/">
 <SOAP-ENV:Header>
  <wsse:Security SOAP-ENV:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
   <wsse:UsernameToken>
    <wsse:Username><<m.UserName>></wsse:Username>
    <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"><<m.UserPassword>></wsse:Password>
    <wsu:Created xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><<TTOC(DATETIME(), 3)>></wsu:Created>
   </wsse:UsernameToken>
  </wsse:Security>
 </SOAP-ENV:Header>
 <SOAP-ENV:Body>
  <ns0:CheckConnection/>
 </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
ENDTEXT

LOCAL HTTP AS MSXML2.ServerXMLHTTP60
LOCAL Response AS MSXML2.DOMDocument60
LOCAL Nodes AS MSXML2.IXMLDOMNodeList

m.HTTP = CREATEOBJECT("MSXML2.ServerXMLHTTP.6.0")

m.HTTP.Open("Post", "https://webapp2.rzzo.rs:443/rzzo/RzzoService", .F.)
m.HTTP.Send(m.SOAP)

m.Response = m.HTTP.ResponseXML

m.Response.SetProperty("SelectionNamespaces", 'xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" ' + ;
	' xmlns:RZ="http://service.rzzo.rs/"')

m.Nodes = m.Response.selectNodes("/SOAP:Envelope/SOAP:Body/SOAP:Fault")
IF m.Nodes.length > 0
	MESSAGEBOX("Error: " + m.Nodes.item(0).selectNodes("faultstring").item(0).text)
	RETURN
ENDIF

MESSAGEBOX("Connection: " + m.Response.selectNodes("//RZ:CheckConnectionResponse/return").item(0).text)
Obviously, the service returns an Error: Authentication of Username Password Token Failed, which is ok because I just made up a username and password for testing. There are a few details that I'm not sure on how they must be addressed, mainly concerning authentication, but I believe that you'll have documentation about that and this snippet may eventually serve as a starting point.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform