Package org.jboss.ws.core.jaxrpc.binding.jbossxb

Examples of org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBUnmarshallerImpl


   private JBossXBUnmarshaller unmarshaller;

   public JBossXBDeserializer() throws BindingException
   {
      // Get the JAXB marshaller for complex objects
      unmarshaller = new JBossXBUnmarshallerImpl();
   }
View Full Code Here


   private JBossXBUnmarshaller unmarshaller;

   public JBossXBDeserializer() throws BindingException
   {
      // Get the JAXB marshaller for complex objects
      unmarshaller = new JBossXBUnmarshallerImpl();
   }
View Full Code Here

   public void testUnmarshallArrayType() throws Exception
   {
      XSModel model = generateSchemaXSModel(xmlType, Calendar[].class);

      Calendar[] objArr = null;
      JBossXBUnmarshallerImpl unmarshaller = new JBossXBUnmarshallerImpl();
      unmarshaller.setProperty(JBossXBConstants.JBXB_XS_MODEL, model);
      unmarshaller.setProperty(JBossXBConstants.JBXB_ROOT_QNAME, xmlName);
      unmarshaller.setProperty(JBossXBConstants.JBXB_TYPE_QNAME, xmlType);
      unmarshaller.setProperty(JBossXBConstants.JBXB_JAVA_MAPPING, getJavaWSDLMapping());

      String xml = "<ns1:arrayOfCalendar xmlns:ns1='" + TARGET_NAMESPACE + "'>" + " <value>1968-06-16T14:23:55.000Z</value>"
            + " <value>1969-07-17T15:24:56.000Z</value>" + " <value>1970-08-18T16:25:57.000Z</value>" + "</ns1:arrayOfCalendar>";

      objArr = (Calendar[]) unmarshaller.unmarshal(new ByteArrayInputStream(xml.getBytes()));

      assertNotNull("Resulting obj array cannot be null", objArr);
      assertEquals("Unexpected array length", 3, objArr.length);

      Calendar cal1 = new GregorianCalendar(1968, 5, 16, 14, 23, 55);
View Full Code Here

   {
      XSModel model = generateSchemaXSModel(xmlType, BigDecimal[].class);

      BigDecimal[] objArr = null;
      // Get the JAXB marshaller
      JBossXBUnmarshallerImpl unmarshaller = new JBossXBUnmarshallerImpl();
      unmarshaller.setProperty(JBossXBConstants.JBXB_XS_MODEL, model);
      unmarshaller.setProperty(JBossXBConstants.JBXB_ROOT_QNAME, xmlName);
      unmarshaller.setProperty(JBossXBConstants.JBXB_TYPE_QNAME, xmlType);
      unmarshaller.setProperty(JBossXBConstants.JBXB_JAVA_MAPPING, getJavaWSDLMapping());

      String xml = "<result>" + " <value>100</value>" + " <value>200</value>" + " <value>300</value>" + "</result>";

      objArr = (BigDecimal[]) unmarshaller.unmarshal(new ByteArrayInputStream(xml.getBytes()));

      assertNotNull("Resulting obj array cannot be null", objArr);

      assertEquals("Unexpected array length", 3, objArr.length);
      assertEquals(new BigDecimal(100), objArr[0]);
View Full Code Here

      QName xmlType = new QName(TARGET_NAMESPACE, "SimpleUserType");

      XSModel model = generateSchemaXSModel(xmlType, SimpleUserType.class);

      SimpleUserType obj = null;
      JBossXBUnmarshallerImpl unmarshaller = new JBossXBUnmarshallerImpl();
      unmarshaller.setProperty(JBossXBConstants.JBXB_XS_MODEL, model);
      unmarshaller.setProperty(JBossXBConstants.JBXB_ROOT_QNAME, xmlName);
      unmarshaller.setProperty(JBossXBConstants.JBXB_TYPE_QNAME, xmlType);
      unmarshaller.setProperty(JBossXBConstants.JBXB_JAVA_MAPPING, getJavaWSDLMapping());

      String xml =
         "<ns1:SimpleUser xmlns:ns1='" + TARGET_NAMESPACE + "' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" +
         " <a>0</a>" +
         " <b>0</b>" +
         " <d xsi:nil='1'/>" +
         "</ns1:SimpleUser>";

      obj = (SimpleUserType)unmarshaller.unmarshal(new ByteArrayInputStream(xml.getBytes()));

      SimpleUserType exp = new SimpleUserType();
      assertNotNull("Resulting object cannot be null", obj);
      assertEquals(exp, obj);
   }
View Full Code Here

      Base exp = new Base();
      exp.a = 100;
      exp.setB(200);

      JBossXBUnmarshallerImpl unmarshaller = new JBossXBUnmarshallerImpl();
      unmarshaller.setProperty(JBossXBConstants.JBXB_XS_MODEL, model);
      unmarshaller.setProperty(JBossXBConstants.JBXB_JAVA_MAPPING, getJavaWSDLMapping());
      unmarshaller.setProperty(JBossXBConstants.JBXB_TYPE_QNAME, xmlType);
      unmarshaller.setProperty(JBossXBConstants.JBXB_ROOT_QNAME, xmlName);

      Object obj = unmarshaller.unmarshal(new ByteArrayInputStream(xmlStr.getBytes()));
      assertTrue("Unexpected return type: " + obj.getClass().getName(), obj instanceof Base);
      assertEquals(exp, obj);
   }
