通过perl脚本在Lotus Domino数据库中创建文档

I've seen blocks of code like this

use Win32::OLE; 
my $Notes = Win32::OLE->new('Notes.NotesSession') 
    or die "Cannot start Lotus Notes Session object.
"; 
my $database = $Notes->GetDatabase("",'mail\VIMM.nsf'); 

but my script is running on a virtual webfusion apache service so how do you establish a connection to database on my domino server, I have control of its acl and its a website so can pass in a username & password. The script & 'POST' data is sent by a third party gateway with results of the transaction (Success/ Fail + name value pairs etc) which I need to capture. I can't do it directly on the domino server because although Domino supports PERL scripts, they will only work if PERL is also installed on the server which isn't an option.

The underlying problem is that a url such as http://www.mysite.com/thankyou?orderno=123 won't work in a Lotus Domino website because the ? is a special character (eg ?openagent, ?opendatabase) to the Domino web engine. You also can't use http://www.mysite.com/(thankyou)?openagent?orderno=456 (I tried), in both cases all you get is 404 page not found error and a domino log error "don't understand the url". The question was originally asking for help with Perl to solve the problem but I couldn't Perl scripts to run on my webfusion community server but fortunately quickly had success with this simple php script:

<?php
    $params = "";
    $url = "http://www.mywebsite.co.uk/";
    $path = "wpx/website.nsf/httpagent?openagent";
      if($_GET) {
    $kv = array();
          foreach ($_GET as $key => $value) {
              $kv[] = "$key=$value";
          }
          $params = join("&", $kv);
}
print "<script>window.location.href=\"" . $url . $path . "&" . $params . "\"</script>";
?>

The script is placed on my webfusion server under a subdomain which effectively translates the url into a format that Domino can handle, the format ?openagent&orderno=456 is easily handled by either a java or Lotusscript agent, the parameter is extracted from the CGI Request_Content field.

The redirect means I don't for now need to manipulate data in the domino database directly, it also means that with the exception of the url translation script all the website code is in the domino database.

Lotus Domino is also a web application server so you can communicate with the server using HTTP (GET and POST) from your perl script on the Apache server.

This might require changes to the Domino application in question in order for it to serve the content you expect.

Also, you can provide a WebService on your Domino Server.

For OLE/COM to work, Perl and the script have to be located on a server where Notes and/or Domino are installed. Otherwise, the OLE/COM classes are not installed and not available.

As Per and Klaus mentioned, if you can't put Notes/Domino on the machine with Perl on it, you have to switch to some sort of webbased communication.

If you are not limited to COM/OLE, you could use the IBM Lotus Domino Data Service, which is new in Domino Designer 8.5.3 Upgrade Pack 1:

The IBM® Lotus® Domino® Data Service is a REST API that accesses databases on Domino servers. It is part of Domino Access Services.

The Domino Data Service receives requests and sends responses using HTTP and HTTPS protocols with body content in JSON format.

The Domino Data Service allows you to obtain information on databases, views, folders, and documents. You can update, add, and delete documents.