axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ulf Heyder (JIRA)" <>
Subject [jira] Created: (AXIS2-2600) Code Generator should consider namespaceprefixes defined in wsdl rather than defining ns1 when generating code for MY_QNAME in ADB classes
Date Fri, 27 Apr 2007 11:15:15 GMT
Code Generator should consider namespaceprefixes defined in wsdl rather than defining ns1 when
generating code for MY_QNAME in ADB classes

                 Key: AXIS2-2600
             Project: Axis 2.0 (Axis2)
          Issue Type: Bug
          Components: adb, codegen, om
    Affects Versions: 1.1.1
         Environment: AXIS2-1.1.1, codegen commandline (ant) ADB, jdk1.5, Tomcat 5.5, Win
            Reporter: Ulf Heyder

I have a small test WSDL (see below). I let AXIS2 Code Generator generate classes by calling

    wsdl2java -uri foo.wsdl -o foosrc -p de.theservice.axis2 -ss -ssi -g
        -t -sd -ns2p

In the created ADB bean classes the definition of QName-s look like

    public static final javax.xml.namespace.QName MY_QNAME = 
        new javax.xml.namespace.QName("",
            "CheckServiceRequest", "ns1");

replacing user defined namesspaceprefixes (in my example: "foo") with prefixes like ns1, ns2,
... (in my example: "ns1")

When my client submits a "CheckService" request my service skeleton implementation has to
serialize the request object to a file.

    public CheckServiceResponse CheckService(CheckServiceRequest request)
        throws CheckServiceFaultMsgException {

        OMOutputFormat omOutformat = new OMOutputFormat();
        OMDataSource omOutSource = request.getOMDataSource(

        OutputStream outBeanStr = new FileOutputStream(someFile);
        omOutSource.serialize(outBeanStr, omOutformat);

The output file "someFile" looks like

    <ns1:CheckServiceRequest xmlns:ns1="">

I use this output as input for a XSL Transformer. The problem now is that I therefor strictly
need the original namespaceprefix "foo" instead of the unknown "ns1", since there are dependencies
of external xml schema defining namespaceprefix "foo".

As a workaround I tried to set the prefix when serializing the bean to file:

OMDataSource omOutSource = request.getOMDataSource(
    new QName("hhtp://", "CheckServiceRequest", "foo"), 

This didn't work.

CodeGen should follow the prefixes defined in wsdl. There could be a new flag to turn this
beahavior on and off.

There should be a way to overrule the usage of the namespaceprefixes ns1, ns2, ... defined
in MY_QNAME in the generated adb classes.

----- WSDL -------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:foo=""
    name="TheService" targetNamespace="">
        <xs:schema targetNamespace="" 
            <xs:element name="CheckServiceRequest" 
                type="xs:string" />
            <xs:element name="CheckServiceResponse" 
                type="foo:CheckServiceResponseType" />
            <xs:element name="CheckServiceFault" 
                type="xs:string" />

            <xs:complexType name="CheckServiceResponseType">
                    <xs:element name="id" 
                        type="xs:string" />
                    <xs:element name="resultURI" 
                        type="xs:anyURI" />

    <wsdl:message name="CheckServiceRequest">
        <wsdl:part element="foo:CheckServiceRequest" 
            name="CheckServiceRequest" />
    <wsdl:message name="CheckServiceResponse">
        <wsdl:part element="foo:CheckServiceResponse" 
            name="CheckServiceResponse" />
    <wsdl:message name="CheckServiceFaultMsg">
        <wsdl:part name="CheckServiceFault" element="foo:CheckServiceFault" />

    <wsdl:portType name="TheService">
        <wsdl:operation name="CheckService">
            <wsdl:input message="foo:CheckServiceRequest" />
            <wsdl:output message="foo:CheckServiceResponse" />
            <wsdl:fault name="CheckServiceFault" 
                message="foo:CheckServiceFaultMsg" />
    <wsdl:binding name="TheServiceSOAP" type="foo:TheService">
        <soap:binding style="document" 
            transport="" />
        <wsdl:operation name="CheckService">
            <soap:operation soapAction="CheckService" />
                <soap:body use="literal" />
                <soap:body use="literal" />
            <wsdl:fault name="CheckServiceFault">
                <soap:fault name="CheckServiceFault" use="literal" />
    <wsdl:service name="TheService">
        <wsdl:port binding="foo:TheServiceSOAP" name="TheServiceSOAP">
                location="" />

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

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

View raw message