Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Passing an object to a web service
Message
From
01/04/2008 06:10:03
 
 
To
31/03/2008 17:53:20
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01306745
Message ID:
01307258
Views:
14
>Thanks, Viv! But can you just give me a little more direction. What do you mean by "create a message"? Sorry for being new to Soap and Web Services. Do you mean I should do an httppost and pass the xml string as shown in the IE link you pointed out? I'd rather call the function (if this is possible) such as:
>
>m.lo1= loWS.getPropertyInquiries(m.loCredentials, 9999, DATE() - 365, DATE())
>
>But I'm stuck on that Credentials object, I can't figure out how to pass this object (or instantiate it). I tried using an Empty class and adding the properties, and passing that object, but it didn't like it. I really appreciate your help and anything further you can offer!! -Mark
>
>>>I'm trying to use a SOAP web service, and many of the available methods of the service require passing what they call a "Credentials" object as one of the parameters (it seems to be a simple object with just 2 properties). The WSDL document (see link below), defines the Credentials complex object near the top of the WSDL. I'm new to web services, and was hoping someone could tell me if this is possible (is it possible to send and receive objects from a web service using VFP), or give me a little direction. Thank you.
>>>
>>>Here's the code I'm using:
>>>
>>>loWSHandler = NEWOBJECT("WSHandler",IIF(VERSION(2)=0,"",HOME()+"FFC\")+"_ws3client.vcx")
>>>loWS= loWSHandler.SetupClient(;
>>>	"http://www.triphomes.com/webservices/wvrgroupservice.asmx?WSDL",;
>>>	"WVRGroupService", "WVRGroupServiceSoap")
>>>	
>>>* ??? Help please. How do I create and pass the "Credentials object", which is defined near the top of the WSDL ???
>>>
>>>* params to getPropertyInquiries() are: Credentials object, ContactID, begin date, end date
>>>m.lo1= loWS.getPropertyInquiries(m.loCredentials, 9999, DATE() - 365, DATE())
>>>
Hi,
MSSOAP won't understand VFP objects. Probably better to use XMLHTTP instead. Something like this should work:
oH = CREATEOBJECT("Microsoft.XMLHTTP")
siteurl = "http://www.triphomes.com/webservices/wvrgroupservice.asmx"
TEXT TO request NOSHOW
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://www.triphomes.com/webservices/" xmlns:types="http://www.triphomes.com/webservices/encodedTypes" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <tns:GetPropertyInquiries>
      <credentials href="#id1" />
      <propertyManagerAccountID xsi:type="xsd:string">12345</propertyManagerAccountID>
      <from xsi:type="xsd:dateTime">2008-04-01T10:53:57</from>
      <to xsi:type="xsd:dateTime">2008-04-01T10:53:57</to>
    </tns:GetPropertyInquiries>
    <tns:Credentials id="id1" xsi:type="tns:Credentials">
      <RequestorUID xsi:type="xsd:string">MyId</RequestorUID>
      <RequestorPassword xsi:type="xsd:string">MyPassword</RequestorPassword>
    </tns:Credentials>
  </soap:Body>
</soap:Envelope>
ENDTEXT
oH.open("POST",siteurl,.F.,"","")
oH.SetRequestHeader("Content-type","text/xml")
oH.Send(request)
I hard-coded the values but you could put this in a method, pass in the parameters and use TEXTMERGE to populate. Note the format required for DateTime tho. Parse oH.ResponseText or use oH.ResponseXML to retrieve the results.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform