You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by anti kivi <an...@gmail.com> on 2010/03/15 08:16:07 UTC

Unsupported type exception with extension mapper

Hi

Short story:
Can I have 1 common parent complexType for messages of 2 different services?

I have a problem with deserializing the parent object because
ParentObject.Factory.parse method calls ExtensionMapper.getObject of the
last generated service and fails for service which was generated first.
Failure reason: "unsupported type".

Should the described design be possible with axis2 1.4.1 or how to make it
work?

Long story:
I have 2 services, Service1 and Service2. Service1 imports
Service1Messages.xsd and Service2 imports Service2Messages.xsd. Both xsd-s
import CommonTypes.xsd. Java code for Service1 is generated first.

When I use "serveextra" operation and set SubRequestType1 as wrapped message
then I get the "unsupported type".
Can I somehow specify correct extension mapper for parent parser?

Thanks,
 Anti

----------start CommonTypes.xsd-----------
<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="http://www.comp.com/Services/CommonTypes"
elementFormDefault="qualified"
    xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xsd="
http://www.w3.org/2001/XMLSchema" xmlns:CommonTypes="
http://www.comp.com/Services/CommonTypes">

    <complexType name="RootType">
        <sequence>
            <element name="fake" type="xsd:string" maxOccurs="1"
minOccurs="0" />
        </sequence>
    </complexType>

</schema>
----------end CommonTypes.xsd-----------

----------start Service1Messages.xsd-----------
<?xml version="1.0" encoding="UTF-8"?>
<schema
    targetNamespace="http://www.comp.com/Services/Service1Messages"
    elementFormDefault="qualified"
    xmlns="http://www.w3.org/2001/XMLSchema"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:CommonTypes="http://www.comp.com/Services/CommonTypes"
    xmlns:Service1Messages="http://www.comp.com/Services/Service1Messages">

    <import namespace="http://www.comp.com/Services/CommonTypes"
schemaLocation="CommonTypes.xsd" />

    <complexType name="SubRequestType1">
        <complexContent>
            <extension base="CommonTypes:RootType" />
        </complexContent>
    </complexType>

    <element name="SubRequest1" type="Service1Messages:SubRequestType1" />

    <complexType name="SubResponseType1">
        <complexContent>
            <extension base="CommonTypes:RootType" />
        </complexContent>
    </complexType>

    <element name="SubResponse1" type="Service1Messages:SubResponseType1" />


    <complexType name="SubRequestType2">
        <complexContent>
            <extension base="CommonTypes:RootType" />
        </complexContent>
    </complexType>

    <element name="SubRequest2" type="Service1Messages:SubRequestType2" />

    <complexType name="SubResponseType2">
        <complexContent>
            <extension base="CommonTypes:RootType" />
        </complexContent>
    </complexType>

    <element name="SubResponse2" type="Service1Messages:SubResponseType2" />

    <complexType name="ExtraRequestType">
        <sequence>
            <element name="wrappedMessage" type="CommonTypes:RootType" />
        </sequence>
    </complexType>

    <element name="ExtraRequestMessage"
type="Service1Messages:ExtraRequestType" />

    <complexType name="ExtraResponseType">
        <sequence>
            <element name="wrappedMessage" type="CommonTypes:RootType" />
        </sequence>
    </complexType>

    <element name="ExtraResponseMessage"
type="Service1Messages:ExtraResponseType" />

</schema>
----------end Service1Messages.xsd-----------

----------start Service2Messages.xsd-----------
<?xml version="1.0" encoding="UTF-8"?>
<schema
    targetNamespace="http://www.comp.com/Services/Service2Messages"
    elementFormDefault="qualified"
    xmlns="http://www.w3.org/2001/XMLSchema"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:CommonTypes="http://www.comp.com/Services/CommonTypes"
    xmlns:Service2Messages="http://www.comp.com/Services/Service2Messages">

    <import namespace="http://www.comp.com/Services/CommonTypes"
schemaLocation="CommonTypes.xsd" />

    <complexType name="SubRequestType3">
        <complexContent>
            <extension base="CommonTypes:RootType" />
        </complexContent>
    </complexType>

    <element name="SubRequest3" type="Service2Messages:SubRequestType3" />

    <complexType name="SubResponseType3">
        <complexContent>
            <extension base="CommonTypes:RootType" />
        </complexContent>
    </complexType>

    <element name="SubResponse3" type="Service2Messages:SubResponseType3" />

</schema>
----------end Service2Messages.xsd-----------

----------start Service1Service.wsdl-----------
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:tns="http://www.comp.com/Services/Service1Service"
    xmlns:Service1Messages="http://www.comp.com/Services/Service1Messages"
    targetNamespace="http://www.comp.com/Services/Service1Service"
    name="Service1Service">

    <wsdl:types>
        <xsd:schema targetNamespace="
http://www.comp.com/Services/Service1Service">
            <xsd:import namespace="
http://www.comp.com/Services/Service1Messages"
schemaLocation="Service1Messages.xsd" />
        </xsd:schema>
    </wsdl:types>

    <wsdl:message name="Service1Request1">
        <wsdl:part name="request" element="Service1Messages:SubRequest1" />
    </wsdl:message>
    <wsdl:message name="Service1Response1">
        <wsdl:part name="response" element="Service1Messages:SubResponse1"
/>
    </wsdl:message>

    <wsdl:message name="Service1Request2">
        <wsdl:part name="request" element="Service1Messages:SubRequest2" />
    </wsdl:message>
    <wsdl:message name="Service1Response2">
        <wsdl:part name="response" element="Service1Messages:SubResponse2"
/>
    </wsdl:message>

    <wsdl:message name="ExtraRequest">
        <wsdl:part name="request"
element="Service1Messages:ExtraRequestMessage" />
    </wsdl:message>

    <wsdl:message name="ExtraResponse">
        <wsdl:part name="request"
element="Service1Messages:ExtraResponseMessage" />
    </wsdl:message>

    <wsdl:portType name="Service1ServicePortType">
        <wsdl:operation name="serve1">
            <wsdl:input message="tns:Service1Request1"></wsdl:input>
            <wsdl:output message="tns:Service1Response1"></wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="serve2">
            <wsdl:input message="tns:Service1Request2"></wsdl:input>
            <wsdl:output message="tns:Service1Response2"></wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="serveextra">
            <wsdl:input message="tns:ExtraRequest"></wsdl:input>
            <wsdl:output message="tns:ExtraResponse"></wsdl:output>
        </wsdl:operation>
    </wsdl:portType>

    <wsdl:binding name="Service1ServiceSOAPBinding"
type="tns:Service1ServicePortType">
        <soap:binding style="document" transport="
http://schemas.xmlsoap.org/soap/http" />
        <wsdl:operation name="serve1">
            <soap:operation soapAction="serve1" />
            <wsdl:input>
                <soap:body use="literal" />
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal" />
            </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="serve2">
            <soap:operation soapAction="serve2" />
            <wsdl:input>
                <soap:body use="literal" />
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal" />
            </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="serveextra">
            <soap:operation soapAction="serveextra" />
            <wsdl:input>
                <soap:body use="literal" />
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal" />
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>

    <wsdl:service name="Service1Service">
        <wsdl:port binding="tns:Service1ServiceSOAPBinding"
name="Service1ServicePort">
            <soap:address location="
http://www.comp.com/Services/Service1Service.wsdl" />
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>
----------end Service1Service.wsdl-----------

----------start Service2Service.wsdl-----------
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:tns="http://www.comp.com/Services/Service2Service"
    xmlns:Service2Messages="http://www.comp.com/Services/Service2Messages"
    targetNamespace="http://www.comp.com/Services/Service2Service"
    name="Service2Service">

    <wsdl:types>
        <xsd:schema targetNamespace="
http://www.comp.com/Services/Service2Service">
            <xsd:import namespace="
http://www.comp.com/Services/Service2Messages"
schemaLocation="Service2Messages.xsd" />
        </xsd:schema>
    </wsdl:types>

    <wsdl:message name="Service2Request3">
        <wsdl:part name="request" element="Service2Messages:SubRequest3" />
    </wsdl:message>
    <wsdl:message name="Service2Response3">
        <wsdl:part name="response" element="Service2Messages:SubRequest3" />
    </wsdl:message>

    <wsdl:portType name="Service2ServicePortType">
        <wsdl:operation name="serve1">
            <wsdl:input message="tns:Service2Request3"></wsdl:input>
            <wsdl:output message="tns:Service2Response3"></wsdl:output>
        </wsdl:operation>
    </wsdl:portType>

    <wsdl:binding name="Service2ServiceSOAPBinding"
type="tns:Service2ServicePortType">
        <soap:binding style="document" transport="
http://schemas.xmlsoap.org/soap/http" />
        <wsdl:operation name="serve1">
            <soap:operation soapAction="serve1" />
            <wsdl:input>
                <soap:body use="literal" />
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal" />
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>

    <wsdl:service name="Service2Service">
        <wsdl:port binding="tns:Service2ServiceSOAPBinding"
name="Service2ServicePort">
            <soap:address location="
http://www.comp.com/Services/Service2Service.wsdl" />
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>
----------end Service2Service.wsdl-----------