I need to send (from Notes Client) & receive xml files (on Domino Server) via http, but how?

I am developing a Notes/Domino application that will receive XML files containing such things as purchase orders, & send XML files containing such things as delivery notifications back to the sender's web server.

So there are two things to be done:

The Domino server needs to be able to receive these files via http - I think I've got an idea how I need to do this: the database needs an agent that can receive the file which can then be accessed via the DocumentContext property - is that correct?

The Notes client needs to be able to send similar files back to the sender's web server via http - how would I go about doing this? Once this part is sorted out, I can use it to send things to my own server, but I can't develop the server end until I can send files to it.

So please can you suggest how I go about sending the files, along with any pointers on how to receive them on the server?

Any thoughts & suggestions welcomed.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sjef BosmanGroupware ConsultantCommented:
Just some thoughts...

Send file to Domino:
1) an agent indeed, not easy, because you have to put everything in the URL
2) in a form, in a textfield
3) in a form, with some upload-controle
4) with an agent, you send an URL of an XML-page to the Domino-server, the Domino-server retrieves that XML-page (using NWEB.EXE)
5) mail

Send file by Domino/Notes:
1) in a form, in a textfield
2) mail
3) as a form (you can develop XML-forms and XML-views in Notes)
Hi PaulCutcliffe,
web is not my "strong side", but I know this cuz I needed it a while ago:

to get any file, whose URL you have, use this:

    Sub Click(Source As Button)
        Dim s As New NotesSession
        Dim db As NotesDatabase
        Dim note As NotesDocument
        Dim n As NotesEmbeddedObject
        Dim fileNames
        Set db = s.CurrentDatabase
        Set note = db.GetDocumentByURL( "http://www.alanlepofsky.com/alepofsky/alanblog.nsf/blog.rss")
        fileNames = Evaluate( "@AttachmentNames", note )
        Forall fileName In fileNames
            Set n = note.GetAttachment( fileName )
            n.ExtractFile ( "D:\Downloads\" & fileName )
        End Forall
    End Sub

Hope this helps,
Sjef BosmanGroupware ConsultantCommented:
That's where you need NWEB.EXE...
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

PaulCutcliffeAuthor Commented:
Sorry, I'll come back to this Monday.
Sjef BosmanGroupware ConsultantCommented:
What's wrong with the weekend??
PaulCutcliffeAuthor Commented:
Nothing's wrong with the weekend, & yes, I am having to work today, but not in this issue! :-)
Sjef BosmanGroupware ConsultantCommented:
PaulCutcliffeAuthor Commented:
Right, back now!

So, does anyone know how XML is normally sent/received via HTTP? Is it sent as part of the HTTP Header? I need to be able to send the file exactly like other systems do. What is the standard way to do this?
Sjef BosmanGroupware ConsultantCommented:
Make an XML form... Open the Designer Help db, Index, type XML and Bob's your uncle. The first document you will see is called "Putting XML in a form or page". I could copy/paste it here, for more points...?
Sjef BosmanGroupware ConsultantCommented:
But you need it as a file? Why is that? What's the difference between a file and a page on the web, to the other side? If necessary, you could use document names like "file123.xml".
PaulCutcliffeAuthor Commented:
I don't need it as a file, sorry that was misleading terminology. My system will provide the XML dynamically on request, by using the methods you suggest (pages, embedded views & documents etc). However, this resulting (I won't call it a file this time!) chunk of XML needs to be 'posted' to another party's web server using the HTTP protocol.

So having got myself some XML, how can I post it to another party's web server from the Notes client?

The other half of my question is, how can I receive similarly posted XML from the other party? This is where I think I need an Agent, accessible via the web (http://server.domain.com/database.nsf/AgentName?OpenAgent), that accesses the posted data via the DocumentContext property - does this sound feasible, or am I speaking rubbish?

Paul Cutcliffe
Sjef BosmanGroupware ConsultantCommented:
Post XML? I don't know if that's possible, in my view it's always the other party that GETs the XML. What you can do is use a special URL to the other party. The URL can contain the URL to your XML-page, in a coded form, e.g.
    http: //www.otherparty.com/thingum.asp?fetch&url=www.overhere.com~pages~thispage.xml

The same would work from the other side. This is how I would do it, but that doesn't say that it's the best method. :-|
I didn't read the other posts but to answer your question, any web application can post to an agent in lotus notes, Our agent can pick up the XML, parse it and do all the information you want. When you post it to an agent using the action parameter in the form tag, you can access all the information that is posted using a field by name request_content.

<form action ='http://yournotesserver/databasename/agentname?openagent" method=post>
your html fields

all you need to do in ur agent is to get the value of doc.request_content(0), where doc is pointing to documentcontext

So your agent is going to be :

dim session as new notessession
dim doc as notesdocument
set doc = session.documentcontext
print doc.request_content(0)

Now to return back the XML you have lot of ways,

1. agent output, with the content-type changed to text/xml
2. Using readviewentries

Feel free  to ask me more questions...


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Sjef BosmanGroupware ConsultantCommented:
Interesting, that with request_content...
PaulCutcliffeAuthor Commented:
p_partha, you've saved the day!

This is what I thought you could do, I just wasn't sure how. I was so sure you could do it, I had committed to developing something using Domino. So when I started to draw blanks with this question, I started to worry somewhat.

So thanks for the tip - I will try to set it up my end & come back to you. Trouble is, until I solve the other end of the same issue, i.e. how I can send some XML to a web server, I can't actually test my server-end solution.

So, does anyone know how I can send XML to a web server so that the web server can retrieve it using the NotesAgent.DocumentContext.request_content(0) field?

Thanks again.
hey just create a simple html file anywhere ( even in your desktop )which will have the xml inside a field and post it to a agent

soemthing like this:

<form action = "youragentname?openagent" method = 'post'>
<input type='field' value = 'your xml stuff'>

PaulCutcliffeAuthor Commented:
So is this something I could recreate within Notes on the fly? A page, perhaps, with the HTML in, just like when we use pages as XML files? Or perhaps a document, rather than a page, so I could have fields containing the actual data?

I'm going to need the Notes/Domino application to be able to post updates to the other party when something in the workflow dictates. For example, when something is complete, a status notification needs to be sent. It can be on the client rather than the server, but I need Notes to do this behind the scenes when, for example, the user presses a button (or more likely when a document is saved with a particular status, or some other arbitrary event).

So if I had a document that contained an HTML form with the post action set as you suggest, could I 'drive' the posting of this form using code, say LotusScript? Perhaps using NWeb, could I open the web page (in code), and could post the information from LotusScript?

Sjef BosmanGroupware ConsultantCommented:
As I said earlier, you can create XML-forms. But that's still not a POST. What's running on the destination server??
PaulCutcliffeAuthor Commented:
I don't know what exactly, other than that it's a web server. I'll be finding out more about their end in the next day or two.
Sjef bro,
I still don't understand what does this mean :  "But that's still not a POST", i can create a page or form and paste the entire html like this and do a post:
<form action = "http://www.google.com" method = 'post'>
<input type='field' value = 'your xml stuff'>
<input type='submit' >

SO it does a post to google.com, so in your case you will post it to a agent as mentioned earlier, The form starts with a </form> tag , so as to close the form tag created by domino. Hope i am clear here


Sjef BosmanGroupware ConsultantCommented:
Sorry Bro, I may have misunderstood :$

What I meant to say is that you can force something up a Domino server using the agent and the request_content field, but if you want to force something down some other server's throat, you'd have to know a similar construction. Or do you suggest that you open the webpage you gave yourself, on your own server (using GetDocumentByURL or so)? But how to trigger the POST then? If I'm not mistaken, Paul intends to force-feed XML to the other server.
PaulCutcliffeAuthor Commented:
Surely, whilst the NotesAgent.DocumentContext.request_content(0) is indeed a Domino-specific way to get hold of the information posted by the client, but all web servers must have an equivalent method? And I don't need to know what that is or how it works, as long as the person who wrote the system running on it did!

What I mean is, as long as I can post the information to a web server using the 'standard method' (posting to a form), then the receiving web server will know what to do with it (assuming I am right about how they receive it - I will be able to confirm this soon).

And as long as I know how to get the information posted by them to my web server, then I'll know what to do with it too.
Why should you bother about how the webserver in the other end going to handle the request, All you tell them is that you are going to throw a XML as a post operation. It's "THE" method of sending data across web applications as far as i know. ALL you need to tell them is i can post a XML to your server, and it's upto to their server to handle the request posted, we need not contemplate whether it's going ot be request_content(0) or some other thing, it's their headache..

Hope i am clear

Sjef BosmanGroupware ConsultantCommented:
Apparently there's something to learn for me here, which is great! Still wondering though how the POST should be activated from your server...
PaulCutcliffeAuthor Commented:
Perfectly, partha. I'm glad you confirmed my thoughts on it.

But we haven't quite solved how to do this on the Notes client exactly. Presumably, I can program the Notes client to open a web page that can be my page/document containing my XML - does this have to happen on screen, or can it be done invisibly? Having done this, can I program the client to Post the form? How can I do that?


(I've increased the points a bit!)
Hi Paul
It can be done invisibly also: take a look at this example:

Sjef BosmanGroupware ConsultantCommented:
And on Linux...?
PaulCutcliffeAuthor Commented:
Brilliant! I didn't know you could use the MS XML Parser to create HTTP requests, I thought it just parsed XML (don't know where I got that idea from, after all, it is called an XML Parser!)

Anyway, that does look really useful, so thanks for that.

I guess it's time to dish the points - congratulations p_partha - they're all yours. :-)

Thanks to p_partha & everyone else for their contributions. I'll be coming back to this in a day or two & trying to implement this, so watch this space for further questions!

Paul Cutcliffe
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.