Example 10: Using the RIDC Target Connector

This topic discusses how to:

  • Upload text files to an Oracle WebCenter Content server.

  • Upload binary files to an Oracle WebCenter Content server.

  • Download text files from an Oracle WebCenter Content server.

  • Download binary files from an Oracle WebCenter Content server.

This topic contains code examples to help illustrate using the RIDC target connector.

Anywhere in the examples where the characters << bold text >> , replace the characters with an appropriate value for your WebCenter Content server.

To use the examples presented in this section, you must have an active Oracle WebCenter Content server, as well as an account on that server.

To upload a text file to an Oracle WebCenter Content Server:

  1. In PeopleSoft Application Designer, open the EXAMPLE_WORKREC record and add the following PeopleCode to the FieldChange event for the TEST field:

    &msg = CreateMessage(Operation.EXAMPLE_SERVICE_OPR);
    
    
    &ret = &msg.IBInfo.LoadConnectorProp("RIDCTARGET");
    &requestIbInfo = &msg.IBInfo.IBConnectorInfo;
    &msg.IBInfo.ConnectorOverride = True;
    
    
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties				("URL", "http://<<server:port>>/cs/idcplg", %Property);
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("Userid", <<userid>>, %Property);
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("Password", <<encrypted password>>, %Property);
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("AddFileName", "primaryFile", %Property);
    
    
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("FileName", "testfile.txt", %Property);
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("ContentType", "text/plain", %Property);
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("Charset", "UTF-8", %Property);
    
    
    
    &msgText = "This is the payload of the message.";
    &b = &msg.SetContentString(&msgText);
    
    
    
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("PutLocalName1", "IdcService", %Property);
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("PutLocalValue1", "CHECKIN_UNIVERSAL", %Property);
    
    
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("PutLocalName3", "dDocTitle", %Property);
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("PutLocalValue3", "TEST DOC", %Property);
    
    
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("PutLocalName4", "dDocAuthor", %Property);
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("PutLocalValue4", <<userid>>, %Property);
    
    
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("PutLocalName5", "dDocType", %Property);
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("PutLocalValue5", "Document", %Property);
    
    
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("PutLocalName6", "dSecurityGroup", %Property);
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("PutLocalValue6", <<security group name>>, %Property);
    
    
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("PutLocalName7", "dReleaseDate", %Property);
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("PutLocalValue7", "4/22/02 12:19 PM", %Property);
    
    
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("PutLocalName8", "dRevisionID", %Property);
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("PutLocalValue8", "1", %Property);
    
    
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("PutLocalName9", "dDocAccount", %Property);
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("PutLocalValue9", "", %Property);
    
    
    
    &response = %IntBroker.SyncRequest(&msg);
    
    MessageBox(0, "", 0, 0, &response.GetContentString());
    
    
  2. In the PeopleSoft Pure Internet Architecture, open the EXAMPLE_PAGE page and click the Test button.

Login to the WebCenter Content server and check for the file. Open the file and verify the contents.

To upload a binary file to an Oracle WebCenter Content Server:

  1. Create an image file named picture.jpg and move it to C:\.

  2. In PeopleSoft Application Designer, open the EXAMPLE_WORKREC record and add the following PeopleCode to the FieldChange event for the TEST field:

    &msg = CreateMessage(Operation.EXAMPLE_SERVICE_OPR);
    
    
    &ret = &msg.IBInfo.LoadConnectorProp("RIDCTARGET");
    &requestIbInfo = &msg.IBInfo.IBConnectorInfo;
    &msg.IBInfo.ConnectorOverride = True;
    
    
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("URL", "http://<<server:port>>/cs/idcplg", %Property);
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("Userid", <<userid>>, %Property);
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("Password", <<encrypted password>>, %Property);
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("AddFileName", "primaryFile", %Property);
    
    
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("FileName", "picture.jpg", %Property);
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("ContentType", "image/jpg", %Property);
    
    
    
    rem get the payload from the filesystem;
    &theTempFile = GetFile(("C:\picture.jpg"), "R", %FilePath_Absolute);
    If &theTempFile.IsOpen Then
       &base64string = &theTempFile.GetBase64StringFromBinary();
       &theTempFile.Close();
    End-If;
    
    
    &b = &msg.SetContentString(&base64string);
    
    
    rem since the data is currently wrapped in base64, we'll need to decode it 
    rem to binary before sending;
    
    
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("Base64", "DecodeFileBeforeSending", %Property);
    
    
    
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("PutLocalName1", "IdcService", %Property);
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("PutLocalValue1", "CHECKIN_UNIVERSAL", %Property);
    
    
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("PutLocalName3", "dDocTitle", %Property);
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("PutLocalValue3", "TEST DOC", %Property);
    
    
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("PutLocalName4", "dDocAuthor", %Property);
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("PutLocalValue4", <<userid>>, %Property);
    
    
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("PutLocalName5", "dDocType", %Property);
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("PutLocalValue5", "Document", %Property);
    
    
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("PutLocalName6", "dSecurityGroup", %Property);
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("PutLocalValue6", <<security group name>>, %Property);
    
    
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    		("PutLocalName7", "dReleaseDate", %Property);
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("PutLocalValue7", "4/22/02 12:19 PM", %Property);
    
    
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("PutLocalName8", "dRevisionID", %Property);
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("PutLocalValue8", "1", %Property);
    
    
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("PutLocalName9", "dDocAccount", %Property);
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    				("PutLocalValue9", "", %Property);
    
    
    
    &response = %IntBroker.SyncRequest(&msg);
    
    
    MessageBox(0, "", 0, 0, &response.GetContentString());
    
    
  3. In the PeopleSoft Pure Internet Architecture, open the EXAMPLE_PAGE page and click the Test button.

