Saturday, February 7, 2015

Oracle OSB: error: cos-nonambig: Content model violates the unique particle attribution rule.

My team was building schema for the OSB service and SOA-BPM processes and they all are parallely working on the schemas. After completing the schemas we start testing in osb service and process, but in the osb we are getting the following exception:

servicebus:BusinessObjects/Payment/Payment/V1/xsds/PaymentBO.xsd:157:5: error: cos-nonambig: Content model violates the unique particle attribution rule.


So this error occurs at line 157, when I checked the this line I found this:

 <xsd:complexType name="PaymentAuthMod_Type"> -------- line 157
    <xsd:sequence>
      <xsd:element ref="RqUID" minOccurs="0"/>
      <xsd:element ref="AsyncRqUID" minOccurs="0"/>
      <xsd:element ref="CustId" minOccurs="0"/>
      <xsd:element ref="Status" minOccurs="0"/>
      <xsd:element ref="EMVData" minOccurs="0"/>
      <xsd:element ref="NetworkTrnInfo" minOccurs="0"/>
      <xsd:element ref="POSData" minOccurs="0"/>
      <xsd:element ref="PmtAuthRec" minOccurs="0"/>
      <xsd:element ref="PmtAuthId" minOccurs="0" maxOccurs="unbounded"/>
      <xsd:element ref="PmtAuthRec" minOccurs="0" maxOccurs="unbounded"/>
    </xsd:sequence>
  </xsd:complexType>

Solution:

I have gone through some documentation of UPA Rule i.e. Unique Partition Attribution rule which says same element can not have more than one meaning e.g.

<xsd:sequence>
    <xsd:element name="abc" type="xsd:integer" minOccurs="0"/>
    <xsd:any minOccurs="0" maxOccurs="unbounded" />
  </xsd:sequence>

Here, there is one possibility that  xsd:any can be as a element "abc".

OR

<xsd:sequence>
    <xsd:element name="abc" type="xsd:integer" minOccurs="0"/>
    <xsd:element name="abc" minOccurs="0" maxOccurs="unbounded" />
  </xsd:sequence>


So line 157 in my schema there is one element which is repeating with different meaning i.e.

    <xsd:element ref="PmtAuthRec" " minOccurs="0"/>
    <xsd:element ref="PmtAuthRec" minOccurs="0" maxOccurs="unbounded" />


So finally I removed one of the element and it worked.

References

  • http://www.w3.org/TR/xmlschema-1/#non-ambig
  • http://en.wikipedia.org/wiki/Unique_Particle_Attribution

Wednesday, February 4, 2015

Oracle OSB 12c: ORABPEL-15235, "Failed to translate JSON to XML" when processing a JSON Message

As we know in Oracle OSB 12c we got a new rest adapter to build and expose rest service from osb. So I was working on Rest adapter in osb and expose one of the rest service which is accepting the request in JSON format and sending the response in the same format. In rest service there are many parameters to be passed as request. So while testing this service from the osb console I am getting the following exception:

Translation Failure.
Failed to translate JSON to XML. 
The incoming data does not conform to the NXSD schema. Please correct the problem.

 ORABPEL-15235

Caused by: java.lang.ArrayIndexOutOfBoundsException
at java.lang.System.arraycopy(Native Method)
at de.odysseus.staxon.base.AbstractXMLStreamReader.getTextCharacters(AbstractXMLStreamReader.java:529)
at oracle.tip.pc.services.translation.xlators.json.JsonSaxEventsGenerator.generateEvents(JsonSaxEventsGenerator.java:241)
at oracle.tip.pc.services.translation.xlators.json.JsonTranslator.translateFromNative(JsonTranslator.java:139)

Solution:

Well for this error I have found a document in oracle support which says that this is the bug in Oracle OSB 12.1.3.0 that when processing the JSON message if the size of the request is greater than 4096 then this error is thrown.
So oracle support has issued a patch to resolve this issue. Patch number is 18692809 and for more information on this please follow the Document ID 1948201.1 on Oracle Support.