cancel
Showing results for 
Search instead for 
Did you mean: 

Adding namespace prefixes to incoming XML for Soap Sync response

Former Member
0 Kudos

Hello,

I am looking for a help that I need to insert/add a namespace prefix in incoming xml.

I have a Proxy Synchronous webservice call to thirdparty application from ECC through PI, we are getting the below reponse xml without namspace prefixes.

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

<!-- XML Validation Outbound Channel Response -->

<getUpdateListResp xmlns="http://xyz/mdm" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<item xmlns="">46000</item>

<item xmlns="">46001</item>

<item xmlns="">46002</item>

</getUpdateListResp>

I need to insert namespace prefix to the above xml as shown below:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

<!-- XML Validation Outbound Channel Response -->

<ns0:getUpdateListResp xmlns:ns0 ="http://xyz/mdm" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<ns0:item xmlns="">46000</ns0:item>

<ns0:item xmlns="">46001</ns0:item>

<ns0:item xmlns="">46002</ns0:item>

</ns0:getUpdateListResp>

I have checked the forum and blogs for AnnonymizerBean for outgoing(request) xml but I did not see how to alter incoming xml

Appriciate your help on this?

Thanks,

Laxman

Accepted Solutions (0)

Answers (2)

Answers (2)

stefan_grube
Active Contributor
0 Kudos

> I have checked the forum and blogs for AnnonymizerBean for outgoing(request) xml but I did not see how to alter incoming xml

You can put the XMLAnnnymizerBean after the standard module, then it works on the response message.

If you do mapping for the response, you need not add the prefixes, as the XML is semantically identical.

Former Member
0 Kudos

Hi Stefan,

I don't have any mapping program as PI sending the response back to ECC Proxy.

Can you explain how to use this module?

I tried with few different ways but got errors

Thanks,

Laxman

Former Member
0 Kudos

Hi Stefan,

I am partially able to add prefix to the XML.

Here what I did for Module Configuration:

1. Added Module AF_Modules/XMLAnonymizerBean after std module in Soap Receiver Adapter

2. Parameter Name: anonymizer.acceptNamespaces

Parameter Value : http://xyz/mdm ns0

Below is the reponse xml with namespace prefix only in the root tag, no prefix for child tags.

<?xml version='1.0' encoding='utf-8'?>

<ns0:getUpdateListResp xmlns:ns0='http://xyz/mdm'>

<item>46246</item>

<item>46247</item>

<item>46248</item>

</ns0:getUpdateListResp>

How do I get the namespace prefix to all the tags in the XML?

Thanks,

Laxman

stefan_grube
Active Contributor
0 Kudos

In your original payload you have a tag:

<item xmlns="">46000<item>

This means that this item has no namespace. the xmlns="" attributes removes namespace from parent node.

when you add a prefix like this:

<ns0:item xmlns="">46000</ns0:item>

it does not really make sense.

When your ECC proxy is created from same WSDL, then it should work with the XML response structure.

If not, you should add a mapping.

laxman_molugu
Participant
0 Kudos

Hi Stefan,

I guess the attribute xmlns="" is the culprit of the issue. Do you have any idea how to remove this attribute from each tag of the xml. with this empty attribute even mapping programs is failing to map/

Thanks,

Laxman

stefan_grube
Active Contributor
0 Kudos

Did you create the mapping program based on the WSDL?

Then it should not be an issue.

XMLNS="" is a valid XML term.

laxman_molugu
Participant
0 Kudos

Hi Stefan,

Yes, I have created all the Interface objects with the WSDL only.

I tried again its the same issue.

I have tested the mapping program from ESR Mapping test Tab, when I copy the xml (webservice Response) into Test tab and run then its simply ignoring all the xml tags where it has xmlns=''. And I tried taking this attribute from the xml then mapping program reads every tag and maps to the target structure.

Please let me know if I am still missing anything.

Thanks,

Laxman

Former Member
0 Kudos

Make sure you have given the namespace declaration in 'XML Namespace' tab in your response MT.

Former Member
0 Kudos

Hi Nagarjuna,

I am not using Message Types but we are using WSDL as External Def so there is no way I can add this attribute.

Thanks,

Laxman