cancel
Showing results for 
Search instead for 
Did you mean: 

DBLookup? Urgent

Former Member
0 Kudos

Hi Guys,

My scenario is RFC - SOAP synchronus.

In the response mapping, i have a field from the 3rd party WSDL which basically returns the status codes like 100, 200 etc. If 100 i need to map the message as "success" to a particular field in RFC.

I have used value mapping for success and failure but now the code list is huge and we decided to do DBLookup which should take the code as the input and make a query and get the description back for this particular code .

1. Do i need to define this table structure in XI ? If yes, then do i need make the source conatin these two structures together like Message1(WSDL structure) + Message2(DB structure).

2. Is it not possible to take the value of the code from the wsdl field and make a Query in the database and take the description back and map it to the RFC field with out defining the DB structure in XI.

The code for the UDF is as below, plz suggest if anything is wrong

public void DBLookup(String[] a,ResultList result,Container container){
 
String Query = " ";
Channel channel = null;
DataBaseAccessor accessor = null;
DataBaseResult resultSet = null;

// Build the Query String

Query = "Select Description from  trans where XI_ID = "a" 

// a conatins the code value like 100, 200 etc

try{

//Determine a channel, as created in the Configuration

channel = LookupService.getChannel("xxxx_BS","CC_JDBC_Reciver"); 

// xxxx_BS -- Business system of 3rd party system where the DB exists

//Get a system accessor for the channel. As the call is being made to an DB, an DatabaseAccessor is obtained.

accessor = LookupService.getDataBaseAccessor(channel);

//Execute Query and get the values in resultset

resultSet = accessor.execute(Query);

// I think i dont require the code below as there is no interation in my case, correct me if i am wrong

for(Iterator rows = resultSet.getRows();rows.hasNext();){
Map rowMap = (Map)rows.next();
result.addValue((String)rowMap.get("Description"));
}

}
catch(Exception ex){
result.addValue(ex.getMessage())
}

finally{
try{
if (accessor!=null) accessor.close();
}
catch(Exception e){
result.addValue(e.getMessage())
}

}

any help or suggestions would be appreciated

Thanks,

Srini

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

One alternative you can try is load all the dbtable enteries in Value Mapping Table, By writing java codes.

If you are using PI 7.1 then you have to define the JDBC structure in PI.

If you are using PI 7.0 then you no need to define JDBC structure but you have to populate xml values inside your code and then need to call comm. channel.

Hope this helps.

Gaurav Jain

Points if answer is useful