Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Names instead of numbers as indexes of arrays
Message
 
To
02/03/2009 07:37:49
General information
Forum:
Visual FoxPro
Category:
Web Services
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows XP
Database:
MySQL
Application:
Desktop
Miscellaneous
Thread ID:
01383776
Message ID:
01385090
Views:
53
What you are doing in your example isn't going to work with the SOAP toolkit. The Soap Toolkit will return any complex data as a raw XML stream that you have to parse. No objects and certainly no arrays (unless you explicitly set up a schema).

You can find more information on how to possibly deal with the returned XML directly here:
http://www.west-wind.com/presentations/foxpronetwebservices/foxpronetwebservices.asp

Personally I would recommend to skip the SOAP Toolkit. It's dead technology and it never worked well with anything but simple type parameters and return values. A better choice is to use .NET as an intermediary and have it make the Web service calls on your behalf.

You can find more info on calling Web Services from FoxPro through .NET here:
http://www.west-wind.com/presentations/foxdotnetwebservices/

We also have a tool that automates the process in the last article by automatically creating a .NET assembly and FoxPro proxy, so you don't need to write any of the .NET code or use Visual Studio.

You can find the West Wind Web Service Proxy Generator tool here:
http://www.west-wind.com/wsdlgenerator/

Even so, I'm pretty sure though that whatever gets created on result of that service call that returns the array the result will NOT be a collection but a plain array. If you need to look up values in that array you'll have to scan the array for find the appropriate items.

Good luck,

+++ Rick ---

>>It depends on what you are using to interface with the Web Service and more importantly what the server expects.
>>
>>As you know VFP arrays don't support named indexers, so if you end up passing an array that won't work. You can use collections, but VFP collections are not likely to be a workable parameter input to a Web Service call.
>>
>>In general too, Web Services don't support named indexer's either. Web Services tend to serialize data into simple arrays. For example, if you have a .NET Web Service and you publish a collection or a dictionary into the WSDL it'll end up as an array.
>>
>>Why do you need this functionality and why should it matter how you get the data into it? If this is necessary in your code why not create a collection internally and then turn the collection back into an array or something along those lines.
>
>In this case... unfortunately... it ask only for index name... something near to (translated for VFP)
>
>
dimension aCategories[2]
>aCategories[1]=1
>aCategories[2]=2
>dimension aDatainput[4]
>aDatainput["product_id"]="0001"
>aDatainput["description"]="product description"
>aDatainput["price"]=10.22
>aDatainput["categories"]=aCategories
>
>loWSHandler = Newobject("WSHandler",Iif(Version(2)=0,"",Home()+"FFC\")+"_ws3client.vcx")
>loWS = loWSHandler.SetupClient("http://www.domain.com/store/index.php/api/soap/index/wsdl/1")
>lsessionId = loWS.login('adminremote', 'password')
>axpto = loWS.Call(lsessionId, [product.currentStore], [default])
>lcprod = loWS.call(lsessionId, 'product.create', @aDatainput);
>
>
>If I try to use collections instead array aDatainput.. It will not be interpreted wrongly? I mean, input object not array?
>
>Maybe, by years working with VFP.. This is the first time that I face limitations here!
>
>tks
>>
>>+++ Rick ---
>>
>>>To consuming a Web Services, By parameter, I need to set as array's index a name instead of number, as described following:
>>>
>>>
>>>array('name'=>'new name of product'),
>>>
>>>In VFP, is that possibility, I mean... The possibility to contour this difference.. giving something to this web service that can be interpreted on its needs?
>>>
>>>Any help will be full appreciated..
>>>
>>>
>>>Claudio
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Reply
Map
View

Click here to load this message in the networking platform