View Full Code Here

      XSModel model = getSchemaModel();

      EchoString_RequestStruct exp = new EchoString_RequestStruct("Hello", "world!");

      JBossXBUnmarshallerImpl unmarshaller = new JBossXBUnmarshallerImpl();
      unmarshaller.setProperty(JBossXBConstants.JBXB_XS_MODEL, model);
      unmarshaller.setProperty(JBossXBConstants.JBXB_JAVA_MAPPING, getJavaWSDLMapping());
      unmarshaller.setProperty(JBossXBConstants.JBXB_TYPE_QNAME, xmlType);
      unmarshaller.setProperty(JBossXBConstants.JBXB_ROOT_QNAME, xmlName);

      Object obj = unmarshaller.unmarshal(new ByteArrayInputStream(xmlStr.getBytes()));

      assertEquals(exp, obj);
   }
View Full Code Here

      QName xmlName = new QName(TARGET_NAMESPACE, "Derived_1", "ns1");
      QName xmlType = new QName(TARGET_NAMESPACE, "Derived", "ns1");

      XSModel model = getSchemaModel(xmlType, Derived.class);

      JBossXBUnmarshallerImpl unmarshaller = new JBossXBUnmarshallerImpl();
      unmarshaller.setProperty(JBossXBConstants.JBXB_XS_MODEL, model);
      unmarshaller.setProperty(JBossXBConstants.JBXB_JAVA_MAPPING, getJavaWSDLMapping());
      unmarshaller.setProperty(JBossXBConstants.JBXB_TYPE_QNAME, xmlType);
      unmarshaller.setProperty(JBossXBConstants.JBXB_ROOT_QNAME, xmlName);

      Object obj = unmarshaller.unmarshal(new ByteArrayInputStream(xmlStr.getBytes()));
      assertNotNull("Unexpected null object", obj);
      assertTrue("Unexpected return type: " + obj.getClass().getName(), obj instanceof Derived);
      assertEquals(exp, obj);
   }
View Full Code Here

      sub.dateTime = null;
      sub.qname = null;

      exp.composite = sub;

      JBossXBUnmarshallerImpl unmarshaller = new JBossXBUnmarshallerImpl();
      unmarshaller.setProperty(JBossXBConstants.JBXB_XS_MODEL, model);
      unmarshaller.setProperty(JBossXBConstants.JBXB_JAVA_MAPPING, getJavaWSDLMapping());
      unmarshaller.setProperty(JBossXBConstants.JBXB_TYPE_QNAME, xmlType);
      unmarshaller.setProperty(JBossXBConstants.JBXB_ROOT_QNAME, xmlName);

      Object obj = unmarshaller.unmarshal(new ByteArrayInputStream(xmlStr.getBytes()));
      assertNotNull("Unexpected null object", obj);
      assertTrue("Unexpected return type: " + obj.getClass().getName(), obj instanceof Composite);
      assertEquals(exp, obj);
   }
View Full Code Here

   public void testUnmarshallArrayType() throws Exception
   {
      XSModel model = generateSchemaXSModel(xmlType, QName[].class);

      QName[] objArr = null;
      JBossXBUnmarshallerImpl unmarshaller = new JBossXBUnmarshallerImpl();
      unmarshaller.setProperty(JBossXBConstants.JBXB_XS_MODEL, model);
      unmarshaller.setProperty(JBossXBConstants.JBXB_ROOT_QNAME, xmlName);
      unmarshaller.setProperty(JBossXBConstants.JBXB_TYPE_QNAME, xmlType);
      unmarshaller.setProperty(JBossXBConstants.JBXB_JAVA_MAPPING, getJavaWSDLMapping());

      String xml = "<ns1:arrayOfQName xmlns:ns1='" + TARGET_NAMESPACE + "'>" + " <value xmlns:ns2='http://ns2'>ns2:local2</value>"
            + " <value xmlns:ns3='http://ns3'>ns3:local3</value>" + " <value xmlns:ns4='http://ns4'>ns4:local4</value>"
            + "</ns1:arrayOfQName>";

      objArr = (QName[]) unmarshaller.unmarshal(new ByteArrayInputStream(xml.getBytes()));

      assertNotNull("Resulting obj array cannot be null", objArr);
      assertEquals("Unexpected array length", 3, objArr.length);
      assertEquals(new QName("http://ns2", "local2"), objArr[0]);
      assertEquals(new QName("http://ns3", "local3"), objArr[1]);
View Full Code Here

TOP

Related Classes of org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBUnmarshallerImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.