Skip to content

Commit

Permalink
Refactor SAP implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
sdkottegoda committed Apr 22, 2019
1 parent 47c7490 commit 53ac78b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
Expand Up @@ -181,7 +181,7 @@ public void sendMessage(MessageContext messageContext, String targetEPR,
body = messageContext.getEnvelope().getBody();
payLoad = body.getFirstChildWithName(new QName(RFCConstants.BAPIRFC));
log.info("Received RFC/Meta DATA: " + payLoad);
String rfcFunctionName = RFCMetaDataParser.getBAPIRFCFucntionName(payLoad);
String rfcFunctionName = RFCMetaDataParser.getBAPIRFCFunctionName(payLoad);
log.info("RFC name: " + rfcFunctionName);
if (isTransaction(messageContext) || isLogon) {
if (log.isDebugEnabled()) {
Expand Down
Expand Up @@ -62,28 +62,24 @@ public static void processMetaDataDocument(OMElement document, JCoFunction funct
}

/**
* Returns the BAPI/RFC function name
* Returns the BAPI/RFC function name.
*
* @param rootElement root document element
* @return the BAPI/RFC function name
* @throws AxisFault throws in case of an error
*/
public static String getBAPIRFCFucntionName(OMElement rootElement) throws AxisFault {
String qname = rootElement.getQName().toString();
if (qname != null) {
if (qname.equals(RFCConstants.BAPIRFC)) {
String rfcFunctionName = rootElement.getAttributeValue(RFCConstants.NAME_Q);
if (rfcFunctionName != null) {
return rfcFunctionName;
} else {
throw new AxisFault("BAPI/RFC function name is mandatory in meta data" +
" configuration");
}
public static String getBAPIRFCFunctionName(OMElement rootElement) throws AxisFault {
if (rootElement != null) {
String rfcFunctionName = rootElement.getAttributeValue(RFCConstants.NAME_Q);
if (rfcFunctionName != null) {
return rfcFunctionName;
} else {
throw new AxisFault("Invalid meta data root element.Found: " + qname + "" +
". Required:" + RFCConstants.BAPIRFC);
throw new AxisFault("BAPI/RFC function name is mandatory in meta data configuration");
}
} else {
throw new AxisFault("Invalid meta data root element.Found: " + rootElement + "" +
". Required:" + RFCConstants.BAPIRFC);
}
return null;
}

private static void processElement(OMElement element, JCoFunction function) throws AxisFault{
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -2544,7 +2544,7 @@

<!--SAP import version. This should be changed immediately after each release of carbon-mediation to the
latest released version of mediation.-->
<org.wso2.carbon.transports.sap.import.version>4.6.123-SNAPSHOT</org.wso2.carbon.transports.sap.import.version>
<org.wso2.carbon.transports.sap.import.version>4.6.129-SNAPSHOT</org.wso2.carbon.transports.sap.import.version>
</properties>
<pluginRepositories>
<pluginRepository>
Expand Down

0 comments on commit 53ac78b

Please sign in to comment.