axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "DELZANT Bruno (BMB)" <Bruno.DELZ...@proximus.net>
Subject Does axis2 not respect the order in generation of the stub client ?
Date Tue, 13 Jan 2009 11:48:34 GMT

Hi,
 
I have a WSDL containing the following part:
 
<message name="loginResponse">
    <part name="lstlogdt" type="xsd:dateTime" />
    <part name="lstlogtm" type="xsd:dateTime" />
    <part name="menu" type="xsd:string" />
    <part name="operprop" type="xsd:string" />
    <part name="profile" type="xsd:string" />
    <part name="profprop" type="xsd:string" />
    <part name="rejlogin" type="xsd:string" />
    <part name="retvalue" type="xsd:string" />
    <part name="sessid" type="xsd:string" />
    <part name="srvref00" type="osp:ArrayOfstring" />
</message>
 
I expect Axis2 to respect the order, but in the client stub generated I
get another order. See part of the code:
 
________________________________

   public static LoginResponse parse(javax.xml.stream.XMLStreamReader
reader) throws java.lang.Exception {
    LoginResponse object = new LoginResponse();
    int event;
    java.lang.String nillableValue = null;
    java.lang.String prefix = "";
    java.lang.String namespaceuri = "";
    try {
     while (!reader.isStartElement() && !reader.isEndElement())
      reader.next();
     if
(reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance
<http://www.w3.org/2001/XMLSchema-instance> ", "type") != null) {
      java.lang.String fullTypeName = reader.getAttributeValue(
        "http://www.w3.org/2001/XMLSchema-instance
<http://www.w3.org/2001/XMLSchema-instance> ", "type");
      if (fullTypeName != null) {
       java.lang.String nsPrefix = null;
       if (fullTypeName.indexOf(":") > -1) {
        nsPrefix = fullTypeName.substring(0, fullTypeName.indexOf(":"));
       }
       nsPrefix = nsPrefix == null ? "" : nsPrefix;
       java.lang.String type =
fullTypeName.substring(fullTypeName.indexOf(":") + 1);
       if (!"loginResponse".equals(type)) {
        // find namespace for the prefix
        java.lang.String nsUri =
reader.getNamespaceContext().getNamespaceURI(nsPrefix);
        return (LoginResponse) ExtensionMapper.getTypeObject(nsUri,
type, reader);
       }
      }
     }
 
     // Note all attributes that were handled. Used to differ normal
attributes
     // from anyAttributes.
     java.util.Vector handledAttributes = new java.util.Vector();
     reader.next();
     while (!reader.isStartElement() && !reader.isEndElement())
      reader.next();
     if (reader.isStartElement()
       && new javax.xml.namespace.QName("",
"srvref00").equals(reader.getName())) {
      object.setSrvref00(ArrayOfstring.Factory.parse(reader));
      reader.next();
     } // End of if for expected property start element
 
     else {
      // A start element we are not expecting indicates an invalid
parameter was passed
      throw new org.apache.axis2.databinding.ADBException("Unexpected
subelement "
        + reader.getLocalName());
     }
 
     while (!reader.isStartElement() && !reader.isEndElement())
      reader.next();
     if (reader.isStartElement()
       && new javax.xml.namespace.QName("",
"profprop").equals(reader.getName())) {
      java.lang.String content = reader.getElementText();
 
object.setProfprop(org.apache.axis2.databinding.utils.ConverterUtil.conv
ertToString(content));
      reader.next();
     } // End of if for expected property start element
    ... 
________________________________

 
As you can see, first element to be searched for is element srvref00,
then profprop and so on.
But in my SOAP definition, I was expecting to get first lstlogdt, then
lstlogtm ...
 
Can someone explain me why the ordering is not preserved and how to
ensure it ?
 
This lead to "unexpected element" error when I try to parse the response
message ...
 
Thanks a lot for any help.
 
Bruno Delzant



**** DISCLAIMER**** 
http://www.proximus.be/maildisclaimer
Mime
View raw message