cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Issues with Message Mapping

davidg43
Newcomer
0 Kudos
368

Hi,

I am having some problems trying to use Message Mapping. I am not sure if it is the right way, but it is a step in my learning about CI.

Context: I would like to map a Business Partner element using this API: SAP Business Accelerator Hub | BAPI. Following the documentation of this API, I downloaded the EDMX file to have the correct schema of the source message.

GET request: https://sandbox.api.sap.com/s4hanacloud/sap/opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner?$to...

GET response:

 

<feed xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xml:base="https://sandbox.api.sap.com/s4hanacloud/sap/opu/odata/sap/API_BUSINESS_PARTNER/">
    <id>https://sandbox.api.sap.com/s4hanacloud/sap/opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner</id>
    <title type="text">A_BusinessPartner</title>
    <updated>2024-09-10T13:23:05Z</updated>
    <author>
        <name/>
    </author>
    <link href="A_BusinessPartner" rel="self" title="A_BusinessPartner"/>
    <entry>
        <id>https://sandbox.api.sap.com/s4hanacloud/sap/opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner('11')</id>
        <title type="text">A_BusinessPartner('11')</title>
        <updated>2024-09-10T13:23:05Z</updated>
        <category term="API_BUSINESS_PARTNER.A_BusinessPartnerType" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
        <link href="A_BusinessPartner('11')" rel="edit" title="A_BusinessPartnerType"/>
        <link href="A_BusinessPartner('11')/to_AddressIndependentEmail" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/to_AddressIndependentEmail" type="application/atom+xml;type=feed" title="to_AddressIndependentEmail"/>
        <link href="A_BusinessPartner('11')/to_AddressIndependentFax" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/to_AddressIndependentFax" type="application/atom+xml;type=feed" title="to_AddressIndependentFax"/>
        <link href="A_BusinessPartner('11')/to_AddressIndependentMobile" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/to_AddressIndependentMobile" type="application/atom+xml;type=feed" title="to_AddressIndependentMobile"/>
        <link href="A_BusinessPartner('11')/to_AddressIndependentPhone" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/to_AddressIndependentPhone" type="application/atom+xml;type=feed" title="to_AddressIndependentPhone"/>
        <link href="A_BusinessPartner('11')/to_AddressIndependentWebsite" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/to_AddressIndependentWebsite" type="application/atom+xml;type=feed" title="to_AddressIndependentWebsite"/>
        <link href="A_BusinessPartner('11')/to_BPCreditWorthiness" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/to_BPCreditWorthiness" type="application/atom+xml;type=entry" title="to_BPCreditWorthiness"/>
        <link href="A_BusinessPartner('11')/to_BPDataController" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/to_BPDataController" type="application/atom+xml;type=feed" title="to_BPDataController"/>
        <link href="A_BusinessPartner('11')/to_BPEmployment" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/to_BPEmployment" type="application/atom+xml;type=feed" title="to_BPEmployment"/>
        <link href="A_BusinessPartner('11')/to_BPFinServicesReporting" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/to_BPFinServicesReporting" type="application/atom+xml;type=entry" title="to_BPFinServicesReporting"/>
        <link href="A_BusinessPartner('11')/to_BPFiscalYearInformation" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/to_BPFiscalYearInformation" type="application/atom+xml;type=feed" title="to_BPFiscalYearInformation"/>
        <link href="A_BusinessPartner('11')/to_BPRelationship" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/to_BPRelationship" type="application/atom+xml;type=feed" title="to_BPRelationship"/>
        <link href="A_BusinessPartner('11')/to_BuPaIdentification" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/to_BuPaIdentification" type="application/atom+xml;type=feed" title="to_BuPaIdentification"/>
        <link href="A_BusinessPartner('11')/to_BuPaIndustry" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/to_BuPaIndustry" type="application/atom+xml;type=feed" title="to_BuPaIndustry"/>
        <link href="A_BusinessPartner('11')/to_BusinessPartner" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/to_BusinessPartner" type="application/atom+xml;type=entry" title="to_BusinessPartner"/>
        <link href="A_BusinessPartner('11')/to_BusinessPartnerAddress" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/to_BusinessPartnerAddress" type="application/atom+xml;type=feed" title="to_BusinessPartnerAddress"/>
        <link href="A_BusinessPartner('11')/to_BusinessPartnerAlias" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/to_BusinessPartnerAlias" type="application/atom+xml;type=feed" title="to_BusinessPartnerAlias"/>
        <link href="A_BusinessPartner('11')/to_BusinessPartnerBank" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/to_BusinessPartnerBank" type="application/atom+xml;type=feed" title="to_BusinessPartnerBank"/>
        <link href="A_BusinessPartner('11')/to_BusinessPartnerContact" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/to_BusinessPartnerContact" type="application/atom+xml;type=feed" title="to_BusinessPartnerContact"/>
        <link href="A_BusinessPartner('11')/to_BusinessPartnerIsBank" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/to_BusinessPartnerIsBank" type="application/atom+xml;type=entry" title="to_BusinessPartnerIsBank"/>
        <link href="A_BusinessPartner('11')/to_BusinessPartnerRating" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/to_BusinessPartnerRating" type="application/atom+xml;type=feed" title="to_BusinessPartnerRating"/>
        <link href="A_BusinessPartner('11')/to_BusinessPartnerRole" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/to_BusinessPartnerRole" type="application/atom+xml;type=feed" title="to_BusinessPartnerRole"/>
        <link href="A_BusinessPartner('11')/to_BusinessPartnerTax" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/to_BusinessPartnerTax" type="application/atom+xml;type=feed" title="to_BusinessPartnerTax"/>
        <link href="A_BusinessPartner('11')/to_BusPartAddrDepdntTaxNmbr" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/to_BusPartAddrDepdntTaxNmbr" type="application/atom+xml;type=feed" title="to_BusPartAddrDepdntTaxNmbr"/>
        <link href="A_BusinessPartner('11')/to_Customer" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/to_Customer" type="application/atom+xml;type=entry" title="to_Customer"/>
        <link href="A_BusinessPartner('11')/to_PaymentCard" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/to_PaymentCard" type="application/atom+xml;type=feed" title="to_PaymentCard"/>
        <link href="A_BusinessPartner('11')/to_Supplier" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/to_Supplier" type="application/atom+xml;type=entry" title="to_Supplier"/>
        <content type="application/xml">
            <m:properties xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
                <d:BusinessPartner>11</d:BusinessPartner>
                <d:Customer></d:Customer>
                <d:Supplier></d:Supplier>
                <d:AcademicTitle></d:AcademicTitle>
                <d:AuthorizationGroup></d:AuthorizationGroup>
                <d:BusinessPartnerCategory>2</d:BusinessPartnerCategory>
                <d:BusinessPartnerFullName>Cust15 Cust15</d:BusinessPartnerFullName>
                <d:BusinessPartnerGrouping>BP01</d:BusinessPartnerGrouping>
                <d:BusinessPartnerName>Cust15 Cust15</d:BusinessPartnerName>
                <d:BusinessPartnerUUID>00163e37-bedf-1ed8-9883-fe15a0b5fc9e</d:BusinessPartnerUUID>
                <d:CorrespondenceLanguage></d:CorrespondenceLanguage>
                <d:CreatedByUser>CB9980000753</d:CreatedByUser>
                <d:CreationDate>2018-05-25T00:00:00</d:CreationDate>
                <d:CreationTime>PT13H52M33S</d:CreationTime>
                <d:FirstName></d:FirstName>
                <d:FormOfAddress>0003</d:FormOfAddress>
                <d:Industry></d:Industry>
                <d:InternationalLocationNumber1>0</d:InternationalLocationNumber1>
                <d:InternationalLocationNumber2>0</d:InternationalLocationNumber2>
                <d:IsFemale>false</d:IsFemale>
                <d:IsMale>false</d:IsMale>
                <d:IsNaturalPerson></d:IsNaturalPerson>
                <d:IsSexUnknown>false</d:IsSexUnknown>
                <d:GenderCodeName></d:GenderCodeName>
                <d:Language></d:Language>
                <d:LastChangeDate m:null="true"/>
                <d:LastChangeTime>PT00H00M00S</d:LastChangeTime>
                <d:LastChangedByUser></d:LastChangedByUser>
                <d:LastName></d:LastName>
                <d:LegalForm></d:LegalForm>
                <d:OrganizationBPName1>Cust15</d:OrganizationBPName1>
                <d:OrganizationBPName2>Cust15</d:OrganizationBPName2>
                <d:OrganizationBPName3></d:OrganizationBPName3>
                <d:OrganizationBPName4></d:OrganizationBPName4>
                <d:OrganizationFoundationDate m:null="true"/>
                <d:OrganizationLiquidationDate m:null="true"/>
                <d:SearchTerm1>CUST15</d:SearchTerm1>
                <d:SearchTerm2></d:SearchTerm2>
                <d:AdditionalLastName></d:AdditionalLastName>
                <d:BirthDate m:null="true"/>
                <d:BusinessPartnerBirthDateStatus></d:BusinessPartnerBirthDateStatus>
                <d:BusinessPartnerBirthplaceName></d:BusinessPartnerBirthplaceName>
                <d:BusinessPartnerDeathDate m:null="true"/>
                <d:BusinessPartnerIsBlocked>false</d:BusinessPartnerIsBlocked>
                <d:BusinessPartnerType></d:BusinessPartnerType>
                <d:ETag>CB998000075320180525135233</d:ETag>
                <d:GroupBusinessPartnerName1></d:GroupBusinessPartnerName1>
                <d:GroupBusinessPartnerName2></d:GroupBusinessPartnerName2>
                <d:IndependentAddressID></d:IndependentAddressID>
                <d:InternationalLocationNumber3>0</d:InternationalLocationNumber3>
                <d:MiddleName></d:MiddleName>
                <d:NameCountry></d:NameCountry>
                <d:NameFormat></d:NameFormat>
                <d:PersonFullName></d:PersonFullName>
                <d:PersonNumber></d:PersonNumber>
                <d:IsMarkedForArchiving>false</d:IsMarkedForArchiving>
                <d:BusinessPartnerIDByExtSystem></d:BusinessPartnerIDByExtSystem>
                <d:BusinessPartnerPrintFormat></d:BusinessPartnerPrintFormat>
                <d:BusinessPartnerOccupation></d:BusinessPartnerOccupation>
                <d:BusPartMaritalStatus></d:BusPartMaritalStatus>
                <d:BusPartNationality></d:BusPartNationality>
                <d:BusinessPartnerBirthName></d:BusinessPartnerBirthName>
                <d:BusinessPartnerSupplementName></d:BusinessPartnerSupplementName>
                <d:NaturalPersonEmployerName></d:NaturalPersonEmployerName>
                <d:LastNamePrefix></d:LastNamePrefix>
                <d:LastNameSecondPrefix></d:LastNameSecondPrefix>
                <d:Initials></d:Initials>
                <d:BPDataControllerIsNotRequired>false</d:BPDataControllerIsNotRequired>
                <d:TradingPartner></d:TradingPartner>
            </m:properties>
        </content>
    </entry>
