axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Arnold Maderthaner" <arnold.madertha...@gmail.com>
Subject [Axis2] Some questions about Axis2
Date Thu, 19 Apr 2007 09:53:08 GMT
Hi !

I have to write some webservices (client and server) and want to use Axis2
so I wrote some test classes:

Data classes:
public class Data1
{
    List<Data2> array = new ArrayList<Data2>();

    public List<Data2> getArray() {
        return array;
    }

    public void setArray(List<Data2> array) {
        this.array = array;
    }


}
public class Data2
{
    String a,b,c;

    public String getA() {
        return a;
    }

    public void setA(String a) {
        this.a = a;
    }

    public String getB() {
        return b;
    }

    public void setB(String b) {
        this.b = b;
    }

    public String getC() {
        return c;
    }

    public void setC(String c) {
        this.c = c;
    }
}


WebService:
package com.spirit.axis.webservice;

import java.util.Iterator;
import java.util.List;

import com.spirit.axis.data.Data1;
import com.spirit.axis.data.Data2;

public class Webservice
{
    public List<Data2> getData(Data1 data)
    {
        List<Data2> array = data.getArray();
        for(Iterator<Data2> it = array.iterator();it.hasNext();)
        {
            Data2 data2 = it.next();
            System.out.println("A:" + data2.getA() + " B:" + data2.getB() +
" C:" + data2.getC());
        }
        return array;
    }
}


Generated WSDL with java2wsdl:
<wsdl:definitions xmlns:axis2="http://webservice.axis.spirit.com"
    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://webservice.axis.spirit.com/xsd"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/ " xmlns:wsdl="
http://schemas.xmlsoap.org/wsdl/"
    targetNamespace="http://webservice.axis.spirit.com ">
    <wsdl:types>
        <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
            xmlns:ns0=" http://data.axis.spirit.com/xsd"
attributeFormDefault="qualified"
            elementFormDefault="qualified"
targetNamespace="http://webservice.axis.spirit.com/xsd
">
            <xs:element name="getData">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="data" nillable="true"
type="ns0:Data1"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="getDataResponse">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="return" nillable="true"
type="xs:anyType"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:schema>
        <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
            xmlns:ax21=" http://data.axis.spirit.com/xsd"
attributeFormDefault="qualified"
            elementFormDefault="qualified"
targetNamespace="http://data.axis.spirit.com/xsd
">
            <xs:element name="Data1" type="ax21:Data1"/>
            <xs:complexType name="Data1">
                <xs:sequence>
                    <xs:element name="array" type="xs:anyType"/>
                </xs:sequence>
            </xs:complexType>
        </xs:schema>
    </wsdl:types>
    <wsdl:message name="getDataMessage">
        <wsdl:part name="part1" element="ns:getData"/>
    </wsdl:message>
    <wsdl:message name="getDataResponseMessage">
        <wsdl:part name="part1" element="ns:getDataResponse"/>
    </wsdl:message>
    <wsdl:portType name="WebservicePortType">
        <wsdl:operation name="getData">
            <wsdl:input message="axis2:getDataMessage"/>
            <wsdl:output message="axis2:getDataResponseMessage"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="WebserviceSOAP11Binding"
type="axis2:WebservicePortType">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http "
style="document"/>
        <wsdl:operation name="getData">
            <soap:operation soapAction="urn:getData" style="document"/>
            <wsdl:input>
                <soap:body use="literal" namespace="
http://webservice.axis.spirit.com"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal" namespace="
http://webservice.axis.spirit.com"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:binding name="WebserviceSOAP12Binding"
type="axis2:WebservicePortType">
        <soap12:binding transport=" http://schemas.xmlsoap.org/soap/http"
style="document"/>
        <wsdl:operation name="getData">
            <soap12:operation soapAction="urn:getData" style="document"/>
            <wsdl:input>
                <soap12:body use="literal" namespace="
http://webservice.axis.spirit.com"/>
            </wsdl:input>
            <wsdl:output>
                <soap12:body use="literal" namespace="
http://webservice.axis.spirit.com"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="Webservice">
        <wsdl:port name="WebserviceSOAP11port"
binding="axis2:WebserviceSOAP11Binding">
            <soap:address location="
http://localhost:8080/axis2/services/Webservice"/>
        </wsdl:port>
        <wsdl:port name="WebserviceSOAP12port"
binding="axis2:WebserviceSOAP12Binding">
            <soap12:address location="
http://localhost:8080/axis2/services/Webservice"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>


The problem is that axis2 uses anyType for the Array and for the return type
of my webservice.
Can I just change it to ax21:Data2 or do I have to modify my sourcecode.
The wsdl was generate via commandline:

./java2wsdl.sh -cp . -cn com.spirit.axis.webservice.Webservice -of Test.wsdl

anyone can help me or where is the right place to post questions about axis2
?

yours

Mime
View raw message