Re: GS1 XML implementation

Home Page Forums BizTalk 2004 – BizTalk 2010 GS1 XML implementation Re: GS1 XML implementation

#25418

Hi,

 

Here is the code of the proxy with SBDH, I called it InvoiceProxy_plusSBDH.xsd:

 

<?xml version=”1.0″ encoding=”UTF-8″?>
<xsd:schema xmlns:xsd=”http://www.w3.org/2001/XMLSchema&#8221; xmlns:ns1=”http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader&#8221; targetNamespace=”urn:ean.ucc:2″>
    <xsd:import namespace=”http://www.w3.org/2000/09/xmldsig#&#8221; schemaLocation=”xmldsig/xmldsig-core-schema.xsd”/>
    <xsd:import namespace=”urn:ean.ucc:order:2″ schemaLocation=”ean.ucc/order/OrderLogisticalInformation.xsd”/>
    <xsd:import namespace=”urn:ean.ucc:pay:2″ schemaLocation=”ean.ucc/pay/Invoice.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/AccountNumberTypeList.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/AdditionalPartyIdentificationList.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/AdditionalTradeItemIdentificationList.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/AllowanceChargeList.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/AllowanceOrChargeList.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/Command.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/CommunicationChannelCodeList.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/Contact.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/Country.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/CurrencyExchangeRateInformation.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/Description.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/DigitalSignature.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/Document.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/DocumentCommand.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/DocumentCommandList.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/DocumentLineReference.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/DocumentOrDocumentLineReference.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/DocumentReference.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/DocumentStatusList.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/EntityIdentification.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/Extension.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/FinancialInstitutionInformation.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/MeasurementUnitCode.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/Message.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/MonetaryAmount.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/NameAndAddress.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/PartyIdentification.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/PaymentFormatList.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/PaymentMethod.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/PaymentMethodList.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/PaymentTerms.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/PaymentTermsEventList.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/PaymentTermsTypeList.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/Percentage.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/Quantity.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/ResponseStatusList.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/ServiceLevelCodeList.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/ShipmentSpecialHandlingCodeList.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/ShipmentTransportationInformation.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/TimePeriod.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/TimePeriodList.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/TradeItemIdentification.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/Transaction.xsd”/>
    <xsd:include schemaLocation=”ean.ucc/common/TransportationMethodTypeCodeList.xsd”/>
    <xsd:import namespace=”http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader&#8221; schemaLocation=”sbdh\BasicTypes.xsd”/>
    <xsd:import namespace=”http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader&#8221; schemaLocation=”sbdh\BusinessScope.xsd”/>
    <xsd:import namespace=”http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader&#8221; schemaLocation=”sbdh\DocumentIdentification.xsd”/>
    <xsd:import namespace=”http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader&#8221; schemaLocation=”sbdh\Manifest.xsd”/>
    <xsd:import namespace=”http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader&#8221; schemaLocation=”sbdh\Partner.xsd”/>
    <xsd:import namespace=”http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader&#8221; schemaLocation=”sbdh\StandardBusinessDocumentHeader.xsd”/>
</xsd:schema>

You can use this one to generate the instance file. I use XML Spy and there are some issues with that tool (we tried to work it out with Altova, but the bug keeps coming back), so in the instance I removed the second schema declaration – in the element <pay:invoice…>, to maker it work. Perhaps you’ll be able to leave it as in the example if you use other tool. The file generation is rather cumbersome, because Spy cannot do it totally automatically with that design, but it works. I used the existing instance to make it quicker, but it can be done from scratch as well.

Do not get discouraged, we are really working on making this simpler to implement. This design was created 8 years ago and back then seemed like a good idea, but when people started to implement it on a bigger scale, we realized how confusing it sometimes is.

Here is the code of the sample Invoice.xml based on the modified proxy:

