Solved

Why does agent work fine when called from webquerysave but not from a url link or html

Posted on 2007-08-09
22
806 Views
Last Modified: 2013-12-18
I have a web form that the user attaches a spreadsheet to be processed.  When they hit submit the server picks up the file from the document.context and steps through the worksheets and cells finding the data needed, and creating a Notes Web Form that is then presented back to the user to verify.  This code works perfectly in our test environment..the problem comes in that I have to point the agent to a specific server because it is the only server that has Excel loaded on it.  When I changed my call from a webquerysave, that calls the agent to an html link that launches the agent, it no longer works.  It appears that it can no longer access the information via document.context.  At my wits end..pls. help
0
Comment
Question by:Susan_Murray
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
  • 4
  • +3
22 Comments
 
LVL 14

Accepted Solution

by:
cezarF earned 168 total points
ID: 19667220
For an agent triggered using OpenAgent URL command,  the in-memory document is a NEW document.  You might need to copy your app to the server loaded with excel to solve the problem.

This is from domino designer help.

For an agent activated in a view through the Notes client UI, the in-memory document is the document highlighted in the view.
For an agent run from a browser with the OpenAgent URL command, the in-memory document is a new document containing an item for each CGI (Common Gateway Interface) variable supported by Domino. Each item has the name and current value of a supported CGI variable. (No design work on your part is needed; the CGI variables are available automatically.)
For an agent run from a browser with @Command[ToolsRunMacro], the in-memory document is the current document. In the case of WebQueryOpen, this is the document before Domino converts it to HTML and sends it to the browser; in the case of WebQuerySave, this is the document before Domino saves it. If the form on which the document is based contains a field named the same as a Domino-supported CGI variable, the in-memory document also contains the value of that variable. (You must explicitly design the CGI variables into the form, for example, as hidden fields.)
See "Table of CGI Variables" in Application Development with Domino Designer for a list of the Domino-supported CGI variables.
Through the C or C++ API, an external program can create an in-memory document, then run an agent. The agent can use this property to access the in-memory document.
You cannot use the encrypt and remove methods on the Document object returned by DocumentContext, nor use the compact method on the Database object that contains the Document object returned by DocumentContext.
0
 

Author Comment

by:Susan_Murray
ID: 19667734
Can I point the webquerysave at the server I want?  If, I save the document and try to retreive it from the backend, there is no telling which server I was on when creating from the web..so it will take at least 20 min to replicate...which is far from the immediate response that I need.  I have never used a cgi variable before...can you help explain it a bit and give me what the code might look like... thanks so much with this...
0
 
LVL 14

Expert Comment

by:cezarF
ID: 19667951
>Can I point the webquerysave at the server I want?
I'm afraid you cannot.

>I have never used a cgi variable before...can you help explain it a bit and give me what the code might look like.
CGI vars might not help as you are more concern about the attached excel file in the form you are trying to submit.

You might want consider the following alternatives:
1. Install MS Excel in the server where your app is running.
2. If you have issues with MS Excel license, install Open Office and use the Calc (counterpart of MS Excel) OLE to read the attached file.  
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!

 
LVL 14

Expert Comment

by:cezarF
ID: 19668025
if you are keen to explore open office APIs download the SDK from : http://www.openoffice.org/dev_docs/source/sdk/
0
 
LVL 22

Expert Comment

by:Bill-Hanson
ID: 19669005
I mignt have a work around, but I have not tested it and it will take a bit of coding to implement.

(1) Write a web service (or agent) on the server that has Excel installed that takes the UNID of a document in your upload application and performs the necessary work.
(2) Re-wrirte your WebQuerySave agent to call the service (or agent) on the Excel server, passing the UNID of the document that was just saved.

Just an idea.
0
 

Author Comment

by:Susan_Murray
ID: 19671101
I cant install excel on all the servers..security dept would never approve of that..had all i could do to have them sign off on one server.
If I save the document and try to load from the unid, the document with the attachment could have been created on any server in the network, and not replicated yet to the server with excel loaded on it.

I will look into the api from sdk...any sample code for this...?
0
 
LVL 22

Expert Comment

by:Bill-Hanson
ID: 19671206
I wrote a random access CSV parser in LotusScript and make my users save their Excel files as CSV.  That way, I don't need to have Excel installed on my servers.
0
 
LVL 22

Expert Comment

by:Bill-Hanson
ID: 19671224
Regarding my first post:  I didn't think it would work.  I've used similar workarounds for web-only apps, but it is still just a work around.  I should have mentioned the CSV parser earlier.
0
 

Author Comment

by:Susan_Murray
ID: 19671656
These excel spreadsheets have multiple pages that I have to access, can that be saved as a csv. and if so I can I easily convert an .xls to .csv without the user?
0
 
LVL 22

Expert Comment

by:Bill-Hanson
ID: 19671949
No, that's the main limitation of CSV.  I think you will need to move your app to the server that has Excel installed to get this to work.
0
 
LVL 31

Assisted Solution

by:qwaletee
qwaletee earned 166 total points
ID: 19672934
The answer is...

