Creation d'un webservice: erreur: unexpected subelement

Fermé
SabrineH - Modifié par SabrineH le 16/02/2017 à 00:36
Bonjour,

J'essaie de créer un service Web utilisant Axis2 et en suivant ce tuto mais j'ai cette erreur qui s'affiche quand je compile du coté client:
Exception in thread "main" org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement {http://WebService.example.com}return
    at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
    at com.example.webservice.AddOperatorServiceStub.fromOM(AddOperatorServiceStub.java:1378)
    at com.example.webservice.AddOperatorServiceStub.add(AddOperatorServiceStub.java:189)
    at com.example.client.AddClientApp.main(AddClientApp.java:26)
Caused by: java.lang.Exception: org.apache.axis2.databinding.ADBException: Unexpected subelement {http://WebService.example.com}return
    at com.example.webservice.AddOperatorServiceStub$AddResponse$Factory.parse(AddOperatorServiceStub.java:801)
    at com.example.webservice.AddOperatorServiceStub.fromOM(AddOperatorServiceStub.java:1372)
    ... 2 more
Caused by: org.apache.axis2.databinding.ADBException: Unexpected subelement {http://WebService.example.com}return
    at com.example.webservice.AddOperatorServiceStub$AddResponse$Factory.parse(AddOperatorServiceStub.java:786)
    ... 3 more


Je crois qu'il y a un problème avec un attribut sur mon wsdl mais je n'arrive pas à le corriger

Voici mon WSDL:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://WebService.example.com" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://WebService.example.com" xmlns:intf="http://WebService.example.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)-->
 <wsdl:types>
  <schema elementFormDefault="qualified" targetNamespace="http://WebService.example.com" xmlns="http://www.w3.org/2001/XMLSchema">
   <element name="add">
    <complexType>
     <sequence>
      <element name="x" type="xsd:int"/>
      <element name="y" type="xsd:int"/>
     </sequence>
    </complexType>
   </element>
   <element name="addResponse">
    <complexType>
     <sequence>
      <element name="addReturn" type="xsd:int"/>
     </sequence>
    </complexType>
   </element>
  </schema>
 </wsdl:types>
 
   <wsdl:message name="addResponse">
 
      <wsdl:part element="impl:addResponse" name="parameters">
 
      </wsdl:part>
 
   </wsdl:message>
 
   <wsdl:message name="addRequest">
 
      <wsdl:part element="impl:add" name="parameters">
 
      </wsdl:part>
 
   </wsdl:message>
 
   <wsdl:portType name="AddOperator">
 
      <wsdl:operation name="add">
 
         <wsdl:input message="impl:addRequest" name="addRequest">
 
       </wsdl:input>
 
         <wsdl:output message="impl:addResponse" name="addResponse">
 
       </wsdl:output>
 
      </wsdl:operation>
 
   </wsdl:portType>
 
   <wsdl:binding name="AddOperatorSoapBinding" type="impl:AddOperator">
 
      <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
 
      <wsdl:operation name="add">
 
         <wsdlsoap:operation soapAction=""/>
 
         <wsdl:input name="addRequest">
 
            <wsdlsoap:body use="literal"/>
 
         </wsdl:input>
 
         <wsdl:output name="addResponse">
 
            <wsdlsoap:body use="literal"/>
 
         </wsdl:output>
 
      </wsdl:operation>
 
   </wsdl:binding>
 
   <wsdl:service name="AddOperatorService">
 
      <wsdl:port binding="impl:AddOperatorSoapBinding" name="AddOperator">
 
         <wsdlsoap:address location="http://localhost:8080/WebServerTest/services/AddOperator"/>
 
      </wsdl:port>
 
   </wsdl:service>
 
</wsdl:definitions>


Ma classe AddOperator.java est bien dans un package com.example.WebSevice

Quelqu'un aurait une piste par laquelle je peux commencer?

Merci d'avance
A voir également: