amberdextrous
MIS
Oh man, I really hope someone can help me.
I am an IS intern and I am very new to Visual Basic, very, VERY new. I guess you could say I'm self-teaching myself on the job, but I am taking a class next semester. Anyway, my company uses two FileMaker systems that integrate. When you click "Create ID" in the first app, it takes you to the second app, you fill out all the details there, hit "Assign ID", it saves the record and it then takes you back to the first app (where it populates that field with the ID you just created). So basically, the ID in the first app is like a foreign key, and to see all the details you have to go to the second app.
My company has contracted another company to develop a .NET solution to replace the first app. The only problem is that now, we'll need to integrate the .NET solution with the second app (which is FileMaker). My manager would like to develop a sort of "middle man" web service. When the user clicks the "Create ID" in the .NET app, the data will be sent to the web service as XML, the web service will parse the XML and translate it into FileMaker schema, and then send it on its way to the FileMaker app. The new FileMaker record will then be pre-populated with all the info that was sent from the .NET app. He said HTTP GET and POST will need to be utilized for this to work.
Now like I said, I'm new to all this and trying to learn it. I made a sample GET function just to practice with the concepts:
And it retrieved the HTML of Google's main page. But I am unsure as to how to POST a new record to the web-enabled FileMaker DB. Right now I'm using a test database. I know I must use a query string something like this:
But for now, just to take things one step at a time, I've been trying to pass a query string that will just search the records and return the XML for them. But I cannot even get that to work so I must be doing something wrong. This is the query I'm using:
When I type it directly into the browser it works, but I get a HTTP 500 error when I run the VB debugger. Here is the code I have for my sample function:
There IS a password on the test DB, but I always log into the DB first in FileMaker Pro in order to open the port and enable web sharing. Do I still need to provide a password in my code, and if so, how? Use the credentials property of HttpWebRequest? When I paste the query string directly into the browser, it asks me for the password the first time but not susbequent times. Also, I believe in production the FileMaker database will always be logged in on the server (this would be necessary for the web companion to work, right?)
I would be eternally grateful if someone could shed some light on what I'm trying to learn/do, that is, tell me why my Find function isn't working and how to post a new record using a query string in VB. If I know how to post a new record in this hard-coded query string fashion, I can figure out how to factor in the XML part to pass parameters to the query string...but as it stands right now I can't get anything else working until I get this working.
Thanks!
I am an IS intern and I am very new to Visual Basic, very, VERY new. I guess you could say I'm self-teaching myself on the job, but I am taking a class next semester. Anyway, my company uses two FileMaker systems that integrate. When you click "Create ID" in the first app, it takes you to the second app, you fill out all the details there, hit "Assign ID", it saves the record and it then takes you back to the first app (where it populates that field with the ID you just created). So basically, the ID in the first app is like a foreign key, and to see all the details you have to go to the second app.
My company has contracted another company to develop a .NET solution to replace the first app. The only problem is that now, we'll need to integrate the .NET solution with the second app (which is FileMaker). My manager would like to develop a sort of "middle man" web service. When the user clicks the "Create ID" in the .NET app, the data will be sent to the web service as XML, the web service will parse the XML and translate it into FileMaker schema, and then send it on its way to the FileMaker app. The new FileMaker record will then be pre-populated with all the info that was sent from the .NET app. He said HTTP GET and POST will need to be utilized for this to work.
Now like I said, I'm new to all this and trying to learn it. I made a sample GET function just to practice with the concepts:
Code:
<WebMethod()> _
Public Function GetWebPageHtml() As String
Dim url As String
Dim request As HttpWebRequest
Dim response As HttpWebResponse
Dim responseStream As StreamReader
Dim htmlAsString As String
url = "[URL unfurl="true"]http://www.google.com"[/URL]
' Establish the request
request = WebRequest.Create(url)
request.Method = "GET"
'Retrieve request info headers
response = request.GetResponse()
responseStream = New StreamReader(response.GetResponseStream())
htmlAsString = responseStream.ReadToEnd()
Return htmlAsString
response.Close()
responseStream.Close()
End Function
And it retrieved the HTML of Google's main page. But I am unsure as to how to POST a new record to the web-enabled FileMaker DB. Right now I'm using a test database. I know I must use a query string something like this:
Code:
[URL unfurl="true"]http://localhost:8888/FMPro?-db=TABLENAME.fp5&-lay=web&-format=-fmp_xml&field1=value1&field2=value2&-new[/URL]
But for now, just to take things one step at a time, I've been trying to pass a query string that will just search the records and return the XML for them. But I cannot even get that to work so I must be doing something wrong. This is the query I'm using:
Code:
[URL unfurl="true"]http://localhost:8888/FMPro?-db=TABLENAME.fp5&-format=-dso_xml&field3=value3&-find[/URL]
Code:
<WebMethod()> _
Public Function Find()
Dim request As HttpWebRequest
Dim response As HttpWebResponse
Dim path As String
Dim responseStream As StreamReader
Dim responseText As String
path = "[URL unfurl="true"]http://localhost:8888/FMPro?-db=TABLENAME.fp5&-format=-dso_xml&field3=value3&-find"[/URL]
request = WebRequest.Create(path)
request.Method = "GET"
response = request.GetResponse()
responseStream = New StreamReader(response.GetResponseStream())
responseText = responseStream.ReadToEnd()
Return responseText
End Function
There IS a password on the test DB, but I always log into the DB first in FileMaker Pro in order to open the port and enable web sharing. Do I still need to provide a password in my code, and if so, how? Use the credentials property of HttpWebRequest? When I paste the query string directly into the browser, it asks me for the password the first time but not susbequent times. Also, I believe in production the FileMaker database will always be logged in on the server (this would be necessary for the web companion to work, right?)
I would be eternally grateful if someone could shed some light on what I'm trying to learn/do, that is, tell me why my Find function isn't working and how to post a new record using a query string in VB. If I know how to post a new record in this hard-coded query string fashion, I can figure out how to factor in the XML part to pass parameters to the query string...but as it stands right now I can't get anything else working until I get this working.
Thanks!