Web Service Proxy Generator
Passing an array parameter - am I doing this correctly?
Rick, Am I passing the array parameter, loItems, correctly? loService.SendOrderStep3toStep4WithPackages("8a9RlQeY+4M=",134219261,loItems)
How can I see the xml request I am sending?
Please advise, Deb
***************************************
* https://sales-ws.farfetch.com/pub/apistock.asmx?WSDL
***************************************
* Make soap request.
* Receive data back in an object. Convert object to xml and save.
***************************************
SET STEP ON
CLEAR ALL
CLOSE ALL
***************************************
* Set the paths.
SET PATH TO "c:\program files (x86)\west wind web service proxy generator for visual foxpro\generated\" ADDITIVE
SET PATH TO "c:\program files (x86)\west wind web service proxy generator for visual foxpro\generated\farfetch\" ADDITIVE
***************************************
* Load the ww bridge libraries
DO wwDotNetBridge
* Load the apistockproxy libraries that we created using the ww proxy generator.
SET PROCEDURE TO apistockproxy ADDITIVE
DO apistockproxy
***************************************
* Now we can create the APIStockProxy object
LOCAL loService as APIStockProxy
loService = CREATEOBJECT("APIStockProxy","V4")
?loService
***************************************
* Populate the box
loBox=loService.oBridge.CreateInstance("APIStock.Box")
loBox.id = 99
loBox.Description = ''
loBox.Quantity = 1
?loBox
*** Create an array by specifying the element type
loItems = loService.oBridge.CreateArray("APIStock.OrderLineRequest")
? loItems.Count && 0
*** Create and add 1 new item
loItem = loItems.CreateItem()
loItem.Box = loBox
loItem.Id = 49692441
loItems.AddItem(loItem)
? loItems.Count && 1
* Make the call to get the data.
*!* loResult = loService.SendOrderStep3toStep4("8a9RlQeY+4M=",134219261)
*!* ?loResult
loResult = loService.SendOrderStep3toStep4WithPackages("8a9RlQeY+4M=",134219261,loItems)
?loResult
***************************************
IF ISNULL(loResult)
? loService.cErrorMsg
? "No data returned" return
ENDIF
***************************************
* Convert the result object to xml and save.
llFormatted = .t.
lcXML = loService.oBridge.ToXml(loResult, llFormatted)
?lcXML
lcXML = STRCONV(lcXML,9)
STRTOFILE(lcxml,"f:\deb\ww\farfetch\out\pkg134219261.xml")
***************************************
Looks right.
You can't directly see the HTML sent. You can use an Http Proxy like Fiddler to intercept HTTP requests going to the server although that's a bit tricky to set up as the proxy has to be explicitly assigned.
+++ Rick ---