Login to the WebCenter Content server and check for the file. Open the file and verify the contents.

To download a text file from an Oracle WebCenter Content Server:

  1. Create a text file on the server.

    Note the value of the dDocName property, as this is used to uniquely identify the document.

  2. In PeopleSoft Application Designer, open the EXAMPLE_WORKREC record and add the following PeopleCode to the FieldChange event for the TEST field:

    &msg = CreateMessage(Operation.EXAMPLE_SERVICE_OPR);
    
    
    &ret = &msg.IBInfo.LoadConnectorProp("RIDCTARGET");
    &requestIbInfo = &msg.IBInfo.IBConnectorInfo;
    &msg.IBInfo.ConnectorOverride = True;
    
    
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    					("URL", "http://<<server:port>>/cs/idcplg", %Property);
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    					("Userid", <<userid>>, %Property);
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    					("Password", <<encrypted password>>, %Property);
    
    
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    					("PutLocalName1", "IdcService", %Property);
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    					("PutLocalValue1", "GET_FILE", %Property);
    
    
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    					("PutLocalName2", "dDocName", %Property);
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    					("PutLocalValue2", <<dDocName value>>, %Property);
    
    
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    					("PutLocalName3", "RevisionSelectionMethod", %Property);
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    					("PutLocalValue3", "Latest", %Property);
    
    
    &response = %IntBroker.SyncRequest(&msg);
    
    
    MessageBox(0, "", 0, 0, &response.GetContentString());
    
    
  3. In the PeopleSoft Pure Internet Architecture, open the EXAMPLE_PAGE page and click the Test button.

The contents of the text file will be present in the message box that displays.

To download a binary file from an Oracle WebCenter Content Server:

  1. Create a binary file on the server.

    Note the value of the dDocName property, as this is used to uniquely identify the document.

  2. In PeopleSoft Application Designer, open the EXAMPLE_WORKREC record and add the following PeopleCode to the FieldChange event for the TEST field:

    &msg = CreateMessage(Operation.EXAMPLE_SERVICE_OPR);
    
    
    &ret = &msg.IBInfo.LoadConnectorProp("RIDCTARGET");
    &requestIbInfo = &msg.IBInfo.IBConnectorInfo;
    &msg.IBInfo.ConnectorOverride = True;
    
    
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    					("URL", "http://<<server:port>>/cs/idcplg", %Property);
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    					("Userid", <<userid>>, %Property);
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    					("Password", <<encrypted password>>, %Property);
    
    
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    					("PutLocalName1", "IdcService", %Property);
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    					("PutLocalValue1", "GET_FILE", %Property);
    
    
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    					("PutLocalName2", "dDocName", %Property);
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    					("PutLocalValue2", <<dDocName value>>, %Property);
    
    
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    					("PutLocalName3", "RevisionSelectionMethod", %Property);
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties
    					("PutLocalValue3", "Latest", %Property);
    
    
    rem convert the received binary file to base64 so that we can use it as a string;
    &b = &msg.IBInfo.IBConnectorInfo.AddConnectorProperties("Base64", "EncodeReceivedFile", %Property);
    
    
    &response = %IntBroker.SyncRequest(&msg);
    
    
    &theTempFile = GetFile(("C:\outputFile.jpg"), "W", %FilePath_Absolute);
    If &theTempFile.IsOpen Then
       &theTempFile.WriteBase64StringToBinary(&response.GetContentString());
       &theTempFile.Close();
    End-If;
    
    
  3. In the PeopleSoft Pure Internet Architecture, open the EXAMPLE_PAGE page and click the Test button.

The contents of the binary file will be written to the file "C:\outputFile.jpg".