Monday, April 30, 2012

Custom Xquery code to add tow values


xquery version "1.0" encoding "Cp1252";

declare namespace xf = "http://tempuri.org/Test/Addition/";

declare function xf:Addition($input1 as xs:string,$input2 as xs:string)
    as xs:string {
   
   
    let $add as xs:string := fn:concat($input1," ",$input2)
    return
    xs:string($add)
       
};

declare variable $input1 as xs:string external;
declare variable $input2 as xs:string external;

xf:Addition($input1,$input2)

Friday, April 27, 2012

How to change the cache time based on output result

 I have used the following query to get the same.

Here as you can see i am using XQuery expression at response.

I am comparing the return status with string 'S'


Evaluate XQuery Expression at Response :
(compare($body/get:OutputParameters/get:RETURN_STATUS,'S')*2+1)*60


Here S stands for success message and similarly for error message the  return status will be E.

Now if the return status is S than compare will gives us a result 0

0*2+1=1

and then we are multiplying it with 60 to define 60 seconds as cache time to live.

Now in case of error The return status will be E so the compare statement will give us a value of -1

Now the total value of expression will be

-1*2+1=-1

So overall value will be -60.

When the value is negative in xquery the cache is not stored.

So we have achieved the dual functionality of changing the time to live for success process and at the same time not caching the data for error message.

Wednesday, April 25, 2012

XQuery funciton for dvm:lookup


xquery version "1.0" encoding "Cp1252";
(:: pragma  type="xs:anyType" ::)

declare namespace xf = "http://tempuri.org/DomainValueMapProject/dvm/";
declare namespace dvm="http://xmlns.oracle.com/dvm";

declare function xf:lookup($dvmTable as element(*), $sourceColumnName as xs:string,
    $sourceValue as xs:string, $targetColumnName as xs:string, $defaultValue as xs:string)
    as xs:string {
       let $idxSource as xs:integer := for $n at $i in $dvmTable/dvm:columns/dvm:column where ($n/@name = $sourceColumnName) return $i
       let $idxTarget as xs:integer := for $n at $i in $dvmTable/dvm:columns/dvm:column where ($n/@name = $targetColumnName) return $i
     
       let $res1 := $dvmTable/dvm:rows/dvm:row/dvm:cell[position() = $idxSource
        and text()=$sourceValue]/../dvm:cell[position() = $idxTarget]/text()
       return
       if (fn:string-length($res1) > 0) then
        string($res1)
       else
         string($defaultValue)
};

declare variable $dvmTable as element(*) external;
declare variable $sourceColumnName as xs:string external;
declare variable $sourceValue as xs:string external;
declare variable $targetColumnName as xs:string external;
declare variable $defaultValue as xs:string external;

xf:lookup($dvmTable, $sourceColumnName, $sourceValue, $targetColumnName, $defaultValue)

Thursday, April 12, 2012

RCU-6107:DB Init Param Prerequisite failure for: processes Current Value is 100. It should be greater than or equal to 200

log in to oracle database


[oracle@arpit]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Apr 12 14:34:37 2012

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production

check the current display process

SQL> show parameter processes

NAME TYPE VALUE
------------------------------------ ----------- --------------------------
aq_tm_processes integer 0
db_writer_processes integer 1
gcs_server_processes integer 0
job_queue_processes integer 4
log_archive_max_processes integer 2
processes integer 40


change the value to 300

SQL> alter system set processes = 300 scope = spfile;

System altered.

Restart the database and issue is gone.

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup
ORACLE instance started.

Total System Global Area 348127232 bytes
Fixed Size 1258824 bytes
Variable Size 104860344 bytes
Database Buffers 239075328 bytes
Redo Buffers 2932736 bytes
Database mounted.
Database opened.

Sunday, April 01, 2012

Native Security Feature in Oracle Service Bus

Oracle service bus provides a built in security feature which can be used to protect the web service.

In this exercise we will see one of the security feature to secure our web service with user id and password.

Following document provides an overview of security feature of OSB

http://docs.oracle.com/cd/E13159_01/osb/docs10gr3/security/model.html

Now in order to set up a security feature we will first use the sample HelloWorld service and use security feature.

Now go to your project explorer and click on the proxy service that you have.



Now go to the Security tab and click on the Transport configuration



It will come up with the following page and click on the condition.




Now in the next screen provide the itcredential as user



Now say next and in the next page specify the username as argument and add it to the argument name.



Now once you will say finish you can see the user specified for the web service as shown below.




Now you can access the wsdl using the following link

http://host:port/endpointurl?wsdl

Now in order to test how this security feature work we will use any testing engine like soap ui.Create a simple project and use this wsdl to initiate a process as shown below.



Now once you will see ok it will ask for user id and password this is because we have specified the security feature as user password but we have not created any user and password.




So now you need to create a user id and password in order to test this service.

So this is how i will create a user id and password