Jump to content

xml over https via GET request


RussellB

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

Recommended Posts

Hi

Can anyone give me a clue here?

I have constructed a type of shopping cart solution using CWP (FM 7).

In talking with a payment gateway company, they can process the payment via a GET request and return xml (I'll need to use xslt to transform it into FMPXMLRESULT.

My problems...

1. FileMaker can't import xml from https data sources.

2. You can't trigger an xml import script from CWP.

Has anyone else tried this (successfully) or am I wasting my time?

Link to comment
Share on other sites

Don't think in scripts, you can do everything with XSLT custom web publishing.

You can use the XSLT document() function to retrieve the XML data from the remote web server and store it in a variable. According to the CWP Guide document() should work with https.

Then you can extract the needed values from the variable with XSLT.

With another document() function you can populate your database with the values with -edit or -new queries.

This can all be done in one XSLT stylesheet.

Martin

Link to comment
Share on other sites

Thanks Martin

I have to send the payment info via a GET url request. So I load the url string into a document function. Is that what you are saying?

Do I use "xsl:value-of select..." statements within the query string or do I have to create variables for all the customer details (so $customer-name, etc)?

Thanks for your help.

<xsl:variable name="payment" select="document('https://www.eway.......[the rest of the query string]')"/>

Link to comment
Share on other sites

I have to send the payment info via a GET url request. So I load the url string into a document function. Is that what you are saying?

Yes. Your code below is in the right direction.

Do I use "xsl:value-of select..." statements within the query string or do I have to create variables for all the customer details (so $customer-name, etc)?

No, you don't need the xsl:value-of select within document.

I assumed that you already know about the concat() function that can concat strings (see also these threads thread1, thread2)

For the strings you can either use a static string (string within ''), a variable ($customer-name), or an XPath that selects an element of your XML fmresultset node tree (e.g. the part that you would write within the select="" attribute of the <xsl:value-of select="..."> you would use normally.

<xsl:variable name="payment" select="document('https://www.eway.......[the rest of the query string]')"/>

For testing purposes only, you can print then the content of your variable payment to see the XML tree that your payment service had sent back:

<textarea cols="10" rows="80"><xsl:copy-of select="$payment"></textarea>

Then you can address the needed elements either with <xsl:value-of select="$payment/element1/element2/...." or store them in variables (my prefered way) and use the variables in another

<xsl:variable name="feedback_from_fmquery" select="

document(concat('http://localhost/fmi/xml/fmresultset?-db=yourdatabase&-lay=yourlayout&field1=',$variable1,'&-new'))"/> statement or similar (check the syntax if you need -edit in the CWP Guide).

Martin

Link to comment
Share on other sites

This topic is 6970 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.