These are methods used for special situations, such as obtaining access to Storefront outside of a SXI event, or excluding other users from running a module temporarily.
Begin a critical section in a SXI/SINI module, which may involve several SINI calls. Repeated calls with the same section name will nest automatically, but each BeginCriticalSection needs a matching EndCriticalSection. Modules should always call EndCriticalSection as soon as the critical code is finished. Critical sections should be short; this is not intended for performing long processes. Good practice dictates that Begin/End pairs involving different section names should be nested rather than overlapping.
Method
bool BeginCriticalSection(string sectionName,
int msTimeout,
int timeToLive)
Parameters
■ sectionName — name of the critical section to begin.
■ msTimeout — the number of milliseconds that the call will wait before giving up and returning false.
■ timeToLive — the maximum number of milliseconds the section is expected to last. If this time is exceeded then a subsequent BeginCriticalSection call with the same sectionName will succeed, even if it is from another SXI/SINI instance.
Returns
Normally true, and in this case all other SXI/SINI instances are blocked from running in code delimited by Begin/EndCriticalSection calls involving that section name.
End a critical section in a SXI/SINI module. This should occur once for each BeginCriticalSection call.
Method
bool EndCriticalSection(string sectionName)
Parameters
■ sectionName — name of the critical section to end. This must match a currently active critical section.
Returns
Returns true if it succeeds.
Determine whether a field name is specified in a form or scheme.
Method
string GetFieldDefinitionStatus(string fieldType,
string fieldName,
string objectID)
Parameters
■ fieldType — Must be one of UserField, PrintingField, DataMergeField, VariableValue, OrderField, AssetField or ProductField.
■ fieldName — A field name, which could be one of the predefined field names described in the Shared Classes section, or a deployer-defined field name, or an arbitrary name.
■ objectID — Internal ID of the object (such as document, user, or order) querying information on.
Returns
A string indicating what kind of field is defined by the given field name:
■ “predefined” — if the field name is one of the predefined field names described in the Shared Classes section;
■ “defined” — if the field name is a deployer-defined field name;
■ “adhoc” — if the field name is not predefined or deployer-defined.
Note: “adhoc” field names can still be accessed with GetValue, SetValue, GetAllValues, etc.
Remarks
If fieldType does not match one of the given field types, it is an error and FieldDefinitionStatus returns null.
This method is normally used by Extensions other than SXI modules, modules which do not depend on being called from Storefront but instead initiate communications on their own (also called “pure SINI modules”). Such modules need to call ObtainUserTicket to obtain a security token for use with the preceding StorefrontAPI methods. The resulting security token is for short-term use; it may be time-limited and does not persist when the IIS application is restarted.
This is not the same kind of “ticket” referred to in GetTicketForUserLogin().
Note, too, this method does not create an IIS session. The ID it stores in the Sessions table of the database is proprietary to Pageflex and has no relationship to IIS session IDs.
Method
string ObtainUserTicket(string userLogin,
string password,
string ident)
Parameters
■ userLogin — Logon name for the user.
■ password — Logon password for the user.
■ ident — Identifier string to store in the log message when the ticket is used to change data or for a call which causes an exception.
Returns
The return value is a string which is used as the securityToken argument in the SINI protocol. The caller does not need to do anything with this return value; it is returned for informational and debugging purposes only.
Example
The following example assumes that you have added a reference to SXI.dll (located in the “Programs” directory for the installation, such as \Pageflex\ServerX.X\Programs).
public string GetDocumentStatus(
string user,
string password,
string externalDocID)
{
// The following should be a URL to your deployment:
//
string storefrontUrl =
“http://localhost/Storefront1/StorefrontAPI.asmx”;
SXI.StorefrontAPIHelper Storefront
= new SXI.StorefrontAPIHelper(storefrontUrl);
Storefront.ObtainUserTicket(user, password,
"StatusExample");
string docid = Storefront.FindDocumentID(externalDocID);
string status = Storefront.GetValue("DocumentProperty",
"Status",
docid);
Storefront.ReleaseTicket();
return status;
}
This method is used by consumers of the ObtainUserTicket method to declare that they are done using the ticket.
Method
bool ReleaseTicket()
Parameters
None.
Returns
The return value is true if the ticket was valid, false otherwise.