</feed>

 

(This content is to show you the response is totally correct and it fulfills the BusinessPartner schema)

At this point, the issue starts.

I would like to extract some data and map it to a new structure called Customer with different fields. I have tried several processes (previous XSLT) and file formats (with namespaces, without namespaces, occurrence…), but the result is always the same:

Error: com.sap.aii.utilxi.misc.api.BaseRuntimeException: The prefix "ns6" for attribute "ns6:base" associated with an element type "feed" is not bound. on the exchange: Exchange[ID-5137e447-1c8b-44a3-661d-9eb0-1725636387242-14-1], or something similar. If I monitor it, I get:

Error Details: com.sap.it.rt.adapter.http.api.exception.HttpResponseException: An internal server error occurred: Cannot produce target element /Customer. Queue has not enough values in context. Target XSD requires a value for this element, but target field mapping does not produce one. Probably the XML instance is not valid to the source XSD, or the target field mapping does not fulfill the requirement of the target XSD. The MPL ID for the failed message is: AGbetpnCjYHrOFJyHO-TDdp4a_s5.

About target XSD: 

 

<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified"
           xmlns:xs="http://www.w3.org/2001/XMLSchema">
  
  
  <xs:element name="root">
    <xs:complexType>
      <xs:sequence>
        
        <xs:element name="Customer" minOccurs="0" maxOccurs="unbounded">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="CIFEmpresa" type="xs:string" minOccurs="0"/>
              <xs:element name="CiutatClient" type="xs:string" minOccurs="0"/>
              <xs:element name="ClientExemptIVA" type="xs:boolean" minOccurs="0"/>
              <xs:element name="ClientExemptIVATercers" type="xs:boolean" minOccurs="0"/>
              <xs:element name="CodiPostalClient" type="xs:unsignedShort" minOccurs="0"/>
              <xs:element name="CompteComptable" type="xs:unsignedInt" minOccurs="0"/>
              <xs:element name="ContacteClient" type="xs:string" minOccurs="0"/>
              <xs:element name="DataBaixaClient" type="xs:date" minOccurs="0"/>
              <xs:element name="DataCreacioClient" type="xs:date" minOccurs="0"/>
              <xs:element name="DataSEPA" type="xs:date" minOccurs="0"/>
              <xs:element name="DiaDePagament1" type="xs:unsignedByte" minOccurs="0"/>
              <xs:element name="DiaDePagament2" type="xs:unsignedByte" minOccurs="0"/>
              <xs:element name="DiaDePagament3" type="xs:unsignedByte" minOccurs="0"/>
              <xs:element name="DomiciliFiscal1" type="xs:string" minOccurs="0"/>
              <xs:element name="EntitatsBancariesClient" type="xs:string" minOccurs="0"/>
              <xs:element name="EnviarAvisClient" type="xs:boolean" minOccurs="0"/>
              <xs:element name="FinalPeriodeVacancesPagament" type="xs:date" minOccurs="0"/>
              <xs:element name="FlagDocumentacioReclamar" type="xs:boolean" minOccurs="0"/>
              <xs:element name="FormaDePagament" type="xs:string" minOccurs="0"/>
              <xs:element name="GrupIRPF" type="xs:string" minOccurs="0"/>
              <xs:element name="GrupIVA" type="xs:string" minOccurs="0"/>
              <xs:element name="IDSEPA" type="xs:string" minOccurs="0"/>
              <xs:element name="IniciPeriodeVacancesPagament" type="xs:date" minOccurs="0"/>
              <xs:element name="LimitCreditClient" type="xs:unsignedShort" minOccurs="0"/>
              <xs:element name="MonedaClient" type="xs:string" minOccurs="0"/>
              <xs:element name="NomAdreçaFiscal" type="xs:string" minOccurs="0"/>
              <xs:element name="NomClient" type="xs:string" minOccurs="0"/>
              <xs:element name="ObservacionsClient" type="xs:string" minOccurs="0"/>
              <xs:element name="PaisCIF" type="xs:string" minOccurs="0"/>
              <xs:element name="PaisClient" type="xs:string" minOccurs="0"/>
              <xs:element name="ReclamacioActiva" type="xs:boolean" minOccurs="0"/>
              <xs:element name="StatusClient" type="xs:string" minOccurs="0"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
</xs:schema>

 

Moreover, I would like some extra information about this kind of mappings or any other alternative way.

[I also tried using the JSON schema provided by the API, but it threw different errors. That’s the reason why I came back to XSD schema mapping.]

Thank you very much in advance, and I hope someone can help me with this problem.

Accepted Solutions (0)

Answers (0)