ONLY ALLOW THE APPLICATION TI RUN ON A SERVER THAT HOSTS THE TECHNOLOGY TO SUPPORT IT

If the app only runs on the one server, youhave no issues.

Security department? Feh.  It is all about risk and return.  If the business requires a certain application confirguration, and can justify the need, and can pay the cash to set it up, it is rare that you can find an IT wonk who can prevent it.  "We dont support .net.  Sorry." "Well, we've just spent $4 million buying the only app on the market that supports this particualr line of business, and the app runs on .Net"  Who do you think wins?

OK, maybe in your case, the business is not interested enough in this app to make an issue of it.  But what's stopping you from running on the one server?  Security compromised to give this one to you, the business should compromise and allow it to run on the one server.  They don't like that? Then let them make an issue of it with Security.
0
 

Author Comment

by:Susan_Murray
ID: 19684416
Ok. If I have the user link to the ip address and run the agent from there..when excel is done running can I then push the document back to appear under the proper url rather than the ip?
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 19687650
1) Should not need to use IP, each server has a unique host name, even if you also use a round-robin DNS resolution of the "official" host.  Using IP, you will almost certainly run into credentials issues.  Using host anmes, if you play it carefully, you can have the authentication work across multiples

2) If you are asking if you can re-driect the user after the agent click, then yes you can, in one of several ways:
a) have the agent grab the HTTP Referer value to figure out what the previous host name was
b) have the link open in a separate window, or better yet, a hidden frame or layer, so there is never a separate host/IP visible to the user

3) Don't forget, after you redirect, you may not be on the same server anymore, which means the possibility of an out of date copy of the database.
0
 

Author Comment

by:Susan_Murray
ID: 19688969
I went to the server document and got the official host name of the server, but when I plug that into the url, I get 404 error..  The only two ways that I have successfully gotten to the application is through the ip (which will cause the authenication issues) and the "official url" .  what am i missing...?
0
 
LVL 46

Assisted Solution

by:Sjef Bosman
Sjef Bosman earned 166 total points
ID: 19695859
Apparently, the DNS isn't informed of the server's FQHN. Get it fixed. Just try to ping your server and you'll get the name it's known by.
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 19714165
Your DNS definitely needs to have that host name. Notes wants it to. Either that, or the server doc needs to be reconfigured with the correct host name.

There is definitely a DNS entry that resolves specifically to this server, otherwise you woudl probably have trouble accesisng it through your Notes client, unless you use connection documents on your client or a HOSTS file entry.
0
 
LVL 14

Expert Comment

by:cezarF
ID: 19714413
you might want to try this.

1. in your QuerySave agent, extract the attached file to a file server wherein both your servers can access
2. trigger an agent (using ?OpenAgent) in the server that has MS Excel to read the excel file extracted in step 1 and create a text file  in the file server containing the data to be confirmed by the web user.
3. your QuerySave agent should wait until the text file is created in the file server, read it and display the data to the web user.

step 3 may result into an infinite loop if the agent in the server with MS Excel failed to create the text file. you might want to explore returning string buffer or xml to the calling agent instead of a text file.

 

 
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 19735064
cezarF,

All that is unnecessary if the post goes straight to that server anyway.  A real simple trick for this is to set the BASE HREF to what the URL would be if it had been loaded from that server as well.  BASE HREF affects all relative URLs on the page, including the URL of teh form action.

So, if the ucrrnet URL is http://server-1/db.nsf/formname?OpenForm and the action is /db.nsf/formname?SaveDocument which resolves to http://server-1/db.nsf/formname?CreateDocument 

But, if you add a BASE HREF of http://server-2/db.nsf/formname
Then the post will magically change to http://server-2/db.nsf/formname?SaveDocument 

Which is perfect.
0
 

Author Comment

by:Susan_Murray
ID: 19753731
Let me start with I have no control over the DNS or changing it.  I am consulting for a company and the Admin is already not happy with me poking around in his environment.  
The environment is set up using (if these are wrong terms...sorry)  hub and spoke.  So there are 3 servers that serve the web pages and the hub that they all replicate with.  Excel is installed on the hub.  I have tried to ping the server but after trying all the responses I still cant access the hub, unless I go directly to the ip address.
I am now working on something that is very close to what cez is recommending.  I have FTPd the file to the server, and can see it in the backend.  I then call the agent and point the document to be pulled from the server hard drive...but right now it is not opening the file...so not sure what is going on yet with that...if it really hasn;t gotten the file or if it cant load excel.
I like what qwalatee suggests but without a url that resolves to that server(hub) I am not sure if that will work for me..unless I use the ip address....  life shouldn't be this hard.
0
 
LVL 14

Expert Comment

by:cezarF
ID: 19753799
>>but right now it is not opening the file...so not sure what is going on yet with that

any error message? the agent signer might not have "unrestricted access" to read the file.
0
 
LVL 1

Expert Comment

by:Computer101
ID: 20295642
Forced accept.

Computer101
EE Admin
0

Featured Post

Get HTML5 Certified

Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question