on 01-25-2014 5:48 PM
I am using SOAP receiver CC.
PI Output are asbelow:
After removing the ns0: the messages are processing successfully
is it possible to send a message by PI with out ns0: ? after mapping the output are adding ns0: automatically . is there any standard module to handle the same issue. I used XMLAnonymizerBean but its not working. Please suggest
Hi,
Apart from these, you can also have a Java mapping added below your message mapping. The code could be like:
package p123;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.Reader;
import java.util.Map;
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.InputHeader;
import com.sap.aii.mapping.api.StreamTransformationConstants;
import com.sap.aii.mapping.api.StreamTransformationException;
import com.sap.aii.mapping.api.TransformationInput;
import com.sap.aii.mapping.api.TransformationOutput;
public class LeadTec extends AbstractTransformation{
public void transform(TransformationInput transformationInput, TransformationOutput transformationOutput) throws StreamTransformationException
{
String oldFilename = "";
String newFilename = "";
try
{
InputStream inputstream = transformationInput.getInputPayload().getInputStream();
OutputStream outputstream = transformationOutput.getOutputPayload().getOutputStream();
byte[] b = new byte[inputstream.available()];
inputstream.read(b);
String inData = convertStreamToString(transformationInput.getInputPayload().getInputStream());
InputHeader messageHeader = transformationInput.getInputHeader();
Leac le = new Leac();
String St2 = le.transform(inData);
transformationOutput.getOutputPayload().getOutputStream().write(St2.getBytes("UTF-8"));
}
catch (Exception exception)
{
getTrace().addDebugMessage(exception.getMessage());
throw new StreamTransformationException(exception.toString());
}
}
public String transform(String input) {
return input.replaceAll("ns0:", "");
}
private 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();
}
public static void main(String[] args)
{
// Local Testing
try {
InputStream in = new FileInputStream(new File("C:/Users/IBM_ADMIN/Desktop/BakarNew.txt"));
OutputStream out = new FileOutputStream(new File("C:/Users/IBM_ADMIN/Desktop/test1234.txt"));
Leac myMapping = new Leac();
String input = myMapping.convertStreamToString(in);
String new_filename = myMapping.transform(input);
out.write(new_filename.getBytes("UTF-8"));
} catch (Exception e) {
e.printStackTrace();
}
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Deleted my reply as it's already shared by Amit..
Message was edited by: Hareesh Gampa
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
There are quite a few threads on SDN pertaining to ur problem? Did u check that?
http://www.saptechnical.com/Tutorials/XI/XMLPayload/Index.htm
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.
User | Count |
---|---|
86 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
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.