INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

How to send xml file to a webpage

How to send xml file to a webpage

(OP)
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

RE: How to send xml file to a webpage

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.

RE: How to send xml file to a webpage

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

RE: How to send xml file to a webpage

(OP)
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

RE: How to send xml file to a webpage

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.

RE: How to send xml file to a webpage

Quote:

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

RE: How to send xml file to a webpage

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 --> VFP

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 = "http://www.example.com"

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 

RE: How to send xml file to a webpage

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.

RE: How to send xml file to a webpage

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.

RE: How to send xml file to a webpage

Quote:

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

RE: How to send xml file to a webpage

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



Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close