• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 11289
  • Last Modified:

Retrieve data from Filemaker using asp.net

Hi,

I am trying to retrieve data from Filemaker 6 pro for use within a asp.net page written in vb.net. I can access the Filemaker 6 pro database via odbc using a program called ODBC VIEW from SLIK software, But i cannot access the data from within my asp.net page.

Can anyone help with providing an asp.net page which retrieves data from a filemaker 6 pro database.

I dont mind using any third party software which helps in connecting an asp.net page to a filemaker 6 pro database.

Many Thanks

James
0
jimmy_needs_beer
Asked:
jimmy_needs_beer
  • 7
  • 7
1 Solution
 
Mariano_PetersonCommented:
Datavations has built a .Net object for interacting with FileMaker.  This is the easiest and simplest solution:
http://www.datavations.com/dvpages/products/fmconnector_net.cfm

Alternatively, you could write your own tool for communicating with FileMaker.  The best way to connect to FileMaker from ASP is not through ODBC.  FileMaker's implementation of ODBC is so unbelievably slow that even if you patiently wait minutes for it to respond its just too slow for web purposes (and most others, for that matter).  You'll need to communicate wtih FileMaker via HTTP and XML.

Enable the Web Companion plug-in on the FileMaker client, making the FileMaker client an HTTP responder.  Web Companion accepts HTTP requests using FileMaker's cgi specs.  A standard request might be:

   http://server.com/FMPro?-db=mydb.fp5&-lay=my_web&-format=&-fmp_xml&my_field=my_value&-find

This tells the Web Companion to perform a find in mydb.fp5 for records where my_field = my_value.  It also tells FileMaker to respond with the fields that are on the "my_web" layout, and to format the results using the "fmp_xml" xml grammar.  (Alternatively you could specify a CDML page to format the output, or you could specify the dso_xml grammar, or you could use either grammer and apply an xsl stylesheet).  

In the example above I told FileMaker to "find" - but there are other commands you can use such as "new", "delete", "findall", etc.  Check out the "FileMaker Professional Training Book and CD" at the FileMaker.com web store for full listing and description (and set of examples) on these cgi commands.

To send HTTP requests and obtain the XML result in ASP (JScript or VBScript or whatever you're using) you'll need to use the MSXML object provided by MDAC (microsoft data access components).  However you probably should check and see if the .Net FCL (framework class library) contains a new and imprpoved class for working with XML over HTTP.  

Here's an example (in JScript) of how to send the http and create an XML DOM object from the result:
(I think if you're using IIS 6 you may have to turn on IIS 5 emulation for the XML to pass through successfully)

// create and send xml http request to Filemaker
//
var my_http_request = new ActiveXObject("Msxml2.XMLHTTP");
my_http_request.open("GET", url, false);
my_http_request.send();

// create an xmlDOM object to store return data
//
var my_xml_dom = Server.CreateObject("MSXML2.DOMDocument");
my_xml_dom.loadXML(my_http_request.responseText);


// walk the DOM
//
var root = my_xml_dom.documentElement;
var nodeList = root.childNodes;

// loop through the nodes in the DOM
//
for (var i = 0; i < nodeList.length; i++) {

     // get the name of the current node
     //
     var nodeName = nodeList.item(i).nodeName;

     // loop through this node's child nodes
     //
     var childNodes = nodeList.item(i).childNodes;
     for (var j = 0; j < childNodes.length; j++) {
         
          // loop through the child node's attributes
          //
          var attributeList = childNodes.item(j).attributes;
          for (var k = 0; k < attributeList.length; k++) {
               // get the current attribute name
               var attribute = attributeList.item(k).nodeName;
          }
     }          
}
0
 
jimmy_needs_beerAuthor Commented:
I recently discovered the file maker connector for .net but trying to download it i relised that it was not available to download and the website states it should be ready. Spoke to their technical support and they stated it will not be released as its too slow due to the microsoft.net framework.

I am going to give the web companion a go tomorrow, thanks for your advice.

I will close the question after I have tried the web companion incase any one can post a method of using odbc as all my attempts have failed using odbc in asp.net.

James
0
 
Mariano_PetersonCommented:
You can use ODBC - the problem is that it really is *extremely* slow.  I don't mean sort of slow, I mean you'd rather poke pencils in your eyes than wait that long.  ;-)

If you want to go ahead and try ODBC, you just have to establish FileMaker as a DSN and then connect to it the same way you'd connect to any other DSN.  In order to configure FMP as a DSN, you must set aside one FileMaker Pro client as the ODBC client.  Then on that client computer enable the local data access companion.  (If you're connecting from another computer, then enable the remote data access companion).  Once you've enabled FileMaker's data access companion, you can configure the DSN (Start > Settings > Control Panel > Administrative Tools > Data Sources > System DSN > Add... > Select "FileMaker Pro")
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
jimmy_needs_beerAuthor Commented:
I would like to use odbc, I have created a asp.net page using an odbc driver and a odbc dsn to a sql server database. everything works ok until with this method. Then i created a second dsn which was odbc for filemaker pro and change the dsn in the code and I get an error message. I know the dsn works as I can view the database using an odbc data viewer. I know the code works to so it looks like that you cant use asp.net with filemaker.

