on 05-08-2016 1:47 PM
I have put together, from another forum post, a UNZIP custom action block and have successfully uploaded and deployed, however when customizing the links on the action block, the input and output parameters defined in the Java do not appear.
With the custom action block in a transaction that is executed interactively the following error is observed. Without the custom action in the transaction, no error is generated.
And the following appears in the system log
<?xml version="1.0" encoding="UTF-8"?><Rowsets DateCreated="2016-05-08T12:43:20" EndDate="2016-05-08T12:43:20" StartDate="2016-05-08T12:43:20" Version="15.0 SP2 Patch 4 (Nov 7, 2014)"><FatalError>Could not service request, Unable to load transaction [TMP72152460-151a-11e6-999b-d2a40a340178.trx]</FatalError></Rowsets>
[EXCEPTION]
com.sap.xmii.bls.exceptions.TransactionLoadException: Unable to load transaction [TMP72152460-151a-11e6-999b-d2a40a340178.trx]
at com.sap.xmii.bls.engine.TransactionExecuter.executeFromHttpRequest(TransactionExecuter.java:396)
at com.sap.xmii.servlet.Runner.service(Runner.java:85)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at com.sap.xmii.servlet.ServletRunner.run(ServletRunner.java:80)
at com.sap.xmii.common.LocalServiceConnection.post(LocalServiceConnection.java:147)
at com.sap.xmii.xacute.common.ClientCatalogUtilities.postServiceConnection(ClientCatalogUtilities.java:2493)
at com.sap.xmii.xacute.common.ClientCatalogUtilities.postServiceConnection(ClientCatalogUtilities.java:2470)
at com.sap.xmii.xacute.transaction.TransactionUtilities.ExecuteTransaction(TransactionUtilities.java:1019)
at com.sap.xmii.servlet.Catalog.handleExecuteTempTrx(Catalog.java:350)
at com.sap.xmii.servlet.Catalog.service(Catalog.java:251)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at com.sap.engine.services.servlets_jsp.server.runtime.FilterChainImpl.runServlet(FilterChainImpl.java:202)
at com.sap.engine.services.servlets_jsp.server.runtime.FilterChainImpl.doFilter(FilterChainImpl.java:103)
Reviewing my code, taken from another post, can you identify what is missing that would cause this problem. Regards, Hank
package dataUnzip;
//import java.io.ByteArrayOutputStream;
import java.io.*;
//import java.util.zip.GZIPOutputStream;
import java.util.zip.*;
import sap.xmii.bls.sdk.*;
//import sap.xmii.bls.sdk.Action;
//import sap.xmii.bls.sdk.IActionInstance;
//import sap.xmii.bls.sdk.Input;
//import sap.xmii.bls.sdk.InvalidVariableException;
//import sap.xmii.bls.sdk.Outputs;
//import sap.xmii.bls.sdk.IActionConfiguration;
import com.sap.lhcommon.common.*;
import com.sap.lhcommon.exceptions.*;
import com.sap.lhcommon.util.*;
import com.sap.xmii.bls.exceptions.BlsException;
import com.sap.xmii.bls.sdk.InvalidVariableException;
//import com.sap.lhcommon.common.VariantDataTypes;
//import com.sap.lhcommon.exceptions.DataConversionException;
//import com.sap.lhcommon.util.Base64Util;
public class unzipHandler {
// /**
// To ensure the parameters are always named the same, it is good practice
// to create a static final string with the parameters name. This also make
// it easy to use across actions.
// */
private static final String PARAM_OUTPUT_DATAZIP = "Output";
private static final String PARAM_OUTPUT_MESSAGE = "dataUnzipReturnMessage";
private static final String PARAM_OUTPUT_SUCCESS = "dataUnzipSuccess";
// @Action(name = "dataUnZip", icon = "/com/mii/customactions/datazip/icons/zip.jpg" )
@Action(name = "dataUnZip" )
// This annotation tells the engine that this is an
// action available to execute.
@Outputs(names = {PARAM_OUTPUT_DATAZIP, PARAM_OUTPUT_MESSAGE, PARAM_OUTPUT_SUCCESS },
types = { VariantDataTypes.STRING, VariantDataTypes.STRING, VariantDataTypes.BOOLEAN })
// This annotation tells the engine the output parameters
// to be returned.
public static void dataUnZip(
IActionInstance instance,
@Input(name = "StringData" ) String stringData)
throws InvalidVariableException, BlsException {
// Exceptions can be thrown directly from
// the actions without causing critical
// execution failures. These exceptions
// will be caught and logged by the engine
// and will cause the Success flag to be
// set to false.
// The following code describes how to set an actions output.
try{
//define the output stream
ByteArrayOutputStream out = new ByteArrayOutputStream();
GZIPOutputStream gzip = new GZIPOutputStream(out);
//compress and write the data
gzip.write(stringData.getBytes());
gzip.close();
//encode the binary data into Base64 and pass to the output as string
String outputString = new String(Base64Util.encode(out.toByteArray()), "UTF-8");
instance.setActionResult(PARAM_OUTPUT_SUCCESS, true);
instance.setActionResult(PARAM_OUTPUT_MESSAGE, "Zip Successful");
instance.setActionResult(PARAM_OUTPUT_DATAZIP, outputString);
} catch (Exception ex) {
try{
instance.log(LogLevel.ERROR, ex.getMessage());
instance.setActionResult(PARAM_OUTPUT_SUCCESS, false);
instance.setActionResult(PARAM_OUTPUT_MESSAGE, "Error on zip operation:"+ex.getMessage());
}
catch (DataConversionException e) {
instance.log(LogLevel.ERROR, e.getMessage());
}
}
}
}
The problem could be in the catalog.xml file which is used to deploy the action (action name has to be same , case sensitive, as the method in the action block).
The method is named ‘dataUnZip’ ( public static void dataUnZip ) and in package name as well as the catalog.xml the recorded name should be the same.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Hank,
I too am getting a similar error with my action block. Actually, it was modelled on the unzip action block it looks like you are attempting to deploy, which I found as an example online.
Did you have any luck with this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Hank,
What is the name of the custom action jar ?
Also which mii version are you currently using ?
Thanks,
Neha Kshirsagar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
12 | |
7 | |
3 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.