I got it to work, but it seems to miss things.

All I have to do was to

0)   create a TestOrder with all datafield fill.

1)   MessageContext msgContext = new MessageContext(new AxisServer());

2)   BeanSerializer bs = new BeanSerializer( TestOrder.class );

3)   QName qn = new QName( "urn:TestOrder", "TestOrder" );
  
4)   Writer sw = new StringWriter();

5)   SerializationContext sc = new SerializationContext( sw,msgContext );

6)   bs.serialize( qn , new org.xml.sax.helpers.AttributesImpl() , 
testOrder , sc );

7)   System.out.println(sw.toString());

But here is another problem, that I encounter

my TestOrder.wsdd is define as follow


      <xsd:complexType name="LineItem">
        <xsd:sequence>
          <xsd:element name="productNumber" type="xsd:string"/>
          <xsd:element name="description" type="xsd:string"/>
          <xsd:element name="unitPrice" type="xsd:decimal"/>
          <xsd:element name="quantity" type="xsd:int"/>
        </xsd:sequence>
      </xsd:complexType>

      <xsd:complexType name="LineItemArray">
        <xsd:complexContent>
          <xsd:restriction base="soapenc:Array">
            <xsd:sequence>
              <xsd:element name="alias" type="tns:LineItem" 
maxOccurs="unbounded"/>
            </xsd:sequence>
          </xsd:restriction>
        </xsd:complexContent>
      </xsd:complexType>

      <xsd:complexType name="TestOrder">
        <xsd:sequence>
          <xsd:element name="id" type="xsd:long"/>
          <xsd:element name="title" type="xsd:string"/>
           <xsd:element name="lineItems" type="tns:LineItemArray"/>
        </xsd:sequence>
      </xsd:complexType>


But when I print out the xml string, everything is print out find, but 
the lineItem is shows this :

<id xsi:type="ns2:long" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:ns2="http://www.w3.org/2001/XMLSchema";>0</id>
<title xsi:type="ns3:string" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:ns3="http://www.w3.org/2001/XMLSchema";>Musical Gear</title>
<lineItems href="#id0"/>


I was expecting 3 lineItems

What am I doing wrong?

Please help

Thanks





Tom Le wrote:

> Hi
>
> I have axis wsdl maps to jboss 3.0 ejb bean, and I was able 
> create/modify/delete bean through axis generated class.
>
> But once I get back the object through axis, how do I serialize the 
> object without calling the axis engine again, same with example5 ?
>
> I used castor before, all I have to do with the object I get from 
> castor generated class is to call a castor class,  unmarshall(writer, 
> myobject, generated class) , then I got my reuslt serialize
>
> Thanks.
>
>
>


Reply via email to