If you have managed to get asp.net working with filemaker then let me know.

James

0
 
jimmy_needs_beerAuthor Commented:
Hi,

I have managed to get the web companion working well at the moment apart from I cant access a password protected filemaker file. i have added the parameter -password=xxx but it still prompts me to enter a password

is there something im missing or need to configure in filemaker?

thanks james
0
 
Mariano_PetersonCommented:
Try embedding the password in the URL, like:

http://user:password@www.server.com/FMPro?-db=....
0
 
Mariano_PetersonCommented:
BTW, if the web companion or FileMaker have crashed, then FileMaker will not respond and your page will run until it times out.  Also, if the FileMaker Server is backing up, then FileMaker will not respond until the backup is complete.  Again, your page will continue to load until either FileMaker responds, or until your request times out.

I have not figured out how to programmatically set the timeout for the MSXML HTTP call yet.  The ideal solution would be to programmatically set the timeout for the HTTP call to, say, 5 seconds, and if it hasn't received a response yet then gracefully abort the request and continue with the rest of the ASP script (instead of letting the whole thing time out).

If you figure out how to do this, please let me know.  Thanks.
0
 
jimmy_needs_beerAuthor Commented:
I have tried embedding the password and user in the url using both methods but it still prompts me with a username and password, i was not sure if you have to create a specific user or grant specific rights to the user.

regarding how to set the timeout using msxml it is possible to do so using the web request class in asp.net and i have found the following article which suggests you can using msxml:

http://www.perfectxml.com/msxmlAnswers.asp?Row_ID=41

many thanks

james

0
 
Mariano_PetersonCommented:
Thanks a million for the link... it turned out to be extremely useful.

When you are prompted for the name and password, are you able to manually input the name and password and authenticate that way?  My question is really more along the lines of, are you sure the name and password are correct?

Also, when you provide the name and password programatically (and not embedded in the URL), you often have to provide a domain.  Is your domain set properly?  What port have you configured FileMaker web companion to listen on?  (open filemaker, go to Edit > Preferences > Application > Plug-Ins > Port: ...)  Is is 80, or 591?  You may have to include the port in the domain name to authenticate successfully.

What happens if you enter the URL in a browser window?

Oh, also -- the username won't matter, just the password, since FileMaker security doesn't stores users, just passwords..

Let me know if that works.  If it doesn't , I'll see what else I can come up with.  Are you using MSXML, or one of the built-in WebRequest, HTTP or XML classes in .NET?
0
 
jimmy_needs_beerAuthor Commented:
Hi,

I have increased the points as you have spent some time in this thread.

Below is the url i have been trying directly into IE (get it working in ie then use the web request in asp.net, if no passwords are configured it works fine

http://127.0.0.1:591/fmpro?-db=clients.fp5&-recid=43064&Name=james+lewis91&DOB=16%2f03%2f19819&-format=-fmp_xml&-edit

But with the password configured i have tried both below approaches:

http://admin:admin@127.0.0.1:591/fmpro?-db=clients.fp5&-recid=43064&Name=james+lewis91&DOB=16%2f03%2f19819&-format=-fmp_xml&-edit

http://@127.0.0.1:591/fmpro?-db=clients.fp5&-password=admin&-recid=43064&Name=james+lewis91&DOB=16%2f03%2f19819&-format=-fmp_xml&-edit

And none of these work it displays a username and password box, as soon as i supply the same password it works.

Any ideas, Im sort of new to FM so if u have any advice on how to create a password which will work or any ideas wat i might be doing wrong then please let me know.

james

0
 
jimmy_needs_beerAuthor Commented:
hi,

I have just checked the problem i am having and i can do the query from ie using the above urls correctly but when using asp.net web request class it returns a 404 error.

Any  Ideas, im going to give msdn a search

james
0
 
Mariano_PetersonCommented:
I think you need to configure the credentials in the ASP.NET code before sending the request.  Which language are you using?  This is just psuedo code (in C#) but maybe something like:

// Create web request
WebRequest myRequest = new WebRequest( );
myRequest.Create("http://127.0.0.1:591/fmpro?-db=clients.fp5...");

// Create credentials object and link it to the web request
NetworkCredential myCredentials = new NetworkCredential("web user", password);
myRequest.Credentials = myCredentials;

// Send request and store response
WebResponse myResponse = myRequest.GetResponse( );
0
 
jimmy_needs_beerAuthor Commented:
Hi,

Thanks for the info, that solved the problem.

Thank you for all your input into this thread

James
0
 
Mariano_PetersonCommented:
Hey no problem... just happy to help.  If its not too much trouble, could you post an example of the code you're using to access FileMaker from .NET?  I'm going to be doing the same thing very shortly here, and would love to see an example of how someone has gone about doing it.

If you prefer, you can email me at:
mariano [at] petersonpages [dot] com
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 7
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now