Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML queries to supplier webserver to check stock availability

Status
Not open for further replies.

DrAlbany

Programmer
Joined
Jun 14, 2003
Messages
46
Location
GB
Hi Guys..,

Can any one point me in the right direction.

I have a couple of suppliers who allow XML queries for obtaining product stock and pricing. Has anyone any pointers for the best / quickest way to achieve this.

I am using VFP8

I have dones some reading about XML in general, but it's way to over the top (hopefully) for simple "give me the price and qty in stock querys.


Many thanks

Steve

Watch ya back, because some times the devil drives a minibus.
 
If I understood you correctly you receive XML file and want to query that XML? Right?
If this is so, take a look in XMLTOCURSOR() function or XMLAdapter class, convert that XML to VFP cursor and query that cursor.

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
MVP VFP
 
Hi Borislav..,

Thank you for your responce, it helped.

I'm stuck with how to create the following xml document

Sample XML: PNA Request
<?xml version="1.0" encoding="utf-8"?>
<PNARequest version="1.0">
<TransactionHeader username="YourUserName" password="YourPassword"/>
<PNAList>
<PNAItem supplierPartId="3C16793"/>
</PNAList>
</PNARequest>

I can't find how to generat it. Or do i have to create my own code to generate it??

regards

Steve

Watch ya back, because some times the devil drives a minibus.
 
The easiest way might be to build the string in memory then use the StrToFile() function to write it out to a file:
Code:
lcXML = [<?xml version="1.0" encoding="utf-8"?>] + ;
        [<PNARequest version="1.0">] + ;
        [<TransactionHeader username="YourUserName"] + ;  
        [password="YourPassword"/>] + ;
        [<PNAList>] + ; 
        [<PNAItem supplierPartId="3C16793"/>] + ;
        [</PNAList>] + ;
        [</PNARequest>]

StrToFile(lcXML, "myQuery.xml")

Note that I've used [ and ] as string delimiters to avoid problems with embedded quotes.

I've also ignored line feeds and the indents. The program receiving the XML should be able to parse the XML without them.

Geoff Franklin
 
Thanks everyone.


I really appreciate it.

I will give it a bash.

Regards


Steve

Watch ya back, because some times the devil drives a minibus.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top