I have a working web service deployed in Axis 1.3 so I tested if I can
port it to Axis2.
I downloaded the Axis2 binary distribution and ecipse plugin. First I
created the FaultToleranceService interface and the FTAction class
that were the starting point of my old service. They are attached.
Using the Eclipse generation wizard, I successfully created the
attached wsdl file but when I try to generate the java server and stub
code from it I get the following error:
Exception in thread "main"
org.apache.axis2.wsdl.codegen.CodeGenerationException:
java.lang.RuntimeException: java.lang.RuntimeException: Schema for
namespace 'http://tomas.org/faultTolerance/Service/Types' already
contains type 'FTAction
I tried with the Eclipse code generation wizard and manually with the
wsdl2java class and the result is the same.
I understand that, as the wsdl code is generated from an Axis2 tool,
it must be understood by another Axis2 tool without this kind of
problems.
--
Regards.
José Antonio Sánchez
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 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:ns3="http://tomas.org/faultTolerance/Service/Types" xmlns:ft="http://tomas.org/faultTolerance/Service" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="http://tomas.org/faultTolerance/Service"><wsdl:types><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:stn_6="http://ft.tomas.org/xsd" xmlns:ftt="http://tomas.org/faultTolerance/Service/Types" targetNamespace="http://tomas.org/faultTolerance/Service/Types" elementFormDefault="unqualified" attributeFormDefault="unqualified">
<xs:import namespace="http://ft.tomas.org/xsd" />
<xs:element type="ftt:FTAction" name="FTAction" />
<xs:complexType name="FTAction">
<xs:sequence>
<xs:element type="xs:int" name="value" />
<xs:element type="xs:string" name="action" />
</xs:sequence>
</xs:complexType>
<xs:element name="doFTAction">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" type="stn_6:FTAction" name="param0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="doFTActionResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" type="stn_6:FTAction" name="return" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="FTAction">
<xs:sequence>
<xs:element type="xs:int" name="value" />
<xs:element type="xs:string" name="action" />
</xs:sequence>
</xs:complexType>
</xs:schema></wsdl:types><wsdl:message name="doFTActionMessage"><wsdl:part element="ns3:doFTAction" name="part1" /></wsdl:message><wsdl:message name="doFTActionResponseMessage"><wsdl:part element="ns3:doFTActionResponse" name="part1" /></wsdl:message><wsdl:portType name="FaultToleranceServicePortType"><wsdl:operation name="doFTAction"><wsdl:input message="ft:doFTActionMessage" /><wsdl:output message="ft:doFTActionResponseMessage" /></wsdl:operation></wsdl:portType><wsdl:binding type="ft:FaultToleranceServicePortType" name="FaultToleranceServiceSOAP11Binding"><soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /><wsdl:operation name="doFTAction"><soap:operation style="document" soapAction="urn:doFTAction" /><wsdl:input><soap:body namespace="http://tomas.org/faultTolerance/Service" use="literal" /></wsdl:input><wsdl:output><soap:body namespace="http://tomas.org/faultTolerance/Service" use="literal" /></wsdl:output></wsdl:operation></wsdl:binding><wsdl:binding type="ft:FaultToleranceServicePortType" name="FaultToleranceServiceSOAP12Binding"><soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /><wsdl:operation name="doFTAction"><soap12:operation style="document" soapAction="urn:doFTAction" /><wsdl:input><soap12:body namespace="http://tomas.org/faultTolerance/Service" use="literal" /></wsdl:input><wsdl:output><soap12:body namespace="http://tomas.org/faultTolerance/Service" use="literal" /></wsdl:output></wsdl:operation></wsdl:binding><wsdl:service name="FaultToleranceService"><wsdl:port binding="ft:FaultToleranceServiceSOAP11Binding" name="FaultToleranceServiceSOAP11port"><soap:address location="http://localhost:8080/axis2/services/FaultToleranceService" /></wsdl:port><wsdl:port binding="ft:FaultToleranceServiceSOAP12Binding" name="FaultToleranceServiceSOAP12port"><soap12:address location="http://localhost:8080/axis2/services/FaultToleranceService" /></wsdl:port></wsdl:service></wsdl:definitions>
package org.tomas.ft;
public interface FaultToleranceService {
public FTAction[] doFTAction(FTAction[] actions);
}
package org.tomas.ft;
public class FTAction {
private String action;
private int value;
public FTAction()
{
super();
}
public FTAction(String action, int value) {
// TODO Auto-generated constructor stub
this.action = action;
this.value = value;
}
public String getAction() {
return action;
}
public void setAction(String action) {
this.action = action;
}
public int getValue() {
return value;
}
public void setValue(int value) {
this.value = value;
}
}