on 04-19-2016 8:12 AM
Hello Everyone,
I have an issue with the file coming from the bank. Bank is sending the XML file with improper declaration of the XML version.
I am receiving the XML declaration in the file as below without quotes -
<?xml version= 1.0 encoding= UTF-8 ?>
Due to this, i am getting below error in my Sender File Channel -
19.04.2016 10:08:33.893 | Error | Attempt to process file failed with com.sap.aii.adapter.xi.routing.RoutingException: Unable to parse XML message payload to extract operation for receiver determinationorg.xml.sax.SAXParseException: The value following "version" in the XML declaration must be a quoted string. |
19.04.2016 10:08:33.893 | Error | MP: exception caught with cause com.sap.aii.adapter.xi.routing.RoutingException: Unable to parse XML message payload to extract operation for receiver determinationorg.xml.sax.SAXParseException: The value following "version" in the XML declaration must be a quoted string. |
19.04.2016 10:08:33.893 | Error | Returning to application. Exception: com.sap.aii.adapter.xi.routing.RoutingException: Unable to parse XML message payload to extract operation for receiver determinationorg.xml.sax.SAXParseException: The value following "version" in the XML declaration must be a quoted string. |
Ideally it should be in the below mentioned way with quotes-
<?xml version="1.0" encoding="UTF-8"?>
I know, the input file we are getting from Bank is against the XML standard, but i do not see any help from the Bank in changing the format from their end. So i have to handle it in PI now.
Does anyone have an idea to resolve this? Java mapping is the only riot or there is any better method to handle these kind of files?
Regards,
Nitin
Hi Nitin,
There is a nice blog by Roger to write custom adapter of Replace String. This can replace any data in the payload. I have deployed this in my server any used to parse some non xml data element like "data:abc / def @" etc.
Here is the link -
You can deploy this and use like below -
separator = ;
param1 = <?xml version= 1.0 encoding= UTF-8 ?>;<?xml version="1.0" encoding="UTF-8"?>
Thanks,
Apu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nitin,
Another way is to change (or remove header + add a new one) the header declaration with a OS command or batch file before the processing. This blog can be helpfulhttp://www.thelinuxrain.com/articles/the-header-line-how-to-add-delete-and-ignore-it
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
IMHO, OS command or batch scripts only make sense if it's on an NFS channel. Refer to comment in the following thread.
Hi Nitin!
In your case you can use custom adapter module to fix that issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Nitin,
If the XML is the input , to format Java mapping is best way I would suggest
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Raghu,
Thanks for your reply. But Java mapping would not be helpful i guess, as it is failing while the file is getting picked and it is not reaching the mapping step at all. I guess i need to go for development of custom adapter module for this?
There are standard adapter modules, which can handle such kind of scenarios?
Regards,
Nitin
Nitin
If this is not a multi operation service interface, you can change the sender interface to a dummy interface by removing SWCV. Then it will not parse the XML to determine the operation during Receiver Determination step. This will allow you to perform the additional "massaging" of the content using Java mapping.
Regards
Eng Swee
Hi Eng,
It is not a multiple operation interface, so i can implement your tip, thanks.
But is this the way to do it? Don't we have standard adapter modules to handle this?
XMLAnoymizerBean standard adapter module i tried, but as the parser fails to identify the document as XML, hence this module parameter is not working.
Regards,
Nitin
Hi Nitin
Unfortunately, no standard modules can help here as most of them expect a correctly formatted XML payload which is not what you have.
I normally have a general purpose custom module deployed in the system that helps to clean up any undesired input. The module basically just performs a String replaceAll() execution. But because this methods allows regex input, I can perform quite complex replacement as long as regex supports it.
Regards
Eng Swee
Hi Praveen/Eng,
There is one small problem now. I need to have multiple operation for my scenario, as there are two different formats for the response file from the bank. Which means i cannot use Java mapping and i have to go for Custom module.
Am i right or is there a way to still use Java mapping?
Regards,
Nitin
Ok understood. Looks like that limits your option since multi-operation interfaces requires parsing of the content, and unfortunately the parsing will not work due to the incorrect XML declaration.
I think custom module would be the way to go then. (I won't go for OS script as mentioned below)
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
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.