-
Hi Guys
Our existing VFP Apps consume many different web services from banks, finance houses, insurance companies etc and we use West-Wind to fill in the gaps very effectively.
We have tried & tried to use our existing West-Wind setups in Lianja but they just don't seem compatible. None of the prgs or classes will run and the #INCLUDE statements don't seem to work etc etc. and there are lots of creashes.
So we are trying to use Lianja for simple HTTP GETs but struggling with that too. For instance our existing UK parameterised postcode lookup code of :
lpostcode = "CW82BA" && valid UK postcode
lidentifier = "41.42.43.44" && relevant IP
lusername = "someusername"
lpassword = "somepassword")
loSOAP.AddParameter("postcode",lpostcode)
loSOAP.AddParameter("identifier",lidentifier)
loSOAP.AddParameter("username", lusername)
loSOAP.AddParameter("password", lpassword)
lcXML = loSOAP.CallWSDLMethod("getThrfareAddresses") && calls getThrfareAddresses method & works great
should work in Lianja as :
response = posturl("http://www.postcoderwebsoap.co.uk/websoap/websoap.php/getThrfareAddresses", 30,array("type" => "Content-Type: application/x-www-form-urlencoded"), ;
"postcode=lpostcode&identifier=lidentifier"&userna me=lusername&password=lpassword")
returns nothing but no error
Also tried
response = posturl("http://www.postcoderwebsoap.co.uk/websoap/websoap.php/getThrfareAddresses", 30, ;
array("type" => "Content-Type: text/xml"), ;
"PostcodeSend.xml")
where PostCodeSend has all the parameters in an xml file or a variable.
Same answer - returns nothing....
This is about as simple as it gets - what are we missing?
Thanks in advance
SprinBox
-
Hi SpringBox,
I'd need to look further into the SOAP scenario, but if you use the REST version of the service along with the search key, the geturl() function and the network request object getfile() and getdata() methods return the data in JSON format. e.g.
Code:
mykey = "<postcoder search key>"
mypostcode = "CW82BA"
//// REST geturl()
? geturl("http://ws.postcoder.com/pcw/&mykey/address/uk/&mypostcode")
//// REST network request object getfile() and getdata()
oRequest = createObject("networkrequest")
oRequest.getfile("http://ws.postcoder.com/pcw/&mykey/address/uk/&mypostcode","myfile.json")
jstring = oRequest.getdata("http://ws.postcoder.com/pcw/&mykey/address/uk/&mypostcode")
? jstring
Regards,
Yvonne
-
Hi Yvonne
THANK YOU !! :))
Still don't quite understand why ours did not work but now have a working solution. Were the extra parameters causing the issue?
These web service calls are vital for so many apps (the problem is there is no such thing as standard xml - every service provider seems to do their own thing !!).
Thanks for your help
Simon
-
Hi Guys
Working with calling web services
response = geturl("http://ws.postcoder.com/pcw/&mykey/street/uk/&mypostcode")
works fine but now takes 60 seconds to return anything.
The same string entered in to a browser returns an instant response.
Is there any reason why it is taking so long?
Thanks
Simon
-
Normally issues like this are related to the fact that you do not have dns setup properly for your machine.
Look back on this thread and use the network request object which may help.
-
Submit a ticket containing your key and I will test it on my machine.
-
Thanks Barry
Networkrequest solved issue (very fast now) but guys beware of the extra square brackets preventing json_decode() from working !!
Cheers
Simon
-
We are migrating lots of web calls to Lianja and it is SO much easier than using a 3rd party library - WestWind seems best.
However there is one SOAP service that we are struggling with.
This is existing code was ported over from a VFP application which we know works well ie URLs etc
We are using :
oRequest = createObject("networkrequest")
oRequest.async = .f.
oRequest.putFile("https://soap.xxxxxxxxxx.co.uk/tradeservice/servlet/messagerouter", "xxxxxSend.xml")
returns "unknown URL" but we know the url is correct.
The xxxxSend.xml contains all the passwords etc in an xml file format and there are no headers that have to be set.
We have tried putFile() and postFile() and have tried replacing the filename in inverted commas with a variable containing the same.
Just for info, the VFP that works is a WestWind call.
oHTTP.nHttpPostMode = 4 && type = xml & must be called prior to AddPostKey()
oHTTP.AddPostKey() && Clear POST buffer
oHTTP.AddPostKey(lcHPISendString) && text not object
lcResult = oHTTP.HttpGet("https://soap.xxxxxxxxxx.co.uk/tradeservice/servlet/messagerouter")
Any thoughts?
Cheers
Simon
-
You are using putfile() where you should probably be using postfile().
See the doc.
https://www.lianja.com/doc/index.php/NetworkRequest
You are also uploading a file with no authentication. I.e. no username and password.
Please stop cross posting in this forum. Choose a more suitable forum such as Lianja Application Framework.
-
Hi Barry
Sorry - was trying to do the right thing by extending an existing web service post - will do so in future.
In this case all the authenticaton is contained within the xml file itself.
postfile() produces the same result as putfile() - returns .F.
Does it need to be run in runtime mode, rather than development mode to work?
Cheers
Simon