cancel
Showing results for 
Search instead for 
Did you mean: 

Unexpected namespace change after mapping change

Former Member
0 Kudos

Unexpected namespace change after mapping change

Posted: Apr 18, 2006 5:17 AM Reply

Hi all

We developped a mapping about one year ago on XI SP9.

The source of the message was an Idoc and the target an XML sample (and not a xsd!) of what our customer expected.

Everything was working fine at that point.

Here is an extract of the output we had:

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

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/ http://schemas.xmlsoap.org/soap/envelope/">;

<env:Header xmlns:p="http://localhost/webs/msgDetails.xsd">

<p:msgDetails xmlns:p="http://localhost/webs/msgDetails.xsd">

<p:sender>

<p:senderId>XXX</p:senderId>

<p:senderName>AUSTRALIA/NEW ZEALAND</p:senderName>

</p:sender>

...

We are now running SP14 and we had to change the mapping. Since we changed it the namespaces defined in the sample XML we use as a target structure are not used anymore, instead they are replaced by ns0, ns1...

Now the output looks like this:

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

<ns0:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.w3.org/2001/XMLSchema-instance" ns1:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/ http://schemas.xmlsoap.org/soap/envelope/">;

<ns0:Header>

<ns2:msgDetails xmlns:p="http://localhost/webs/msgDetails.xsd" xmlns:ns2="http://localhost/webs/msgDetails.xsd">

<ns2:sender>

<ns2:senderId>21873</ns2:senderId>

<ns2:senderName>XXX</ns2:senderName>

</ns2:sender>

...

Any idea what has happened here?

Thanks in advance

Gregory

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Gregory,

after a short view I would say that the two structures you have posted are logically equivalent.

I try to make it clear for the sender-element.

In the first example you have a tag <p:sender>. Obviously the namespace prefix 'p' is used here. In order to find out the qualified name of the element represented by that tag you have to find the namespace declaration for prefix p. As the tag itself does not contain such a declaration you have to go to the parent-tag. Indeed, here you find a declaration for p which says that p is just an alias for 'http://localhost/webs/msgDetails.xsd'. Hence the qualified name for the element is: 'sender' in namespace 'http://localhost/webs/msgDetails.xsd'.

Now let us look at the corresponding tag <ns2:sender> in the second document. In oder to identify the qualified name of the element you have to find out, which namespace is bound to the namespace prefix ns2 which has been used here. Again you cannot find this in the tag itself but in its parent. Here you find that ns2 is bound to 'http://localhost/webs/msgDetails.xsd'. (Indeed, here you see that prefix p is also bound to that namespace. This seems to be superfluous to me, as the prefix is never used.)

Consequently, the qualified name of that element is: 'sender' in namespace 'http://localhost/webs/msgDetails.xsd'.

Thus, both tags represent elements with the same qualified name. For more details look at http://www.w3.org/TR/REC-xml-names/.

Greetings Stephan

Former Member
0 Kudos

Hi Stephan

Thanks for your answer.

I agree, both messages are logically equivalent, however my partner won't accept those new prefixes.

I was curious to know if the fact we moved to SP14 had an impact somehow to the way prefixes are handled? There must be a way of getting rid of these default prefixes!

Gregory

Former Member
0 Kudos

Hi Gregory,

I don't know whether this change has to do with the upgrade to SP14. In fact no developper at SAP XI will care about changing namespace prefixes, as such a change is compatible according to the xml namespace standard.

I think you should try to convince your partner that he should be compliant to well established standards.

Greetings Stephan

Answers (0)