Jump to content

XML GET .. Guidance


Tom Townsend

This topic is 7086 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I need some insight in the nature of XML and FMP.

Objective: Is to import data into FMP from a ...not sure what ya would call it.

I have a parts supplier that I can use their supplied program that goes out onto the web and connects with a catalog that I search the part im looking for.

This function is not http in a browser, it is through their program.

In normal function when I find what I want ... I click the ORDER button and they send it.

The parts company supplied a SDK for software intagration and in the nature of playing with it, the ORDER button turns into EXPORT button. I click it and a window named XML'er opens up with the data i NEED! It looks like this:

?xml version="1.0" encoding="UTF-8"?

!DOCTYPE ProductQuote SYSTEM 'http://www.worldpac.com/wcap/ProductQuote.dtd'

?xp Request=2?

ProductQuote

ProductID>0 130 303 209

BOS

CategoryID>G5000

ProductDesc>Auxiliary Fan Assembly

OrderByTime>2004/12/20+03:00:00+-0800

DispatchTime>2004/12/20+03:15:00+-0800

QuantityAvail>1

QuantityReq>1

Price>263.33

ListPrice>451.00

CorePrice>0.00

Weight>5.20

Quality>

/ProductQuote

?xp /?

WoW ...I pasted the above with the brackets "greater than and less than" that start and end each line and it stripped out everything except the data. What I get in the window is each piece of info is on a seperate line enclosed in the mentioned brackets.

Guidance Request = Any way to get at this and import what I need?

When I shutdown the parts suppliers program, the window with the data stays there, but the data goes away.

I would appreciate any insight on the nature of things here and how to deal with it OR a point in the right direction.

Thanks

Link to comment
Share on other sites

I'm not much of an "integrate XML with someone's SDK" expert, but here's my take on it. What you've got above is not really XML. It's missing its end tags for one thing. Did they somehow not end up in the post? Or do you just not get them? It's possible they've written their program so that it takes the above and translates it to real XML, or maybe it just doesn't care.

This is what the above would look like in proper XML. I added the end tags manually (which obviously would be too much trouble). If you wrote an XSL stylesheet, the below could be imported into FileMaker. Otherwise you'd be better off just parsing the text in FileMaker to get the data. Since you know what the tags are, this would not be too difficult. Anyway, this is XML (the line breaks are optional in xml; I just added them for human readability). The "root" is <xp>, I imagine so you could get more than 1 ProductQuote at a time.

<?xml version="1.0" encoding="utf-8"?>

<xp Request="2">

<ProductQuote>

<ProductID>0 130 303 209BOS</ProductID>

<CategoryID>G5000</CategoryID>

<ProductDesc>Auxiliary Fan</ProductDesc>

<AssemblyOrderByTime>2004/12/20+03:00:00+-0800</AssemblyOrderByTime>

<DispatchTime>2004/12/20+03:15:00+-0800</DispatchTime>

<QuantityAvail>1</QuantityAvail>

<QuantityReq>1</QuantityReq>

<Price>263.33</Price>

<ListPrice>451.00</ListPrice>

<CorePrice>0.00</CorePrice>

<Weight>5.20</Weight>

<Quality></Quality>

</ProductQuote>

</xp>

Link to comment
Share on other sites

That's what I don't know, how they expect you to "upload" requests. If they have an "upload an xml" feature, which allows you to upload an xml text file, that would be great. Of course, they would almost crazy to do so; because it is difficult to produce correct xml, and incorrect xml causes errors.

That's why they distribute the SDK I imagine. So what is the problem with using that? What do they say about the xml feature? What do they expect you to do with the result of that XML'er export; export right then, to their web site? If so, why bother showing it to you, what use is that? Could possible paste text "into" that page, then send it?

I don't really know what you mean by "get at the xml." I imagine you don't either. The problem is, once you have a correct xml file, what do you do with it? Since their SDK can export it (as a file?), what do they expect you to do with that file?

XML is not really a "copy/paste" kind of thing. I mean, you can't very well copy/paste multiple fields of database data into different fields of an HTML form on a web page either. It's not a normal "user interface" action.

