axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jürgen Keil (JIRA) <>
Subject [jira] [Created] (AXIS2-5443) WSDL2C: incomplete code in axis2_extension_mapper.c for xsd choice type
Date Sun, 28 Oct 2012 14:53:12 GMT
Jürgen Keil created AXIS2-5443:

             Summary: WSDL2C: incomplete code in axis2_extension_mapper.c for xsd choice type
                 Key: AXIS2-5443
             Project: Axis2
          Issue Type: Bug
          Components: codegen, databinding
    Affects Versions: 1.6.2, 1.6.1, 1.6.0
         Environment: MacOS X 10.7.5

$ java -version
java version "1.6.0_37"
Java(TM) SE Runtime Environment (build 1.6.0_37-b06-434-11M3909)
Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01-434, mixed mode)
            Reporter: Jürgen Keil
             Fix For: 1.5.6

I'm trying to build an ANSI C xml (de)serializer for an xml schema using axis2c and axis2.
The xml schema contains serveral choice elements.

The xml deserializer build by axis2 WSDL2C has problems parsing these choice elements.

The root cause is missing internal choice types in the generated axis2_extension_mapper.c

Here's an example which reproduces the problem:

bug.xsd schema file (contains a choice element)
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xs:schema xmlns="urn:axis2:choice:bug" xmlns:xs="" elementFormDefault="qualified"
    <xs:element name="Document" type="Document"/>

    <xs:complexType name="Document">
                <xs:element name="IBAN" type="IBAN2007Identifier"/>
                <xs:element name="Othr" type="GenericAccountIdentification1"/>

    <xs:complexType name="GenericAccountIdentification1">
            <xs:element name="Id" type="Max34Text"/>

    <xs:simpleType name="IBAN2007Identifier">
        <xs:restriction base="xs:string">
            <xs:pattern value="[A-Z]{2,2}[0-9]{2,2}[a-zA-Z0-9]{1,30}"/>

    <xs:simpleType name="Max34Text">
        <xs:restriction base="xs:string">
            <xs:minLength value="1"/>
            <xs:maxLength value="34"/>

bug.wsdl, references the bug.xsd schema file
<definitions targetNamespace="http://localhost/bug/wsdl"

	<import namespace="urn:axis2:choice:bug" location="bug.xsd" />

	<message name="getReq">
		<part name="parameters" element="types:Document" />

	<message name="getResp">
		<part name="parameters" element="types:Document" />

	<portType name="PortType">
		<operation name="get">
			<input message="tns:getReq" />
			<output message="tns:getResp" />

	<binding name="SOAPBinding" type="tns:PortType">
		<soap:binding style="document" transport="" />
		<operation name="get">
			<soap:operation style="document" soapAction="get" />
				<soap:body use="literal" />
				<soap:body use="literal" />

	<service name="Service">
		<port name="SOAPPort" binding="tns:SOAPBinding">
			<soap:address location="http://localhost:8080/axis2/services/Service" />


And a sample xml document, bug.xml
<Document xmlns="urn:axis2:choice:bug" xmlns:xsi=""
xsi:schemaLocation="urn:axis2:choice:bug bug.xsd">

Now I generate the ANSI C xml (de)serializer code using WSDL2C,
axis2c-bin-1.7.0-linux/bin/tools/wsdl2c/ -uri bug.wsdl -d adb -u -S bug

And finally a simple test program to call the generated xml deserializer for the <Document>
root element:
#include <stdio.h>
#include <axiom.h>
#include <axis2_util.h>
#include <axiom_stax_builder.h>
#include "adb_Document.h"

main(int argc, char **argv)
	char *filename = "bug.xml";
	const axutil_env_t *env = NULL;
	axis2_status_t st;
        axiom_node_t* parent = NULL;
	axis2_bool_t is_early_node_valid;
	axiom_xml_reader_t *parser;
	axiom_stax_builder_t *builder;
	axiom_document_t *doc;
        adb_Document_t* Document;
	env = axutil_env_create_all("/tmp/axis.log", AXIS2_LOG_LEVEL_TRACE);

	if (argv[1] != NULL)
		filename = argv[1];

	parser = axiom_xml_reader_create_for_file(env, filename, AXIS2_UTF_8);
	if (parser == NULL) {
		fprintf(stderr, "failed to create parser for %s\n", filename);
	builder = axiom_stax_builder_create(env, parser);
	doc = axiom_stax_builder_get_document(builder, env);
	parent = axiom_document_get_root_element(doc, env);

	Document = adb_Document_create(env);
        st = adb_Document_deserialize(Document, env, &parent, &is_early_node_valid,

	if (st == AXIS2_SUCCESS)
		printf("status=%d\n", st),


The parser fails with the following error message:

$ cat /tmp/axis.log 
[Sun Oct 28 15:15:36 2012] [error] adb_Document.c(263) failed in building adb object for element
[Sun Oct 28 15:15:36 2012] [error] adb_Document.c(273) failed in setting the value for DocumentChoice_type0

When I look at the generated axis2_extension_mapper.c file, I notice that there are several
that handle the "adb_Document" type, but the internal "adb_DocumentChoice_type0" type is missing.

As soon as I manually add "adb_DocumentChoice_type0" to the generated file
axis2_extension_mapper.c I get a working xml deserializer.

Workaround:  Use axis2 1.5.6 - the old axis2 1.5.6 WSDL2C is able to produce a working xml

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message