on 08-22-2013 6:31 AM
Hi XI gurus,
I have a requirement to remove Doctype tag from inbound CXML file before it hits message mapping. So I have created an Abap class and in execute method I am removing doctype tag from input file. This works fine when i debug this class explicitly. I have configured this abap class in operation mapping first, then message mapping. But when I send message from RWB, my class does not get hit and also message still fails since doctype tag was not deleted. When I try to test in SXI_mapping_test, it never stopped in abap class though I have placed hard break point. I have gone through blogs , but all of them speak about having only ABAP class in operation mapping. My question is can I use both abap and message mapping in same operation mapping? If not how can I achieve my requirement?
Thanks very much in advance!
Latha
Hi Latha,
Is this the first ABAP Mapping you are using in your system have you set the property R3_ABAP|Abapclass;R3_XSLT|XSL (ABAPEngine) in Exchange profile.
In general this requirement that can be addressed using Java Mapping - something like the one below - depending on the version you are using may need a bit of modification :
package com.java.mapping;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
//1. AbstractTransformation class is imported.
// The associated jar file is: com.sap.xpi.ib.mapping.lib.jar
import com.sap.aii.mapping.api.AbstractTransformation;
import com.sap.aii.mapping.api.DynamicConfiguration;
import com.sap.aii.mapping.api.DynamicConfigurationKey;
import com.sap.aii.mapping.api.StreamTransformationException;
import com.sap.aii.mapping.api.TransformationInput;
import com.sap.aii.mapping.api.TransformationOutput;
import com.sap.aii.mapping.api.InputHeader;
public class Java_Mapping extends AbstractTransformation {
public void transform(TransformationInput arg0, TransformationOutput arg1) throws StreamTransformationException {
getTrace().addDebugMessage("JAVA Mapping Called");
String inData = convertStreamToString(arg0.getInputPayload().getInputStream());
DynamicConfiguration conf = arg0.getDynamicConfiguration();
inData = inData.replace("<!DOCTYPE cXML SYSTEM \"http://xml.cXML.org/schemas/cXML/1.2.014/cXML.dtd\">","");
try
{
arg1.getOutputPayload().getOutputStream().write(inData.getBytes());
}
catch(Exception exception1) {
}
}
/* Converts Input stream to String */
public String convertStreamToString(InputStream in){
StringBuffer sb = new StringBuffer();
try
{
InputStreamReader isr = new InputStreamReader(in);
Reader reader =
new BufferedReader(isr);
int ch;
while((ch = in.read()) > -1) {
sb.append((char)ch);}
reader.close();
}
catch(Exception exception) { }
return sb.toString();
}
}
Regards
Subhro
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi everyone,
Thanks very much for all valuable ideas. The reason why my abap mapping and java mapping does not work is interface is not getting determined and it is not finding the operation mapping. Did anyone encounter this problem because of doctype tag?
Any help is really appreciated!
Thanks
Latha
Hi Latha,
You may want to check in the configuration wizard test in case if this is not for the doctype tag in the payload, While configuring are you selecting the operation mapping from the popup selection or providing the name writing manually in the Interface Determination part.
Regards
Subhro
Hi Latha,
For removing the doctype you can check my response in this thread. In case the interface is not getting determined , try putting a condition and check if it works. Secondly did you try test configurations in ID with a sample payload with the doctype tag?
Regards
Anupam
Hi Anupam,
Thank you for the response. Yes, when I test in ID with DOCTYPE tag it errors out. When there is not DOCTYPE tag it shows Green. I have implemented java mapping and have configured in OM . When i try to execute java mapping it deletes the doctype tag correctly. Whne i send from RWB below is the reponse.
="IF_DETERMINATION">CX_ID_PLSRV</SAP:Code>
Hi Latha,
As Amit say you can do all the possible combinations inside the operation mapping.
For my experience i'd rather to use a XSL mapping to remove determinated tags or namespaces, with the abap-mapping you are doing you scenario dependent of the ABAP-stack and you should consider if your system is going to be uppgraded in the future the possibility that you would use the ICO object, more efficient, without ABAP stack or the installation 7.31 only java stack.
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Yes, u can use combination of ABAP+Graphical mapping in ur OM, but not sure how u r writing ur ABAP code.
Having said that, removing doctype declaration is a common req and u can find lots of discussion on the same
http://scn.sap.com/thread/3184205
Thanks
Amit Srivastava
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
I don't have any screenshot which shows how to call abap+graphical in single OM, but certainly it should work.
In addition to that, i hope you have correctly maintained the parameters under exchange profile to enable ABAP mapping? BTW u can refer below blog to test ur abap mapping locally
Thanks
Amit Srivastava
User | Count |
---|---|
84 | |
10 | |
9 | |
8 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.