6 Replies Latest reply: Jan 20, 2011 11:49 AM by Mikereiche-Oracle RSS

    ODSI fully qualifies each element in message response

    789260
      Hi , we are currently developing a lot of data services using ODSI 10gR3, we expose these data services as a SOAP web services using service maps and WS interfaces offered by the product.
      This works very well for us, but we noticed that ODSI is fully qualifying each element in the response by appending a namespace to each element rather then make a definition once and referencing it in a response.
      Since we return a lot of data and in complex structures the message size dramatically increases.
      We have calculated that by referencing namespaces rather than defining them all a time, we could save around 50% of the message size.

      __Is there a recommended way in ODSI to avoid the definition of the namespace with each element in the response, and define only once?__

      Thanks Peter

      Example of the response

      <CODE>
      <ns0:ProducerProfile>
      <ns3:Producer xmlns:ns3="http://somecompany.com/schemas/cim/party/partyrole/producer/producerprofile">
      <ns4:ProducerId xmlns:ns4="http://somecompany.com/schemas/cim/party/partyrole/producer/producer">990476219</ns4:ProducerId>
      </ns3:Producer>
      <ns3:Name xmlns:ns3="http://somecompany.com/schemas/cim/party/partyrole/producer/producerprofile">
      <ns5:FirstNm xmlns:ns5="http://somecompany.com/schemas/cim/party/name">EUGENE</ns5:FirstNm>
      <ns5:LastNm xmlns:ns5="http://somecompany.com/schemas/cim/party/name">KENDOW</ns5:LastNm>
      <ns5:NameType xmlns:ns5="http://somecompany.com/schemas/cim/party/name">
      <ns6:NameTypeCd xmlns:ns6="http://somecompany.com/schemas/cim/party/nametype">LEGAL</ns6:NameTypeCd>
      </ns5:NameType>
      </ns3:Name>
      <ns3:ProducerStatus xmlns:ns3="http://somecompany.com/schemas/cim/party/partyrole/producer/producerprofile">
      <ns7:ProducerStatusCd name="TERM" xmlns:ns7="http://somecompany.com/schemas/cim/party/partyrole/producer/producerstatus">16</ns7:ProducerStatusCd>
      </ns3:ProducerStatus>
      <ns3:ProducerTitle xmlns:ns3="http://somecompany.com/schemas/cim/party/partyrole/producer/producerprofile">
      <ns8:ProducerTItleCd name="AGENT" xmlns:ns8="http://somecompany.com/schemas/cim/party/partyrole/producer/producertitle">0A</ns8:ProducerTItleCd>
      </ns3:ProducerTitle>
      <ns3:OrganizationUnit xmlns:ns3="http://somecompany.com/schemas/cim/party/partyrole/producer/producerprofile">
      <ns9:OrganizationUnitCd name=" GENERAL OFFICE" xmlns:ns9="http://somecompany.com/schemas/cim/party/common/organizationunit">D16</ns9:OrganizationUnitCd>
      </ns3:OrganizationUnit>
      <ns3:ProducerRole xmlns:ns3="http://somecompany.com/schemas/cim/party/partyrole/producer/producerprofile">
      <ns10:ProducerRoleCd name="ORIGINAL AGENT" xmlns:ns10="http://somecompany.com/schemas/cim/party/partyrole/producer/producerrole">OA</ns10:ProducerRoleCd>
      </ns3:ProducerRole>
      </ns0:ProducerProfile>
      <ns0:ProducerProfile>
      <ns3:Producer xmlns:ns3="http://somecompany.com/schemas/cim/party/partyrole/producer/producerprofile">
      <ns4:ProducerId xmlns:ns4="http://somecompany.com/schemas/cim/party/partyrole/producer/producer">0974750</ns4:ProducerId>
      </ns3:Producer>
      <ns3:Name xmlns:ns3="http://somecompany.com/schemas/cim/party/partyrole/producer/producerprofile">
      <ns5:FirstNm xmlns:ns5="http://somecompany.com/schemas/cim/party/name">ROBERT</ns5:FirstNm>
      <ns5:MiddleNm xmlns:ns5="http://somecompany.com/schemas/cim/party/name">JAMES</ns5:MiddleNm>
      <ns5:LastNm xmlns:ns5="http://somecompany.com/schemas/cim/party/name">SMITH</ns5:LastNm>
      <ns5:NameType xmlns:ns5="http://somecompany.com/schemas/cim/party/name">
      <ns6:NameTypeCd xmlns:ns6="http://somecompany.com/schemas/cim/party/nametype">LEGAL</ns6:NameTypeCd>
      </ns5:NameType>
      </ns3:Name>
      <ns3:ProducerStatus xmlns:ns3="http://somecompany.com/schemas/cim/party/partyrole/producer/producerprofile">
      <ns7:ProducerStatusCd name="ACTIVELY SELLING" xmlns:ns7="http://somecompany.com/schemas/cim/party/partyrole/producer/producerstatus">01</ns7:ProducerStatusCd>
      </ns3:ProducerStatus>
      <ns3:ProducerTitle xmlns:ns3="http://somecompany.com/schemas/cim/party/partyrole/producer/producerprofile">
      <ns8:ProducerTItleCd name="AGENT" xmlns:ns8="http://somecompany.com/schemas/cim/party/partyrole/producer/producertitle">0A</ns8:ProducerTItleCd>
      </ns3:ProducerTitle>
      <ns3:OrganizationUnit xmlns:ns3="http://somecompany.com/schemas/cim/party/partyrole/producer/producerprofile">
      <ns9:OrganizationUnitCd name="OKLAHOMA CITY GENERAL OFFICE" xmlns:ns9="http://somecompany.com/schemas/cim/party/common/organizationunit">D16</ns9:OrganizationUnitCd>
      </ns3:OrganizationUnit>
      <ns3:ProducerRole xmlns:ns3="http://somecompany.com/schemas/cim/party/partyrole/producer/producerprofile">
      <ns10:ProducerRoleCd name="PERMANENT SERVICING AGENT" xmlns:ns10="http://somecompany.com/schemas/cim/party/partyrole/producer/producerrole">PA</ns10:ProducerRoleCd>
      </ns3:ProducerRole>
      </ns0:ProducerProfile><CODE/>
        • 1. Re: ODSI fully qualifies each element in message response
          Mikereiche-Oracle
          I hear ya. But there is no way to control where ODSI defines the prefixes, sorry.
          • 3. Re: ODSI fully qualifies each element in message response
            832507
            Hi!
            It actually depends on how you design your xsd schema and how the tags are "structured" in the data service. We had similar issues before and corrected it by modifying the XSD/ the source code. If the node and the child elements are inserted in the "source code" with the same prefix you will avoid the problem.

            This works fine:
            ...
            for $DebtSpecification in rek2:getDebtSpecification()
            where $Case/casN:CaseId eq $DebtSpecification/deb:CaseId
            return               
            <ns1:DebtSpecification>
            <ns1:CaseId>{fn:data($DebtSpecification/deb:CaseId)}</ns1:CaseId>
            <ns1:SequenceNumber>{fn:data($DebtSpecification/deb:SequenceNumber)}</ns1:SequenceNumber>
            ...

            This will not:
            ...
                 for $InterestRate in int:getLatestRate('D')
                      return
            <cas:InterestRateDetails?>
            <ns6:RateClass>{fn:data($InterestRate/ns6:RateClass)}</ns6:RateClass>
            <ns6:StartDate>{fn:data($InterestRate/ns6:StartDate)}</ns6:StartDate>
            ...

            Cheers,
            // Mikael
            • 4. Re: ODSI fully qualifies each element in message response
              Mikereiche-Oracle
              Mikael - what did you change in the xsd?
              • 5. Re: ODSI fully qualifies each element in message response
                832507
                Hi Mike!
                No magic really. As long as the parent node is part of the same schema and namespace, the qualified name is added to the node and not the elemens within. My example above (the one that works) is part of the same namespace, defined as:

                <complexType name="DebtSpecificationsType">
                <sequence maxOccurs="unbounded" minOccurs="0">
                <element name="DebtSpecification" type="tns:DebtSpecificationType"/>
                </sequence>
                </complexType>

                <complexType name="DebtSpecificationType">
                <sequence>
                <element name="CaseId" type="int"/>
                <element name="SequenceNumber" type="int" minOccurs="0"/>
                ...

                The problem in the initial "post" seem to be that the root node is not part of any namespace. And further, the included elements come from various "objects", all with different namespace. The solution would be to specify the output from the data service in a new XSD schema referencing the original elements, "a wrapper schema". A service returning an object of the type below will have the namespace assigned to "top" elements. Something like this:

                <?xml version="1.0" encoding="UTF-8"?>
                <schema targetNamespace="http://mycomp.com/logical/ServiceResult/v1" elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema"
                xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://mycomp.com/logical/ServiceResult/v1" xmlns:Q1="http://mycomp.com/logical/GenericTypes/ErrorTypes/v1">

                <xs:import schemaLocation="GenericTypes/ErrorTypes.xsd" namespace="http://mycomp.com/logical/GenericTypes/ErrorTypes/v1"></xs:import>

                <element name="CODE">
                <complexType>
                <sequence>
                <element name="ProducerProfile" minOccurs="0" maxOccurs="unbounded">
                <complexType>
                <sequence>
                <element name="MyElement1" type="tns:ResponseCodeType" />
                <element name="MyElement2" type="xs:string" />
                ...

                Good luck!
                // Mikael

                Edited by: user7316980 on 2011-jan-20 00:24

                Edited by: user7316980 on 2011-jan-20 00:41
                • 6. Re: ODSI fully qualifies each element in message response
                  Mikereiche-Oracle
                  As long as the parent node is part of the same schema and namespace
                  Right. But one doesn't always have the flexibility to change the schema. If the schema dictates that it is not part of the same namespace, there's no way to have the prefix defined on the parent node instead of being repeated on every child node. XmlBeans has an XmlOption which would do it (setSaveAggressiveNamespaces() - it makes a second pass on the xml document) - but this serialization is not done by xmlbeans.

                  Also - the serialization for dataservices exposed via webservices is different than those that are not.