<?xml version=”1.0″ encoding=”UTF-8″?>
<sh:StandardBusinessDocument xmlns:sh=”http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader&#8221; xmlns:eanucc=”urn:ean.ucc:2″ xmlns:pay=”urn:ean.ucc:pay:2″ xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance&#8221; xsi:schemaLocation=”urn:ean.ucc:2 ../Schemas/InvoiceProxy_plusSBDH.xsd”>
    <sh:StandardBusinessDocumentHeader>
        <sh:HeaderVersion>1.0</sh:HeaderVersion>
        <sh:Sender>
            <sh:Identifier Authority=”EAN.UCC”>8712345678913</sh:Identifier>
            <sh:ContactInformation>
                <sh:Contact>John Doe</sh:Contact>
                <sh:EmailAddress>[email protected]</sh:EmailAddress>
                <sh:FaxNumber>+1-212-555-1213</sh:FaxNumber>
                <sh:TelephoneNumber>+1-212-555-2122</sh:TelephoneNumber>
                <sh:ContactTypeIdentifier>Seller</sh:ContactTypeIdentifier>
            </sh:ContactInformation>
        </sh:Sender>
        <sh:Receiver>
            <sh:Identifier Authority=”EAN.UCC”>8812345678903</sh:Identifier>
            <sh:ContactInformation>
                <sh:Contact>Mary Smith</sh:Contact>
                <sh:EmailAddress>[email protected]</sh:EmailAddress>
                <sh:FaxNumber>+1-312-555-1214</sh:FaxNumber>
                <sh:TelephoneNumber>+1-312-555-2125</sh:TelephoneNumber>
                <sh:ContactTypeIdentifier>Buyer</sh:ContactTypeIdentifier>
            </sh:ContactInformation>
        </sh:Receiver>
        <sh:DocumentIdentification>
            <sh:Standard>EAN.UCC</sh:Standard>
            <sh:TypeVersion>2.4</sh:TypeVersion>
            <sh:InstanceIdentifier>100002</sh:InstanceIdentifier>
            <sh:Type>Invoice</sh:Type>
            <sh:MultipleType>false</sh:MultipleType>
            <sh:CreationDateAndTime>2004-04-05T11:00:00.000-05:00</sh:CreationDateAndTime>
        </sh:DocumentIdentification>
    </sh:StandardBusinessDocumentHeader>
    <eanucc:message>
        <entityIdentification>
            <uniqueCreatorIdentification>MSG-123-20040110</uniqueCreatorIdentification>
            <contentOwner>
                <gln>8712345678913</gln>
            </contentOwner>
        </entityIdentification>
        <eanucc:transaction>
            <entityIdentification>
                <uniqueCreatorIdentification>TRA-041-66573058</uniqueCreatorIdentification>
                <contentOwner>
                    <gln>8712345678913</gln>
                </contentOwner>
            </entityIdentification>
            <command>
                <eanucc:documentCommand>
                    <documentCommandHeader type=”ADD”>
                        <entityIdentification>
                            <uniqueCreatorIdentification>CMD-912-54618595</uniqueCreatorIdentification>
                            <contentOwner>
                                <gln>8712345678913</gln>
                            </contentOwner>
                        </entityIdentification>
                    </documentCommandHeader>
                    <documentCommandOperand>
                        <pay:invoice creationDateTime=”2004-04-05T11:00:00.000-05:00″ documentStatus=”ORIGINAL”>
                            <contentVersion>
                                <versionIdentification>2.4</versionIdentification>
                            </contentVersion>
                            <documentStructureVersion>
                                <versionIdentification>2.4</versionIdentification>
                            </documentStructureVersion>
                            <invoiceIdentification>
                                <uniqueCreatorIdentification>2005001</uniqueCreatorIdentification>
                                <contentOwner>
                                    <gln>8712345678913</gln>
                                </contentOwner>
                            </invoiceIdentification>
                            <invoiceCurrency>
                                <currencyISOCode>EUR</currencyISOCode>
                            </invoiceCurrency>
                            <invoiceType>INVOICE</invoiceType>
                            <countryOfSupplyOfGoods>
                                <countryISOCode>NL</countryISOCode>
                            </countryOfSupplyOfGoods>
                            <remitTo>
                                <partyIdentification>
                                    <gln>8712345679230</gln>
                                </partyIdentification>
                            </remitTo>
                            <buyer>
                                <partyIdentification>
                                    <gln>8812345678903</gln>
                                </partyIdentification>
                            </buyer>
                            <seller>
                                <partyIdentification>
                                    <gln>8712345678913</gln>
                                </partyIdentification>
                            </seller>
                            <invoiceLineItem number=”1″>
                                <tradeItemIdentification>
                                    <gtin>08712345678906</gtin>
                                </tradeItemIdentification>
                                <invoicedQuantity>
                                    <value>50.00</value>
                                </invoicedQuantity>
                                <transferOfOwnershipDate>2005-06-24</transferOfOwnershipDate>
                                <amountInclusiveAllowancesCharges>500.00</amountInclusiveAllowancesCharges>
                                <itemPriceInclusiveAllowancesCharges>10.00</itemPriceInclusiveAllowancesCharges>
                                <despatchAdvice>
                                    <documentReference>
                                        <uniqueCreatorIdentification>200506001</uniqueCreatorIdentification>
                                        <contentOwner>
                                            <gln>8712345678913</gln>
                                        </contentOwner>
                                    </documentReference>
                                </despatchAdvice>
                            </invoiceLineItem>
                            <invoiceLineItem number=”2″>
                                <tradeItemIdentification>
                                    <gtin>08712345678883</gtin>
                                </tradeItemIdentification>
                                <invoicedQuantity>
                                    <value>10.00</value>
                                </invoicedQuantity>
                                <transferOfOwnershipDate>2005-06-24</transferOfOwnershipDate>
                                <amountInclusiveAllowancesCharges>150.00</amountInclusiveAllowancesCharges>
                                <itemPriceInclusiveAllowancesCharges>15.00</itemPriceInclusiveAllowancesCharges>
                                <despatchAdvice>
                                    <documentReference>
                                        <uniqueCreatorIdentification>200506001</uniqueCreatorIdentification>
                                        <contentOwner>
                                            <gln>8712345678913</gln>
                                        </contentOwner>
                                    </documentReference>
                                </despatchAdvice>
                            </invoiceLineItem>
                            <invoiceTotals>
                                <totalInvoiceAmount>600.00</totalInvoiceAmount>
                                <totalAmountInvoiceAllowancesCharges>50.00</totalAmountInvoiceAllowancesCharges>
                                <totalLineAmountInclusiveAllowancesCharges>650.00</totalLineAmountInclusiveAllowancesCharges>
                            </invoiceTotals>
                            <invoiceAllowanceCharge>
                                <invoiceAllowanceChargeAmount>100.00</invoiceAllowanceChargeAmount>
                                <invoiceAllowanceChargeType>ALLOWANCE_GLOBAL</invoiceAllowanceChargeType>
                                <invoiceAllowanceOrChargeType>ALLOWANCE</invoiceAllowanceOrChargeType>
                            </invoiceAllowanceCharge>
                            <invoiceAllowanceCharge>
                                <invoiceAllowanceChargeAmount>50.00</invoiceAllowanceChargeAmount>
                                <invoiceAllowanceChargeType>CHARGE_GLOBAL</invoiceAllowanceChargeType>
                                <invoiceAllowanceOrChargeType>CHARGE</invoiceAllowanceOrChargeType>
                            </invoiceAllowanceCharge>
                            <paymentTerms paymentTermsEvent=”DATE_OF_INVOICE” paymentTermsType=”DISCOUNT”>
                                <discountPayment discountType=”Payment within 30 days”>
                                    <paymentTimePeriod>
                                        <timePeriodDue timePeriod=”DAYS”>
                                            <value>30</value>
                                        </timePeriodDue>
                                    </paymentTimePeriod>
                                    <discountPercent>1.00</discountPercent>
                                </discountPayment>
                            </paymentTerms>
                        </pay:invoice>
                    </documentCommandOperand>
                </eanucc:documentCommand>
            </command>
        </eanucc:transaction>
    </eanucc:message>
</sh:StandardBusinessDocument>

 

Ewa