cancel
Showing results for 
Search instead for 
Did you mean: 

XML Version declaration with quotes

nitindeshpande
Active Contributor
0 Kudos

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.893ErrorAttempt 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.893ErrorMP: 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.893ErrorReturning 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

Accepted Solutions (1)

Accepted Solutions (1)

apu_das2
Active Contributor
0 Kudos

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

nitindeshpande
Active Contributor
0 Kudos

Hello Apu,

Thanks for the link. I will implement the same and this must fix the issue.

Regards,

Nitin

Answers (3)

Answers (3)

iaki_vila
Active Contributor
0 Kudos

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

engswee
Active Contributor
0 Kudos

IMHO, OS command or batch scripts only make sense if it's on an NFS channel. Refer to comment in the following thread.

Re: Archiving Empty Flies in SFTP

former_member190293
Active Contributor
0 Kudos

Hi Nitin!

In your case you can use custom adapter module to fix that issue.

former_member186851
Active Contributor
0 Kudos

Hello Nitin,

If the XML is the input , to format Java mapping is best way I would suggest

nitindeshpande
Active Contributor
0 Kudos

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

engswee
Active Contributor
0 Kudos

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

former_member182412
Active Contributor
0 Kudos

Hi Nitin,

Another two options.

  • If you define the service interface with interface pattern "Stateless (XI30-Compatible)" then it will reach mapping step.

  • Remove the software component from ICO under inbound processing tab.

Regards,

Praveen.

nitindeshpande
Active Contributor
0 Kudos

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

nitindeshpande
Active Contributor
0 Kudos

Hi Praveen,

Thanks a lot for the tips, i will try them out.

Is there any standard adapter modules which can handle this? Looking to save some efforts and overhead in transmission.

Regards,

Nitin

engswee
Active Contributor
0 Kudos

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

former_member186851
Active Contributor
0 Kudos

Eng,

In this kind of requirement Java mapping or Custom module is best?

Which wont do you prefer?

engswee
Active Contributor
0 Kudos

Personally I would go for a custom module that is reusable so that it solves this case and future cases as well.

nitindeshpande
Active Contributor
0 Kudos

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

engswee
Active Contributor
0 Kudos

Hi Nitin

Any reason for having multiple operations? Is the bank sending via a single SOAP channel?

If not, and you still prefer to go with Java mapping approach, you can split it into two sender interfaces instead of 1 multi-operation interface.

Regards

Eng Swee

nitindeshpande
Active Contributor
0 Kudos

Hello Eng,

The 2 different structured file needs to be picked up from the same folder and the file names are similar.

And i cannot judge when i would get which type of file structure. I have to use multiple operation to handle this.

Regards,

Nitin

engswee
Active Contributor
0 Kudos

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)