on 03-10-2015 12:16 PM
Hello Experts,
I need to create oData service from oracle store procedure,
what are the steps to do it.
We are using SMP Integration gateway.
Please Suggest.
Regards
Manish
Moved to SMP Developer Center from SAP for Mobile as more appropriate topic for that community.
Regards, Mike (Moderator)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Experts,
Here is my code to join 2 tables , in debug it does not give error, but it gives on only one table output not merged output.
Please suggest.
function processRequestSQL(message) {
//Import statements
importPackage(com.sap.gateway.ip.core.customdev.util);
importPackage(java.util);
importPackage(org.apache.olingo.odata2.api.edm);
importPackage(com.sap.gateway.core.ip.component.commons);
importPackage(org.apache.olingo.odata2.api.uri);
importPackage(com.sap.gateway.ip.core.customdev.logging);
//Get the SQL statement contained in message body
var sqlStatement = message.getBody();
var uriInfo = message.getHeaders().get(ODataExchangeHeaderProperty.UriInfo.toString());
var map = new HashMap();
map = uriInfo.getCustomQueryOptions();
//Create the query and sub query
var JOIN_WO_WHERE = "INNER JOIN ZONE ON AREA.AREA_ID = ZONE.AREA_ID ";
var WHERE = " WHERE ";
var JOIN = " INNER JOIN ZONE ON AREA.AREA_ID = ZONE.AREA_ID ";
//Modify the SQL statement
var modifiedSqlStatement = "";
var entitySet = uriInfo.getStartEntitySet();
var odataMethod = message.getHeaders().get(ODataExchangeHeaderProperty.ODataMethod.toString());
modifiedSqlStatement += sqlStatement;
if (odataMethod.toString() == "GET_FEED") {
entitySetName = entitySet.getName();
if (entitySetName == "AREA") {
if (sqlStatement.indexOf("WHERE") != -1
|| sqlStatement.indexOf("where") != -1) {
modifiedSqlStatement += JOIN_WO_WHERE;
} else {
// modifiedSqlStatement += WHERE;
modifiedSqlStatement += JOIN;
}
}
}
//Set the message body back with the modified SQL statement
message.setBody(modifiedSqlStatement);
//Logger
log.logErrors(LogMessage.TechnicalError, "This is first log");
//Set the message body back with the modified SQL statement
message.setBody(modifiedSqlStatement);
//Logger
log.logErrors(LogMessage.TechnicalError, "This is first log");
-------------------End Sample Implementation---------------------------------------
*/
return message;
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Manish,
Can we create SOAP webservice and then will it be converted to oData after deployment.
I mean to say we will develop all logic to consume store procedure in SOAP and then consume using Integration gateway.
I guess there should not be a problem then. It should work.
Looping to provide more information.
Regards,
JK
Hello Bjorn,
There are two approaches table based and store procedure based.
1. If we use table based approach then number of database hits increases and load is more on mobile client for business logic as all table has to be queried separately using oData.
2. If we use store procedure based approach then load is more on back end as all the queries will be executed at once.
As store procedure cannot be used directly on SMP that is why we use SOAP.
Please suggest if our approach is correct.
Regards
Manish
Hi Manish,
the detail you provided isn't sufficient enough to provide advice for your question .
Just as an idea, using the custom scripting in SMP you can manipulate the select statements that are sent to your JDBC database. Maybe you can write some intelligent scripts that would allow you to query the data more effectively.
Kind regards
Björn
Hi Bjoern,
Thanks for reply.
I have 2 tables which are joined using association in oData modeling, I want to use $expand to show output of 2 tables in oData, i tried but it does not give desired output.
Do I need to write custom script to join 2 tables if yes can you give one example.
Regards
Manish
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.