Sometimes for automation tasks developers need to perform design signing with server ID.
Lotus design updates consists of design refresh and aftersigning. Refresh could be automated by using Lotus C API (write request if you need info) and no Server signing functionality.
We have only some methods to do signing:
1. NotesDatabase.sign(), which works with only user ID and on UI
2. NotesDocument.sign() if we are getting design element by noteID or through NotesNoteCollection. It could be signed, but lastmodifed username will remain the same, so you will need to call signing agent twice 1. sign signing agent, 2. sign other database
3. Using admin requests database. This method is better if admin has normal access rights to perform such operations. You'll simply need to create admin request document for each database to be signed, then wait till things is done.
4. Sign using NotesAdministrationProcess class.
Here is sample code for request document. Check "admin4.nsf" on server, where to create request:
Dim sName As Variant
Dim uname As string
sName=Evaluate("@servername",reqDoc) 'db.server does not returns full server name
uname=s.Effectiveusername
With reqDoc
.Form="AdminRequest"
.FullName=uname
.ProxyAction="101" '// action for request - type of request. see admin4.nsf for more info in ProxyAction shared field
.ProxyAuthor=uname
.ProxyDatabasePath=signDB.FilePath
.ProxyNameList=signDB.Title
.ProxyOriginatingAuthor=s.effectiveusername
.ProxyOriginatingOrganization=nname.Organization
.ProxyOriginatingRequestUNID=reqDoc.universalid
.ProxyOriginatingTimeDate=Now
.ProxyProcess="Adminp"
.ProxyServer=sName(0)
.ProxyTextItem1="0"
.Type="AdminRequest"
Call .Replaceitemvalue("$OnBehalfOf", uname)
ForAll cItem In reqDoc.items
cItem.isSigned=True
End ForAll
Call .Sign()
Call .Save(True,True)
End With
Wednesday, 10 February 2010
Thursday, 3 December 2009
XPAGES and Domino Web Services
Primary question how to call domino web services from XPAGES with authorization. There is method to do it:
1. Use Apache AXIS API to access and work with web services (API ref: http://ws.apache.org/axis/java/apiDocs/index.html).
2. Create service using
var service:org.apache.axis.client.Service = new org.apache.axis.client.Service();
3. Create call
var call:org.apache.axis.client.Call = service.createCall();
4. For authorization purposes if domino user is logged in:
call.setMaintainSession(true); - !Important
call.setProperty("Cookie","SessionID="+cookie.get("SessionID").getValue()+",DomAuthSessId="+cookie.get("DomAuthSessId").getValue())
5. Then simply call then web service and get your result:
var xmlType = new javax.xml.rpc.encoding.XMLType();
call.setTargetEndpointAddress({webServiceAddress});
call.setOperationName( {operationName} );
call.addParameter("INPUT1", xmlType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
call.addParameter("INPUT2", xmlType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
call.setReturnType(xmlType.XSD_STRING);
var a = new java.lang.Object[2];
a[0] = "param1";
a[1] = "param2";
var rating = call.invoke(a);
Authorization for SSO based login:
If your server is using basic http authorization, then previous demonstrated code should be modified to support basic http authorization. So we need to copy information from http header and pass it in web service request.
1. use headerValues global variable
2. check if headerValues.AUTHORIZATION or headerValues.containsKey("AUTHORIZATION")
3. set it in call property like call.setProperty("AUTHORIZATION",headerValues.AUTHORIZATION.nextElement()) or call.setProperty("AUTHORIZATION",headerValues.get("AUTHORIZATION").nextElement()).
Why is to use nextElement()? headerValues.get("AUTHORIZATION") returns single value enumeration, so to get string value we need to get element from list.
Problem detected when using apache axis in xpages internal requests (made using ssj - Server Side Javascript) is that sometimes domino server java class loader stop working correcly loading apache axis class org.apache.axis.client.Service() - required restart to work correctly.
1. Use Apache AXIS API to access and work with web services (API ref: http://ws.apache.org/axis/java/apiDocs/index.html).
2. Create service using
var service:org.apache.axis.client.Service = new org.apache.axis.client.Service();
3. Create call
var call:org.apache.axis.client.Call = service.createCall();
4. For authorization purposes if domino user is logged in:
call.setMaintainSession(true); - !Important
call.setProperty("Cookie","SessionID="+cookie.get("SessionID").getValue()+",DomAuthSessId="+cookie.get("DomAuthSessId").getValue())
5. Then simply call then web service and get your result:
var xmlType = new javax.xml.rpc.encoding.XMLType();
call.setTargetEndpointAddress({webServiceAddress});
call.setOperationName( {operationName} );
call.addParameter("INPUT1", xmlType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
call.addParameter("INPUT2", xmlType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
call.setReturnType(xmlType.XSD_STRING);
var a = new java.lang.Object[2];
a[0] = "param1";
a[1] = "param2";
var rating = call.invoke(a);
Authorization for SSO based login:
If your server is using basic http authorization, then previous demonstrated code should be modified to support basic http authorization. So we need to copy information from http header and pass it in web service request.
1. use headerValues global variable
2. check if headerValues.AUTHORIZATION or headerValues.containsKey("AUTHORIZATION")
3. set it in call property like call.setProperty("AUTHORIZATION",headerValues.AUTHORIZATION.nextElement()) or call.setProperty("AUTHORIZATION",headerValues.get("AUTHORIZATION").nextElement()).
Why is to use nextElement()? headerValues.get("AUTHORIZATION") returns single value enumeration, so to get string value we need to get element from list.
Problem detected when using apache axis in xpages internal requests (made using ssj - Server Side Javascript) is that sometimes domino server java class loader stop working correcly loading apache axis class org.apache.axis.client.Service() - required restart to work correctly.
Labels:
domino authorization,
web service,
xpages code reuse
Tuesday, 17 November 2009
Lotus Notes Outline tricks
Here are some tricks switching selected outline entry in embedded outlines:
1. We need for outline entries to define aliases, that could be used for referencing
2. For embedded outline should be defined name attribute (ex. "MyOutline").
3. To select required outline entry programmaticly it is required to set field "$MyOutline" ($ should be used as prefix for fields - full syntax "$"+OurDefinedOutlineName) value in opened document (to which embedded outline belongs) to outlineentry alias name (ex. "myDocs") and then doc should be refreshed, to apply entry selection.
P.S. @now there are problems to select outline entry just after form load, only using timer.
1. We need for outline entries to define aliases, that could be used for referencing
2. For embedded outline should be defined name attribute (ex. "MyOutline").
3. To select required outline entry programmaticly it is required to set field "$MyOutline" ($ should be used as prefix for fields - full syntax "$"+OurDefinedOutlineName) value in opened document (to which embedded outline belongs) to outlineentry alias name (ex. "myDocs") and then doc should be refreshed, to apply entry selection.
P.S. @now there are problems to select outline entry just after form load, only using timer.
Friday, 16 October 2009
How to add computed custom control to XPAGE at runtime
Very simple technique:
You need to know, that "include page" control could include not only page elements, but also custom control elements, but you should write then by Your hands.
So @1st create a repeater on page.
Then add include page control in repeater.
As repeater values set array of controls to add ex. ["ccontrol1.xsp", "ccontrol2.xsp",...]
use those values to compute page.
You need to know, that "include page" control could include not only page elements, but also custom control elements, but you should write then by Your hands.
So @1st create a repeater on page.
Then add include page control in repeater.
As repeater values set array of controls to add ex. ["ccontrol1.xsp", "ccontrol2.xsp",...]
use those values to compute page.
Subscribe to:
Posts (Atom)