Uploaded image for project: 'JBoss Web Services'
  1. JBoss Web Services
  2. JBWS-361

Marshalling xsd:base64 anomalies

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical Critical
    • jbossws-1.0Beta
    • jbossws-1.0.0
    • jbossws-native
    • None

      I have created a testcase for the marshalling of xsd:base64 in two cases- when byte[] can be passed to the marshalling layer (Regular case) or a Byte[] array is sent(DII case where primitives are prohibited).

      This case handles the two cases:

      testMarshallBase64TypeForDII [Very important]
      and
      testMarshallBase64Type [I am not sure on this one though, Thomas on Wednesday can validate this case]

      ==========================================================================================================================
      Exp: <ns1:arrayOfbyte xmlns:ns1='http://org.jboss.ws/types' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><value>Ynl0ZUFycmF5</value></ns1:arrayOfbyte>
      Was: <ns1:arrayOfbyte xmlns:ns1='http://org.jboss.ws/types' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><value>OTg=</value><value>MTIx</value><value>MTE2</value><value>MTAx</value><value>NjU=</value><value>MTE0</value><value>MTE0</value><value>OTc=</value><value>MTIx</value></ns1:arrayOfbyte>

      Exp: <ns1:arrayOfbyte xmlns:ns1='http://org.jboss.ws/types' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><value>Ynl0ZUFycmF5</value></ns1:arrayOfbyte>
      Was: <ns1:arrayOfbyte xmlns:ns1='http://org.jboss.ws/types' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><value>OTg=</value><value>MTIx</value><value>MTE2</value><value>MTAx</value><value>NjU=</value><value>MTE0</value><value>MTE0</value><value>OTc=</value><value>MTIx</value></ns1:arrayOfbyte>
      =========================================================================================================================

      Suggestions:

      I had looked at the binding code. The code relevant is SimpleTypeBindings. It expects a byte[] array in case of xsd:base64. But if it passed a Byte[], the individual Byte objects are passed on the stack. So at the time of marshalling, a Byte is returned where as the marshalling layer expects byte[].

      So I suggest check if Byte[] array is passed early on and push the whole Byte[] onto the stack and not individual elements as you do for BigDecimal, BigInteger etc. So when the time comes to marshall, check

      if(value instanceof Byte[])

      { /**handle the DII case where Byte[] array is sent as primitives are prohibited */}

      else
      if( value instanceof byte[])

      { /**handle regular case*/}

      As I mentioned, please take a look at how the value (Byte[]) get pushed onto the stack, so that stack.peek returns Byte[] and not individual Byte elements.

      I will ask Thomas on Wednesday to validate this JIRA issue, but can you please put in a temporary fix for this JIRA issue?

              olubyans@redhat.com Alexey Loubyansky
              anil.saldhana Anil Saldanha (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: