cancel
Showing results for 
Search instead for 
Did you mean: 

JSON to XML conversion fails on namespace (prefix)

Dimitri
Active Contributor
0 Kudos

Hi,

I'm facing a JSON to XML conversion problem in my receiver REST adapter, for my response message in a synchronous scenario.

My Message Mapping expects Namespaces and namespaces prefix. They come via the XSD I received from the 3rd party. When the JSON response enters the SAP PO system, it does not contain any namespace or namespace prefix. So, the message mapping fails.

How can I handle such a scenario? Is this feasible?

Thanks a lot.
Dimitri

Accepted Solutions (1)

Accepted Solutions (1)

Ryan-Crosby
Active Contributor
0 Kudos

Hi Dimitri,

Weird that I cannot comment upon your comment so I will respond here. In the ESR open the external definition and export it to a file from the WSDL tab. Use any text editor and insert the exact text elementFormDefault="unqualified" into the schema or change the value from qualified to unqualified if it already exists and save. Re-import the .wsdl file for the external definition and the system should evaluate the message without the namespace and prefix information in the root XML.

Regards,

Ryan Crosby

Dimitri
Active Contributor
0 Kudos

Hi Ryan,

I did the change and imported the WSDL again:

I did the change completely in the beginning: <wsdl:definitions name=xxx all namespaces here elementFormDefault="unqualified">

EDIT: I see a related XSD containing this element with value qualified. I will change that and test. Keep you posted.

Kind regards,
Dimitri

Ryan-Crosby
Active Contributor
0 Kudos

Hi Dimitri,

You would want to add that attribute to the schema element of the WSDL file only.

Regards,

Ryan Crosby

Dimitri
Active Contributor

Ryan, you are a HERO! Thanks a lot.

PS: now, my XSLT mapping is also working properly.

Ryan-Crosby
Active Contributor
0 Kudos

Glad to be of help 😄

Answers (1)

Answers (1)

Ryan-Crosby
Active Contributor
0 Kudos

Hi Dimitri,

The response comes from the 3rd party system? The .xsd that you have imported is a representation of the message type? In the past I have seen a few options that may help depending on the overall configuration setup for the integration:

1. Remove the targetNamespace designation from the message type

2. Extract the .wsdl definition and alter the schema element to include the designation elementFormDefault="unqualified" and re-import

3. Introduce XSLT mapping to insert namespace and prefixes where appropriate

Regards,

Ryan Crosby

Dimitri
Active Contributor
0 Kudos

Hi Ryan,

Yes. Correct. Response is being received from 3rd party. No Message Type is involved. External Definition is directly used.

1. not an option because no MT
2. interesting. Do you have more information?
3. I tried that. In the Operation Mapping, before the response Message Mapping, but that does not seems to have any effect

Kind regards,
Dimitri