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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to send xml file to a webpage

Status
Not open for further replies.

capri1966

Programmer
May 13, 2010
57
ES
Hello, i've a xml file with electronic bill data and i would like to know if i can send this file to
a webpage. Thank so much
 
Don't put the cart before the horse. Find a site processing bills and offering a webservice, then find out how to use the webservice.
Today less webservices are XML centered, you mostly find REST webservices and the most supported form of input and output is JSON.

Most important is to find a site offering the service you have in mind, the REST follows.

Bye, Olaf.
 
Can you clarify:

Do you need to upload a file to a specific existing website - one that only supports submissions by XML?

Or are you in the process of creating the site yourself, and you want a way of uploading data to it?

Or do you simply want to display your invoice data (which happens to be in XML format) in a web browser?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
I want to send the xml file to website, the website it's a goverment site, and i want to validate and send the file from my VFP app
 
I never heard of such a type of service, where you send/upload a file.

If this actually is something you're supposed to do and not just something you want to do, they should have some instructions of what to do and use technically. Even if not, you can't just upload a file to some website, the website has to offer an upload or service end point. If that would be possible without such a server side point of interaction anyone could upload any file anywhere and thereby hack a site, display his content and do more harm.

Even this sending posts to tek-tips so everybody can read them has a concrete interface and only accepts technically valid posts and TGML, and for example will not execute javascript you write and post.

Bye, Olaf.
 
I never heard of such a type of service, where you send/upload a file.

I have.

One of my clients needs to routinely upload an XML file to a government regulator. We had no problem in creating the file within his VFP app. But to do the actual upload, we decided to do the job manually (which is what the regulator assumes all its users would do). I feel sure we could have done it programmatically (it is only HTML / Javascript after all), but took the view that it wasn't worth the effort.

Of course, that might not apply to you, Capri. In our case, we only needed to upload a single file, and only once per year. If you are dealing with higher volumes and/or frequency, then you might well take a different view.

(By the way, to see that you need to upload it to web page is a bit of red herring. The page is merely the interface that the recipient provides for interactive uploads. Focus instead on uploading to a server.)

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Can you indicate some URL that documents the service to which you want to send the data?

Posting an XML file to a web service is normally pretty straightforward.

Code:
LOCAL WS AS MSXML2.ServerXMLHTTP60

* the object to handle the communication to the server
m.WS = CREATEOBJECT("MSXML2.ServerXMLHTTP.6.0")

LOCAL URL AS String

* the location of the service that receives the data
m.URL = "[URL unfurl="true"]http://www.example.com"[/URL]

LOCAL XMLFilename AS String

* your XML data
m.XMLFilename = GETFILE("xml")

* post the file contents
m.WS.Open("Post", m.URL, .F.)
m.WS.Setrequestheader("Content-type", "text/xml")
m.WS.Send(FILETOSTR(m.XMLFilename))

* get the http status code
? m.WS.Status, m.WS.Statustext
 
There's a slight technical difference of posting file content or uploading a file. The gist still is, this has to have a server side receiving end point.

Uploading files in the sense of a http file upload needs a html form with a file type form element and (obviously) a form action accepting the upload. FTP upload needs a FTP login, anonymous and public FTP would never be sound for a government solution. But also this needs a ftp server address.

You got to have some kind of pointers and instructions, Capri.

Even a mail has an address you have to know, there is nothing that works without an address and in case of uploading a file, just knowing the main server domain is never sufficient. In regard of mail you might guess there is something like info@domain.com, but even that is not guaranteed. You have to know a destination address.

Bye, Olaf.
 
If it is a government website, then the agency has a programming specification document that will instruct you. Just ask for it. Some agencies have very complex webservices and sandboxes which programmers can use for testing.
 
If it is a government website, then the agency has a programming specification document that will instruct you.

That probably true. But the chances are that the document will only tell you how to create the file, not how to programmatically upload it, and almost certainly not how to do so from a VFP application.

Olaf's mention of FTP reminds me that the regulatory agency that I mentioned in my previou post also accepts submissions via FTP. They give you a login and a password, and you can then use any FTP client to send the file. Doing that from VFP is relatively easy. I would use the Internet Transfer Control, which is one of the ActiveX controls that come with VFP. But there are other methods as well.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
One of my clients regularly sends/receives XML files to/from a government regulatory agency.

However in order to do that the government regulatory agency FIRST has to have set up a webservice (it has its own URL).
That webservice will generally 'talk' to the outside world via HTTP GET's and POST's.
NOTE - some webservices use alternative internet communication formats.

You first need to contact the government service and get their specifications for sending/receiving XML files.
It should include the required/allowed XML tags, file naming conventions, and communication format. And they should give you any access credentials (username/password) necessary.
Once you have that specific information, you can then begin to build your VFP interface.
And once you have that specific information you can come back with specific questions on how to approach the project.

Good Luck,
JRB-Bldr



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top