Hello,

I'm having problems using Jibx as the databinding for
Axis2 (version 1.1).

I'm using document/literal (unwrapped) and followed
the example outlined in
http://ws.apache.org/axis2/1_1/jibx/jibx-doclit-example.html
. Everything works as expected. However, when I tried
with my own code which has a input parameter
containing another complex type, the unmarshalling
failed (on the server side) with the message :

Expected
"{http://www.xyz.com/2006/vh/XMLSchema}vehicle"; end
tag, found
"{http://www.xyz.com/2006/vh/XMLSchema}vehicle-type";
start tag (line -1, col -1, in SOAP-message)


Is there something which I'm doing wrongly?

Also, is it possible to use the same binding for the
same set of classes for both use in Axis2 (in
document/literal unwrapped style) and as a general way
to serialized Java to XML? Currently the requirement
of marking the mapping as abstract and not able to use
the name attribute is causing the serialization to
fail when I do :

  IBindingFactory bfact =
BindingDirectory.getFactory(Vehicle.class);
  IMarshallingContext mctx =
bfact.createMarshallingContext();
  mctx.marshalDocument(vehicle, "UTF-8", null,
writer);

Thanks for your help.

--

Generated method from from WSDL2Java :

public org.apache.axiom.soap.SOAPEnvelope
jibxReceiver(...)

  ...
  org.jibx.runtime.impl.UnmarshallingContext uctx =
getNewUnmarshalContext(element);
  uctx.next();
  int index;
  dev.jibx.Vehicle Vehicle = null;
  if
(uctx.isAt("http://www.xyz.com/2006/vh/XMLSchema";,
"Vehicle")) {
    Vehicle = (dev.jibx.Vehicle)
    uctx.getUnmarshaller(_type_index0).unmarshal(new
dev.jibx.Vehicle(), uctx);                              
   
uctx.parsePastCurrentEndTag("http://www.xyz.com/2006/vh/XMLSchema";,
"Vehicle");   <---- Error occurs here
                                
  } else {
    throw new org.apache.axis2.AxisFault("Missing
required element
{http://www.xyz.com/2006/vh/XMLSchema}Vehicle";);
  }

  ..

}


My binding.xml file :

<binding force-classes="true"
xmlns:vh="http://www.xyz.com/2006/vh/XMLSchema";>

  <namespace
uri="http://www.xyz.com/2006/vehicle/XMLSchema";
default="elements"/>  

  <mapping abstract="true"
class="dev.jibx.VehicleType"
type-name="vh:VehicleType">  
    <value name="type" field="type"/>
    <value name="description" field="description"/>
  </mapping>

  <mapping abstract="true" class="dev.jibx.Vehicle"
type-name="vh:Vehicle">
    <value name="id" field="id"/>
    <structure field="vehicleType" usage="optional"
map-as="vh:VehicleType"/>
  </mapping>
  
</binding>


My classes:

public class Vehicle {
  private String id;
  private VehicleType type;             
  ...
}


public class VehicleType {
  private int type;
  private String description;
  ..
}






 
____________________________________________________________________________________
Want to start your own business?
Learn how on Yahoo! Small Business.
http://smallbusiness.yahoo.com/r-index

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to