I guess a further question is, what does this have to do with FileMaker? Did you want to create the requests in FileMaker, then export them as an xml text file in the above form?

This would be quite possible to do, but you'd have to use an xsl file to transform the xml (basically simplify the FileMaker format). Your FileMaker would have to be structured correctly to do this. You would need some help.

Link to comment
Share on other sites

Importing XML into FM is a two step process:

1) make an HTTP GET request so that the web service you are hitting knows what you want and produces an XML file with the data you requested. Their SDK will have the necessary info on how to make that request. If you look at the import script step and specify 'xml source', you'll see where to put that http get request.

2) the XML file the web service sends back needs to be transformed into the proper FM XML grammar, so you need an XSLT to transform what you get into the XML grammar FM understands. Once you have that XSLT you point to it in the import script step.

Link to comment
Share on other sites

Here's an example of what the xsl would look like. I'm using it to import the xml file; but, as Wim says, you'd probably want to get the xml directly from their web source.

Basically, the xsl is telling FileMaker what the structure of the fields should be; that's why all the field elements are within the metadata element. The "resultset" is the found set. A "row" is a record, a "column" is a field, and "data" is the data. And yes, it does look like goobledy-gook.

In the example file, I added a 2nd product to the xml. Because their <productquote> structure implies that you could handle multiple products at once. "xp" is the root.

(BTW, this works the same in 7. In fact I built it in 7, then used the xml to create the 5 file. Backwards conversion :-)

<?xml version="1.0" encoding="utf-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no" />

<xsl:template match="/*">

<FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">

<ERRORCODE>0</ERRORCODE>

<PRODUCT BUILD="" NAME="FileMaker Pro" VERSION="" />

<DATABASE DATEFORMAT="M/d/yyyy" LAYOUT="" NAME="" RECORDS="" TIMEFORMAT="h:mm:ss a" />

<METADATA>

<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="ProductID" TYPE="TEXT" />

<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="CategoryID" TYPE="TEXT" />

<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="ProductDesc" TYPE="TEXT" />

<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="AssemblyOrderByTime" TYPE="TEXT" />

<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="DispatchTime" TYPE="TEXT" />

<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="QuantityAvail" TYPE="NUMBER" />

<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="QuantityReq" TYPE="NUMBER" />

<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Price" TYPE="NUMBER" />

<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="ListPrice" TYPE="NUMBER" />

<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="CorePrice" TYPE="NUMBER" />

<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Weight" TYPE="NUMBER" />

<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Quality" TYPE="TEXT" />

</METADATA>

<RESULTSET FOUND="">

<xsl:for-each select="ProductQuote">

<ROW MODID="" RECORDID="">

<xsl:for-each select="./*">

<COL>

<DATA>

<xsl:value-of select="." />

</DATA>

</COL>

</xsl:for-each>

</ROW>

</xsl:for-each>

</RESULTSET>

</FMPXMLRESULT>

</xsl:template>

</xsl:stylesheet>

Prod_Quotes5.zip

Link to comment
Share on other sites

Fenton & Wim,

Fenton, Ya just blew my mind...

Guys, I have this program that I developed over the last 10+ years to run a automotive shop and have become agressive in marketing it as its starting to sell now that I have it in PC format too. I Also have AutoMaker up on Download com and Tucows. I love the power of FilemakerPro and the ability it has allowed. I desire to have it intergrated with parts supplies to better the program and open up new markets. I need some serious help here to understand if its possible with this incredible engine.

Here is a Link to what Im up aginst.

http://www.worldpac.com/wcap/

I would be glad to share in the proceeds if I can make it possible.

Link to comment
Share on other sites

It appears to me, from a cursory look, that the XML/XSL involved is not very complex. The tricky part is going to be connecting to their site and issuing commands. FileMaker can either export an xml text file; that's fairly simple. Or, using Server Advanced, you could can issue commands to get a particular xml stream. But that's not simple at all. A bit over my head.

Link to comment
Share on other sites

This topic is 7086 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.