Hi, I managed to fix my problem. I am still using ADB, but I added databindingname=“xmlbeans” as a parameter to axis2-wsdl2java The new generated code handles empty tags now :)
Regards, Tomas From: Tomas Andersen <t...@morecom.no<mailto:t...@morecom.no>> Date: Thursday 4 December 2014 09:54 To: "java-user@axis.apache.org<mailto:java-user@axis.apache.org>" <java-user@axis.apache.org<mailto:java-user@axis.apache.org>> Cc: "mgai...@hotmail.com<mailto:mgai...@hotmail.com>" <mgai...@hotmail.com<mailto:mgai...@hotmail.com>> Subject: Re: Problem with empty tags Thank you for the suggestion, but still axis won’t handle the XML. I tried to modify the xsd to this: <xsd:complexType name="HjemmelResponseType"> <xsd:annotation> <xsd:documentation>Type som inneholder informasjon om en skjermingshjemmel ved response</xsd:documentation> </xsd:annotation> <xsd:complexContent> <xsd:extension base="SkjermingskodeResponseType"> <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:extension> </xsd:complexContent> </xsd:complexType> but still I get this error message: org.apache.axis2.databinding.ADBException: Unexpected subelement {urn:no:vegvesen:saksarkiv:felles:typer:1}Hjemmel When part of the response is on the form <Skjerming> <Kode> <Navn>U</Navn> <Beskrivelse>Ugradert</Beskrivelse> <Hjemmel/> </Kode> </Skjerming> Any ideas? Will it help to try to use something else to generate the clientcode instead of ADB? JiBX? Regards, Tomas Andersen 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> MG>take a look at this ResponseType <xs:complexType name="ResponseType"> <xs:sequence> <xs:element name="integer1" type="xs:unsignedInt"/> <xs:element name="integer2" type="xs:unsignedInt"/> </xs:sequence> </xs:complexType> <!-- the endtag for xs:complexType is here --> <!-- we may now reference the tag ResponseType in further declarations --> <xs:complexType name="UpdateResponseType"> <xs:complexContent> <!-- this declaration says for my current UpdateResponseType tag i will extend from predefined ResponseType --> <!-- the parser has already parsed ResponseType so any tags downstream will be able to extend from it as seen here --> <xs:extension base="def:ResponseType"> <xs:choice> <xs:element name="updateResponseChoice" type="xs:unsignedInt"/> <xs:element name="updateResponseChoice2" type="xs:unsignedInt"/> </xs:choice> </xs:extension> </xs:complexContent> </xs:complexType> MG> MG>your definition of the 2 responseTypes are jumbled together so the parser is unable to make the distinction between MG>HjemmelResponseType and SkjermingskodeResponseType 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> MG>Here your new tag Hjemmel is being declared with no extensions or relationships to other tags <Hjemmel> <Navn>A</Navn> <Beskrivelse>AAA</Beskrivelse> </Hjemmel> MG>end tag 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>> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ The one common undertaking and universal instrument of the great majority of the human race is the United Nations. A patient, constructive long-term use of its potentialities can bring a real and secure peace to the world. - Trygve Lie.......................... Former Secretary General of United Nations 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>