axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kjell V. Normann" <kjell.norm...@mazeppa.no>
Subject Namespace problems with a POJO based Axis2 web service and generated WSDL
Date Wed, 24 Jan 2007 13:04:48 GMT
Hi.

I've created a WS using the following POJO:

package no.mazeppa.kda.ws;
public class CurrentTimeService
{
    ...
    public ResultSpec[] sendHours(CurrentHourSpec[] data) throws 
BaanException
    {
       ...
    }
}

My services.xml looks like this:

<serviceGroup>

    <service name="CurrentTimeService" scope="application">
        <description>KDA Current Time Service</description>
        <messageReceivers>
            <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
                class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
        </messageReceivers>
        <parameter name="ServiceClass">
            no.mazeppa.kda.ws.CurrentTimeService
        </parameter>
    </service>

</serviceGroup>

I've generated a WSDL file using the java2wsdl Eclipse plugin (I've also 
tried the command line tool). See the WSDL at the end of this mail.

The WSDL file is then used to generate a Web Service Control in BEA 
Weblogic (8.1SP6). When I try to call the WS using this control, I get 
the following error message:

External Service Failure: Did not find expected root element 
sendHoursResponse@http://ws.kda.mazeppa.no/xsd: actual document 
contained {http://org.apache.axis2/xsd}sendHoursResponse

I've used SOAPMonitor to look at the response from the WS and it looks 
like this:

<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header />
    <soapenv:Body>
        <ns:sendHoursResponse xmlns:ns="http://org.apache.axis2/xsd">
            <ns:return>
                <ns:id>id1</ns:id>
                <ns:resultText>Result!</ns:resultText>
                <ns:status>OK</ns:status>
            </ns:return>
        </ns:sendHoursResponse>
    </soapenv:Body>
</soapenv:Envelope>

I guess the problem is the xmlns:ns="http://org.apache.axis2/xsd" 
attribute on the ns:sendHoursResponse element which doesn't match the 
targetNamespace="http://ws.kda.mazeppa.no/xsd" attribute on the 
xs:schema element in the WSDL.

Why is there a mismatch between the generated WSDL and the response from 
the WS? Is there any way to work around this problem?

Any help would be greatly appreciated.

Regards,

Kjell Normann


--------------------------------

<wsdl:definitions xmlns:axis2="http://ws.kda.mazeppa.no"
    xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
    xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
    xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
    xmlns:ns="http://ws.kda.mazeppa.no/xsd"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    targetNamespace="http://ws.kda.mazeppa.no">
    <wsdl:types>
        <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
            xmlns:ns0="http://data.ws.kda.mazeppa.no/xsd"
            attributeFormDefault="qualified" elementFormDefault="qualified"
            targetNamespace="http://ws.kda.mazeppa.no/xsd">
            <xs:element name="sendHoursFault">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="sendHoursFault"
                            type="xs:anyType" />
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="sendHours">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element maxOccurs="unbounded" name="data"
                            nillable="true" type="ns0:CurrentHourSpec" />
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="sendHoursResponse">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element maxOccurs="unbounded" name="return"
                            nillable="true" type="ns0:ResultSpec" />
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:schema>
        <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
            xmlns:ax21="http://data.ws.kda.mazeppa.no/xsd"
            attributeFormDefault="qualified" elementFormDefault="qualified"
            targetNamespace="http://data.ws.kda.mazeppa.no/xsd">
            <xs:element name="CurrentHourSpec"
                type="ax21:CurrentHourSpec" />
            <xs:complexType name="CurrentHourSpec">
                <xs:sequence>
                    <xs:element name="activity" nillable="true"
                        type="xs:string" />
                    <xs:element name="company" type="xs:int" />
                    <xs:element name="employee" nillable="true"
                        type="xs:string" />
                    <xs:element name="hoursWorked1" type="xs:float" />
                    <xs:element name="hoursWorked2" type="xs:float" />
                    <xs:element name="hoursWorked3" type="xs:float" />
                    <xs:element name="hoursWorked4" type="xs:float" />
                    <xs:element name="hoursWorked5" type="xs:float" />
                    <xs:element name="hoursWorked6" type="xs:float" />
                    <xs:element name="hoursWorked7" type="xs:float" />
                    <xs:element name="id" nillable="true"
                        type="xs:string" />
                    <xs:element name="period" type="xs:int" />
                    <xs:element name="project" nillable="true"
                        type="xs:string" />
                    <xs:element name="task" type="xs:int" />
                    <xs:element name="year" type="xs:int" />
                </xs:sequence>
            </xs:complexType>
            <xs:element name="ResultSpec" type="ax21:ResultSpec" />
            <xs:complexType name="ResultSpec">
                <xs:sequence>
                    <xs:element name="id" nillable="true"
                        type="xs:string" />
                    <xs:element name="resultText" nillable="true"
                        type="xs:string" />
                    <xs:element name="status" nillable="true"
                        type="xs:string" />
                </xs:sequence>
            </xs:complexType>
        </xs:schema>
    </wsdl:types>
    <wsdl:message name="sendHoursMessage">
        <wsdl:part name="part1" element="ns:sendHours" />
    </wsdl:message>
    <wsdl:message name="sendHoursResponseMessage">
        <wsdl:part name="part1" element="ns:sendHoursResponse" />
    </wsdl:message>
    <wsdl:message name="sendHoursFault">
        <wsdl:part name="part1" element="ns:sendHoursFault" />
    </wsdl:message>
    <wsdl:portType name="CurrentTimeServicePortType">
        <wsdl:operation name="sendHours">
            <wsdl:input message="axis2:sendHoursMessage" />
            <wsdl:output message="axis2:sendHoursResponseMessage" />
            <wsdl:fault message="axis2:sendHoursFault"
                name="sendHoursFault" />
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="CurrentTimeServiceSOAP11Binding"
        type="axis2:CurrentTimeServicePortType">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
            style="document" />
        <wsdl:operation name="sendHours">
            <soap:operation soapAction="urn:sendHours" style="document" />
            <wsdl:input>
                <soap:body use="literal"
                    namespace="http://ws.kda.mazeppa.no" />
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"
                    namespace="http://ws.kda.mazeppa.no" />
            </wsdl:output>
            <wsdl:fault name="sendHoursFault">
                <soap:body use="literal"
                    namespace="http://ws.kda.mazeppa.no" />
            </wsdl:fault>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:binding name="CurrentTimeServiceSOAP12Binding"
        type="axis2:CurrentTimeServicePortType">
        <soap12:binding transport="http://schemas.xmlsoap.org/soap/http"
            style="document" />
        <wsdl:operation name="sendHours">
            <soap12:operation soapAction="urn:sendHours"
                style="document" />
            <wsdl:input>
                <soap12:body use="literal"
                    namespace="http://ws.kda.mazeppa.no" />
            </wsdl:input>
            <wsdl:output>
                <soap12:body use="literal"
                    namespace="http://ws.kda.mazeppa.no" />
            </wsdl:output>
            <wsdl:fault name="sendHoursFault">
                <soap12:body use="literal"
                    namespace="http://ws.kda.mazeppa.no" />
            </wsdl:fault>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="CurrentTimeService">
        <wsdl:port name="CurrentTimeServiceSOAP11port"
            binding="axis2:CurrentTimeServiceSOAP11Binding">
            <soap:address
                
location="http://localhost:8080/axis2/services/CurrentTimeService" />
        </wsdl:port>
        <wsdl:port name="CurrentTimeServiceSOAP12port"
            binding="axis2:CurrentTimeServiceSOAP12Binding">
            <soap12:address
                
location="http://localhost:8080/axis2/services/CurrentTimeService" />
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>




---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Mime
View raw message