Problem with empty tags

Tomas Andersen <[email protected]>
Newsgroups gmane.text.xml.axis.user
Message-ID <[email protected]>
Hi

I am having a problem with a generated client from a WSDL.
I am using Apache Axis2/Java 1.6.2

We are communicating with a SOAP Service which is returning the following XML structure:

               <Skjerming>
                  <Kode>
                     <Navn>U</Navn>
                     <Beskrivelse>Ugradert</Beskrivelse>
                     <Hjemmel/>
                  </Kode>
               </Skjerming>


The tag named Hjemmel is causing AXIS2 problems. I get a ADBException: Unexpected subelement

The XSD describes the tag like this:


<xsd:complexType name="SkjermingskodeResponseType">
  <xsd:annotation>
    <xsd:documentation>Type som inneholder informasjon om skjermingskode ved response</xsd:documentation>
  </xsd:annotation>
  <xsd:sequence>
    <xsd:element name="Navn" type="cct:navn">
      <xsd:annotation>
        <xsd:documentation>Angir navnet på skjermingskoden.</xsd:documentation>
      </xsd:annotation>
    </xsd:element>
    <xsd:element name="Beskrivelse" type="cct:tekst">
      <xsd:annotation>
        <xsd:documentation>Beskrivelse av avskjermingskoden.</xsd:documentation>
      </xsd:annotation>
    </xsd:element>
    <xsd:element name="Hjemmel" type="HjemmelResponseType">
      <xsd:annotation>
        <xsd:documentation>Angir hjemmel som skal benyttes.</xsd:documentation>
      </xsd:annotation>
    </xsd:element>
  </xsd:sequence>
</xsd:complexType>

<xsd:complexType name="HjemmelResponseType">
  <xsd:annotation>
    <xsd:documentation>Type som inneholder informasjon om en skjermingshjemmel ved response</xsd:documentation>
  </xsd:annotation>
  <xsd:sequence>
    <xsd:element name="Navn" type="cct:navn">
      <xsd:annotation>
        <xsd:documentation>Angir navnet på hjemmelen.</xsd:documentation>
      </xsd:annotation>
    </xsd:element>
    <xsd:element name="Beskrivelse" type="cct:tekst">
      <xsd:annotation>
        <xsd:documentation>Beskrivelse av hjemmel.</xsd:documentation>
      </xsd:annotation>
    </xsd:element>
  </xsd:sequence>
</xsd:complexType>


If i mock the SOAP Service and replaces the <Hjemmel/> tag with the following XML everything works ok:


               <Skjerming>
                  <Kode>
                     <Navn>U</Navn>
                     <Beskrivelse>Ugradert</Beskrivelse>
                     <Hjemmel>
                       <Navn>A</Navn>
                       <Beskrivelse>AAA</Beskrivelse>
                     </Hjemmel>
                  </Kode>
               </Skjerming>



Is there a way to be able to handle empty elements on the form <tag/> as a client using axis2?
Both for subtrees and for leaf-elements? If I put in a <tag/> for a leaf I get a Nullpointerexception because AXIS2 fails with toString on this element.

Best Regards,

Tomas Andersen
Senior Consultant
+47 91 87 32 77

Tønne Huitfeldts Plass 2  |  N-1767 Halden  |  NORWAY
www.morecom.no<http://www.morecom.no> <www.morecom.no<http://www.morecom.no>>

Disclaimer: This e-mail is bound by the terms and conditions described atwww.morecom.no/mail-disclaimer.html<http://www.morecom.no/mail-disclaimer.html> <http://www.morecom.no/mail-disclaimer.html>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.