on 11-13-2014 10:30 AM
Hello Experts,
1. Business is sending xmlv2 file starting file size and then tag.
004605
<?xml version="1.0" encoding="utf-16"?>
<Saa:DataPDU xmlns:Saa="urn:swift:saa:xsd:saa.2.0" xmlns:Sw="urn:swift:snl:ns.Sw" xmlns:SwInt="urn:swift:snl:ns.SwInt" xmlns:SwGbl="urn:swift:snl:ns.SwGbl" xmlns:SwSec="urn:swift:snl:ns.SwSec">
<Saa:Revision>2.0.3</Saa:Revision>
<Saa:Header>
<Saa:TransmissionReport>...............
In PI message mapping I am getting
Runtime exception occurred during application mapping com/sap/xi/tf/_xxxx_; com.sap.aii.utilxi.misc.api.BaseRuntimeException:Content is not allowed in prolog.
If I test from RWB removing the file size. Interface is working fine.
<?xml version="1.0" encoding="utf-16"?>
<Saa:DataPDU xmlns:Saa="urn:swift:saa:xsd:saa.2.0" xmlns:Sw="urn:swift:snl:ns.Sw" xmlns:SwInt="urn:swift:snl:ns.SwInt" xmlns:SwGbl="urn:swift:snl:ns.SwGbl" xmlns:SwSec="urn:swift:snl:ns.SwSec">
Can some one tell me how to handle these kind of messages in PI.Do we have any option to remove this number and pass the message to mapping.
2. I am using XMLAnonymizer to convert Saa to ns0. I have provided the parameter values as below in the module tab.
anonymizer.acceptNamespaces urn:swift:saa:xsd:saa.2.0" xmlns:Sw="urn:swift:snl:ns.Sw" xmlns:SwInt="urn:swift:snl:ns.SwInt" xmlns:SwGbl="urn:swift:snl:ns.SwGbl" xmlns:SwSec="urn:swift:snl:ns.SwSec"
anonymizer.quote ns0
Still I could see Saa in the payload. what value I should provide to chang the payload "Saa"with ns0.
Thanks,
Lavanya
Hi LAvanya,
Have you thought to use the sender file adapter instead of the sender SOAP?, or you sender third-system send the message as attachment?
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Lavanya,
Does file size in the xml file at first place has any significance in terms of business requirement. If not, you can ask source system to generate only xml file with no file size value at the beginning of xml file.
Else if file size has some significance, then use java mapping to remove the file size value from xml file. You can make use of simple java api e.g., substring() to get the required xml content for next graphical mapping
Best Regards,
Praveen Gujjeti
Hello Praveen,
Thank you for the response.
I have checked with Business and got confirmation that, they cannot send the message without file size value in the xml file. So now I have to go with java mapping.
Can you help me to create the java mapping code to get the output without value.
Thanks & Regards,
Lavanya.
Hi Lavanya,
Try with below java code,
import java.io.*;
import com.sap.aii.mapping.api.*;
public class GetOnlyXMLJM extends AbstractTransformation {
public void transform(TransformationInput in, TransformationOutput out) throws StreamTransformationException
{
try
{
int len = 0;
byte[] buffer = new byte[1024];
ByteArrayOutputStream baos = new ByteArrayOutputStream();
InputStream is = (InputStream) in.getInputPayload().getInputStream();
while ((len = is.read(buffer)) > 0)
{
baos.write(buffer, 0, len);
}
String str = baos.toString();
str = str.substring(str.indexOf("<"));
out.getOutputPayload().getOutputStream().write(str.getBytes());
}
catch(Exception e)
{
throw new StreamTransformation(e.getMessage());
}
}
}
//BR,
Praveen Gujjeti
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.