Code Sample
Xperience
>
API Reference
>
PSAdd
>
Code Sample
SoapAction | n/a |
Input Name | PSAdd |
Output Name | PSAddResponse |
Input Namespace | n/a |
Group Name | Xperience |
Container | XP_MsgBus.xsd |
PSAdd.cs
// PSContent
// Structure that contains the actual DATA being stored or
// retrieved. Additional elements provide details about the data included.
// PSContentType
// Identifies the type of content being stored or returned.
// Canonicals: Text, XML, Base64, Encrypted
// PSContents - string
var content = new PSContent_CType()
{
PSContents = Serializer.Serialize(new CustomMessage() { Text =
"Testing PS Payload" }),
PSContentType = PersistentStorageContentType.XML.ToString()
};
// PSPkg
// Structure that contains the INDEX, STATE and DATA being stored
// or retrieved from the Persistent Storage System.
// PSExpDays
// The NUMBER OF DAYS this data item will be kept before it is
// susceptible to automatic clean-up. 0 = Do not delete. Default = 0.
// PSIdx
// Structure of INDEX values used to store, retrieve and manage
// data. Structure = FI | Prod | App | User | Key | ConsumerEnv
// Any value not supplied will be defaulted to "-" or blank.
// Special notes on the ConsumerEnv element of the PSIdx:
// If the product’s message bus call to PS includes a “PSConsumerEnv” value
// (e.g., “2013-GLOBAL”), it will always be used and no further special
// handling will be done.
// If the product’s message bus call to PS has a “PSConsumerEnv” value of
// String.Empty (“”), it will override any special handling noted below.
// - This allows the product to override the automatic filling in of the
// “PSConsumerEnv” value since it is a non-null value. The PS call will be
// forwarded as-is with the “PSConsumerEnv” value set as String.Empty.
// - The product manifest value is ignored since the “PSConsumerEnv” value is
// explicitly set in the PS request.
// (e.g., Call to PS will have PSConsumerEnv = “”)
// PS already converts null PSIdx values to String.Empty, so this behavior
// will allow backward compatibility, as needed, on individual calls.
// If “Use Instance’s Environment” (CorrelPSEnvType) is set to True in the
// product manifest:
// - Xperience will lookup the “EnvironmentType” value that is set in the
// Instance’s configuration:
// - If the “EnvironmentType” value has been set (e.g., “Other”), Xperience
// will apply the configured “EnvironmentType” value to the missing/null
// “PSConsumerEnv” value. This will be done for all PS calls: PSAdd,
// PSInq, PSMod, PSMultiInq and PSSrch. (EX: Call to PS will have
// PSConsumerEnv = “Other”) Possible values based on the Instance’s
// setting are:
// PROD = “PROD”
// UAT = “UAT”
// Review = “Review”
// Other = “Other”
// - If the “EnvironmentType” value has NOT been set, Xperience
// will return an error to the calling product. (See below for error details.)
// If “Use Instance’s Environment” (CorrelPSEnvType) is NOT set to True in the
// product manifest and the “ProdEnv” element is not set in the product
// manifest and the product’s message bus call to PS does not supply
// “PSConsumerEnv” value. (e.g., Null or String.Empty)
// - The PS call will be forwarded as-is with no value for “PSConsumerEnv”.
// If “Use Instance’s Environment” (CorrelPSEnvType) is NOT set to True in the
// product manifest and the “ProdEnv” element is set in the product manifest.
// (e.g., “2013-TEST”) and the product’s message bus call to PS has a
// “PSConsumerEnv” value of null. (Not set or not sent)
// - Xperience will apply the configured “ProdEnv” value from the requesting
// Product’s manifest to the missing/null “PSConsumerEnv” value. This will
// be done for all PS calls: PSAdd, PSInq, PSMod, PSMultiInq and PSSrch.
// (EX: Call to PS will have PSConsumerEnv = “2013-TEST”)
// CorrelPSEnvType true true false false false false
// ProdEnv “” “” “” 2013-TEST 2013-TEST 2013-TEST
// Inst Config Not Set Prod Prod Prod Prod Prod
// PSIdx.PsConsumerEnv null null null null “” 2013-GLOBAL
//
// Result error Prod “” 2013-TEST “” 2013-GLOBAL
var pkg = new PSPkg_CType()
{
PSContent = content,
PSExpDays = 0,
PSIdx = Helper.CreatePSIdx(),
};
// PSAddRq_MType
// Request to store data. If no KEY is supplied, one will be created and
// returned.
// If a KEY is supplied it will be used unless it already exists.
// The OvrWrite flag determines action to be taken if a supplied KEY exists.
// PSOvrWrite
// Determines if PS System should overwrite data if key already exists
// (during a create with a supplied key)
// Canonicals: True, False
// PSSecKey
// A private key issued by the application that informs PS
// that the data cannot be retrieved without this key.
PSAddRq_MType request = new PSAddRq_MType()
{
PSOvrWrite = bool.TrueString,
PSSecKey = this.securityKey,
PSPkg = pkg
};
Helper.FillHeader(request);
PSAdd.js
var sampleDataForContent = new sampleXPWebProductAngular.CustomMessage();
sampleDataForContent.Text = "Testing PS Payload";
var content = new jackHenry.xperience.businessObjects.PSContent_CType();
content.PSContents = replaceAll('\'', "\"",sampleDataForContent.ToJsonString());
content.PSContentType = 'Text';
var pkg = new jackHenry.xperience.businessObjects.PSPkg_CType();
pkg.PSContent = content,
pkg.PSExpDays = 0,
pkg.PSIdx = new jackHenry.xperience.businessObjects.PSIdx_CType();
pkg.PSIdx.PSApp = 'sampleXPWebProductAngular';
pkg.PSIdx.PSConsumerEnv = "Test";
pkg.PSIdx.PSFinInst = "1234",
pkg.PSIdx.PSKey = jackHenry.xperience.Guid.newGuid();
pkg.PSIdx.PSProd = 'sampleXPWebProductAngular';
pkg.PSIdx.PSUsr = currentUser.IMSSubj;
var request = new jackHenry.xperience.businessObjects.PSAdd();
request.PSOvrWrite = 'true';
request.PSSecKey = securityKey;
request.PSPkg = pkg;
sampleXPWebProductAngular.Helper.FillHeader(request);
var responseCallback = jackHenry.xperience.messageBus.send(request).registerResponseHandler(onAddEntryCallback);
Have a Question?
Have a how-to question? Seeing a weird error? Get help on
StackOverflow.
Register for the Digital Toolkit Meetup
where we answer technical Q&A from the audience.
Last updated Mon Apr 11 2022