Executing Services Calling IdcCommandUX from an Active Server Page ASP

Using the COM API for Integration 8-3 Example: Dim idcCmd idcCmd.initRemotesysadmin, c:\domain\bin 8.2.3 Calling IdcCommandUX from a Visual C++ Environment To call IdcCommandUX from a Visual C++ environment:

1. Add the IdcCommandUX control to the project.

2. Call the desired IdcCommandUX class.

8.2.4 Executing Services

When executing services using IdcCommandUX, keep these points in mind: ■ IdcCommandUX must be initialized with a valid user name and the location of the intradoc.cfg file. ■ Functions that must use HDA format for communication include computeWebFilePath , computeNativeFilePath , and computeURL . For more information about HDA formats, see Chapter 3, Working with Standard, Server, and Custom Components. ■ executeCommand can take HDA format or SOAP commands. To use SOAP, you must use the initRemote function instead of the init deprecated function. ■ IdcCommandUX attempts to establish a connection to a running Oracle Content Server instance. If a connection is not made, it fails. ■ The returned HDA-format string contains information about the success or failure of the command, using the StatusCode and StatusMessage variables. – If the command is successful, StatusCode is zero 0, and StatusMessage is a login message You are logged in as sysadmin. – If the command fails, StatusCode is negative -1, and StatusMessage is an error message. For more information, see the Oracle Fusion Middleware Idoc Script Reference Guide. For information about using the Launcher a native C++ application that allows a Java program to start as a Windows service, see Section 7.6, Using the Launcher.

8.2.5 Calling IdcCommandUX from an Active Server Page ASP

Calling IdcCommandUX from an Active Server Page ASP consists of these steps: 1. Creating the COM Object 2. Initializing the Connection 3. Defining Services and Parameters 4. Referencing Custom Resources 5. Executing the Service 6. Retrieving Results The following examples show how to do these steps. 8-4 Oracle Fusion Middleware Developers Guide for Oracle Universal Content Management Example 8–1 SOAP Example In this SOAP sample: ■ The GET_SEARCH_RESULTS service is called. ■ The parameters for the service are defined using fieldvalue pairs: – The ResultCount parameter sets the number of returned results to 5. – The SortField parameter sorts the returned results by release date. – The SortOrder parameter orders the returned results in descending order. – The QueryText parameter defines the query expression as Content Type matches research. The initRemote function must be used and isSOAP must be set to TRUE for a SOAP-formatted request, which is shown in the following example. Create COM object Set idcCmd = CreateObjectIdc.CommandUX Initialize the connection to the server x = idcCmd.initRemotedomain , sysadmin, socket:localhost:4444, true Create the SOAP envelope cmd = cmd ?xml version=1.0 ecoding=UTF-8? + Chr10 cmd = cmd SOAP-ENV:Envelope xmlns:SOAP-ENV=http: schemas.xmlsoap.orgsoapenvelope + Chr10 cmd = cmd SOAP-ENV:Body + Chr10 Define the service cmd = cmd idc:service xmlns:idc=http:www.oracle.com IdcService + Chr10 cmd = cmd IdcService=GET_SEARCH_RESULTS + Chr10 Define the service parameters cmd = cmd idc:document + Chr10 cmd = cmd idc:field name=NoHttpHeaders1idc:field + Chr10 cmd = cmd idc:field name=ClientEncodingUTF8idc:field + Chr10 cmd = cmd idc:field name=QueryTextdDocType lt;matchesgt; researchidc:field + Chr10 cmd = cmd idc:field name=ResultCount5idc:field + Chr10 cmd = cmd idc:field name=SortOrderDescidc:field + Chr10 cmd = cmd idc:field name=SortFielddInDateidc:field + Chr10 cmd = cmd idc:document + Chr10 cmd = cmd idc:service + Chr10 cmd = cmd SOAP-ENV:Body + Chr10 cmd = cmd SOAP-ENV:Envelope + Chr10 End SOAP envelope and execute the command results= idcCmd.executeCommandcmd Retrieve results Response.Writeresults Example 8–2 HDA Sample Create COM object Set idcCmd = CreateObjectIdc.CommandUX Initialize the connection to the server x = idcCmd.initRemotedomain, socket:localhost:4444, sysadmin, true Using the COM API for Integration 8-5 Define the service cmd = Properties LocalData + Chr10 cmd = cmd + IdcService=GET_SEARCH_RESULTS + Chr10 Define the service parameters cmd = cmd + ResultCount=5 + Chr10 cmd = cmd + SortField=dInDate + Chr10 cmd = cmd + SortOrder=Desc + Chr10 cmd = cmd + QueryText=dDocType=research + Chr10 Reference a custom component cmd = cmd + MergeInclude=ASP_SearchResults + Chr10 cmd = cmd + ClassStyle=home-spotlight + Chr10 cmd = cmd + end + Chr10 Execute the command results = idcCmd.executeCommandcmd Retrieve results Response.Writeresults Create COM object Set idcCmd = CreateObjectIdc.CommandUX Example 8–3 Creating the COM Object The first line of code creates the COM object: Create COM object Set idcCmd = CreateObjectIdc.CommandUX Example 8–4 Initializing the Connection To initialize the connection to Oracle Content Server, call the initRemote function: Initialize the connection to the server x = idcCmd.initRemotedomain, socket:localhost:4444, sysadmin, false This example uses these parameters: ■ The HttpWebRoot parameter specifies a value for the web root as defined in the configconfig.cfg file. ■ The idcReference parameter specifies a string containing information about connection to the Oracle Content Server instance. This is specified as socket followed by the IntradocServerHostName value and the IntradocServer Port address. ■ The value of theidcUser parameter, sysadmin, specifies the user who is connecting to Oracle Content Server. ■ The isSoap parameter is a Boolean value indicating if the request is in SOAP XML format or HDA format. In this case, it is false because it is in HDA format. For information about all the parameters, see Section 8.3.11, initRemote. Example 8–5 Defining Services and Parameters To define the service and parameters, build an HDA-formatted string that contains with the following lines: Properties LocalData service parameters end 8-6 Oracle Fusion Middleware Developers Guide for Oracle Universal Content Management The required and optional parameters vary depending on the service being called. For more information, see the Oracle Fusion Middleware Services Reference Guide for Universal Content Management. In this example, the end string is created after the optional custom component reference. For more information, see Section 8.2.6, Formatting with a Resource Include.