cancel
Showing results for 
Search instead for 
Did you mean: 

SAP XI - GS1 DespatchAdvice - issue with sh XML prefix tag

Former Member
0 Kudos

Hi all,

This concern an outbound scenario for GS1 DespatchAdvice message format.

We have to provide xml message with the sh: prefix tag in the outbound xml file like this :

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

<sh:StandardBusinessDocument xmlns:sh="http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader" xmlns:deliver="urn:ean.ucc:deliver:2" xmlns:eanucc="urn:ean.ucc:2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader ../Schemas/sbdh/StandardBusinessDocumentHeader.xsd urn:ean.ucc:2 ../Schemas/DespatchAdviceProxy.xsd">

<sh:StandardBusinessDocumentHeader>

<sh:HeaderVersion>1.0</sh:HeaderVersion>

<sh:Sender>

<sh:Identifier Authority="EAN.UCC">8654897000024</sh:Identifier>

<sh:ContactInformation>

<sh:Contact>parnter contact info.</sh:Contact>

<sh:ContactTypeIdentifier>Seller</sh:ContactTypeIdentifier>

</sh:ContactInformation>

</sh:Sender>

<sh:Receiver>

I have loaded the xsd as an external definition.

The message is ok, expecting for this <sh: prefix that I was not able to produce..

Here is the message produced by XI :

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

<StandardBusinessDocument

xmlns = "http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader"

eanucc = "urn:ean.ucc:2"

xsi = "http://www.w3.org/2001/XMLSchema-instance"

schemaLocation = "http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader ../Schemas/sbdh/StandardBusinessDocumentHeader.xsd urn:ean.ucc:2 ../Schemas/DespatchAdviceProxy.xsd"

deliver = "urn:ean.ucc:deliver:2">

<StandardBusinessDocumentHeader>

<HeaderVersion>1.0</HeaderVersion>

<Sender>

<Identifier Authority = "EAN.UCC">65464689684</Identifier>

<ContactInformation>

<Contact>myParnterSeller</Contact>

<ContactTypeIdentifier>Seller</ContactTypeIdentifier>

</ContactInformation>

</Sender>

<Receiver>

<Identifier Authority = "EAN.UCC">608549819</Identifier>

<ContactInformation>

<Contact>myPartnerBuyer</Contact>

<ContactTypeIdentifier>Buyer</ContactTypeIdentifier>

</ContactInformation>

</Receiver>

<DocumentIdentification>

<Standard>EAN.UCC</Standard>

Any idea how to generate this prefix in the tag ??

We are using SAP XI 3.0 SP19.

Any help is welcome.

Regards,

Accepted Solutions (1)

Accepted Solutions (1)

baskar_gopalakrishnan2
Active Contributor
0 Kudos

>> Any idea how to generate this prefix in the tag ??

Yes, There are 2 ways to achieve this. 1 XMLAnonymizerBean and 2. Java Mapping

Using XMLAnonymizerBean is very simple. Go to module tab of your communication channel and do the module configuration to achieve this.

If your scenario is async use this module bean first followed by standard adapter.

Parameter Name: anonymizer.acceptNamespaces

Parameter Value: http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader sh

Hope this helps.

Answers (1)

Answers (1)

stefan_grube
Active Contributor
0 Kudos

You can use XMLAnonymizerBean

/people/stefan.grube/blog/2007/02/02/remove-namespace-prefix-or-change-xml-encoding-with-the-xmlanonymizerbean

This tool is mostly used to remove namespaces and prefixes, but it also allows to add or change a prefix.

stefan_grube
Active Contributor
0 Kudos

btw: the XML structure with or without prefix is semantically identical. So you should do a test first, if the prefix is really required. In priciple it should work without prefix also.

Former Member
0 Kudos

Hi Stefan,

Thanks for the help.

I am agreee that the tag should not be mandatory, the xml message is semantically identicall, but our partner request it...

I have tried the way you suggested with the XMLAnonymizerBean module.

Using the module, it add sh prefrix to all tags, but I would only add the prefix to the tag that are part of the node StandardBusinessDocumentHeader lik in this example :

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

- <sh:StandardBusinessDocument xmlns:sh="http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader" xmlns:deliver="urn:ean.ucc:deliver:2" xmlns:eanucc="urn:ean.ucc:2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader ../Schemas/sbdh/StandardBusinessDocumentHeader.xsd urn:ean.ucc:2 ../Schemas/DespatchAdviceProxy.xsd">

- <sh:StandardBusinessDocumentHeader>

<sh:HeaderVersion>1.0</sh:HeaderVersion>

+ <sh:Sender>

+ <sh:Receiver>

+ <sh:DocumentIdentification>

</sh:StandardBusinessDocumentHeader>

- <eanucc:message>

- <entityIdentification>

<uniqueCreatorIdentification>0081563909</uniqueCreatorIdentification>

- <contentOwner>

<gln>8715365000009</gln>

</contentOwner>

</entityIdentification>

- <command>

- <eanucc:documentCommand>

- <documentCommandHeader type="ADD">

any idea how to add this tag prefix to some nodes of the message only ?

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

- <sh:StandardBusinessDocument xmlns:sh="http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader">

- <sh:StandardBusinessDocumentHeader>

<sh:HeaderVersion>1.0</sh:HeaderVersion>

+ <sh:Sender>

+ <sh:Receiver>

+ <sh:DocumentIdentification>

</sh:StandardBusinessDocumentHeader>

- <sh:message> From here sh prefix is not expected

- <sh:entityIdentification>

<sh:uniqueCreatorIdentification>0081298965</sh:uniqueCreatorIdentification>

- <sh:contentOwner>

<sh:gln>3012502620904</sh:gln>

</sh:contentOwner>

</sh:entityIdentification>

- <sh:command>

- <sh:documentCommand>

- <sh:documentCommandHeader type="ADD">

- <sh:entityIdentification>

<sh:uniqueCreatorIdentification>0081298965</sh:uniqueCreatorIdentification>

- <sh:contentOwner>

<sh:gln>3012502620904</sh:gln>

</sh:contentOwner>

</sh:entityIdentification>

stefan_grube
Active Contributor
0 Kudos

When your message does not fit to your expectation, then your xsd is wrong.

Update your xsd and upload it to PI.

Former Member
0 Kudos

Thanks for the help.

The pb is now solved. The xsd provided was not correct, there was attribute note a the correct nodes...

Regards,

David