Problems when consulting a table for a webservice

Asked

Viewed 378 times

0

I made a web-service I can find all services when I access the localhost in the browser but opening in SOAPUI and trying to make a query by all occurs the following error in SOAPUI?

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header/>
   <soapenv:Body>
      <soapenv:Fault>
         <faultcode>soapenv:Server</faultcode>
         <faultstring>The ServiceClass object does not implement the required method in the following form: OMElement buscarTodos(OMElement e)</faultstring>
         <detail/>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>

here are the classes I created for web-service:

Conectafirebird class:

package br.com.realsysten.SigadmWS;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class ConectaFireBird {

    private static final String URL = "jdbc:firebird://localhost/SIGADM";
    private static final String User= "SYSDBA";
    private static final String Senha = "masterkey";

    public static Connection obtemConexao() throws SQLException{
        try {
            Class.forName("org.firebirdsql.jdbc.FBDriver");
        } catch (ClassNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        return DriverManager.getConnection(URL, User, Senha);
    }


}

Mesa Class:

package br.com.realsysten.SigadmWS;

public class Mesa {

    private int id;
    private String barras;
    private String tipo;
    private String data;
    private int lugares;
    private String situacao;
    private String descricao;
    private double credito;

    public Mesa(){
    }

    public Mesa(int id, String barras, String tipo, String data, int lugares, String situacao, String descricao,
            double credito) {
        super();
        this.id = id;
        this.barras = barras;
        this.tipo = tipo;
        this.data = data;
        this.lugares = lugares;
        this.situacao = situacao;
        this.descricao = descricao;
        this.credito = credito;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getBarras() {
        return barras;
    }

    public void setBarras(String barras) {
        this.barras = barras;
    }

    public String getTipo() {
        return tipo;
    }

    public void setTipo(String tipo) {
        this.tipo = tipo;
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }

    public int getLugares() {
        return lugares;
    }

    public void setLugares(int lugares) {
        this.lugares = lugares;
    }

    public String getSituacao() {
        return situacao;
    }

    public void setSituacao(String situacao) {
        this.situacao = situacao;
    }

    public String getDescricao() {
        return descricao;
    }

    public void setDescricao(String descricao) {
        this.descricao = descricao;
    }

    public double getCredito() {
        return credito;
    }

    public void setCredito(double credito) {
        this.credito = credito;
    }

}

Mesadao:

package br.com.realsysten.SigadmWS;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;

public class MesaDAO {

    public ArrayList<Mesa> buscarTodos(){
        ArrayList<Mesa> lista = new ArrayList<Mesa>();

        try {
            Connection conn = ConectaFireBird.obtemConexao();
            String querry = "SELECT * FROM CONTROLE";
            PreparedStatement stmt = conn.prepareStatement(querry);
            ResultSet rSet = stmt.executeQuery();

            while(rSet.next()){
                Mesa mesa = new Mesa();

                mesa.setId(rSet.getInt(1));
                mesa.setBarras(rSet.getString(2));
                mesa.setTipo(rSet.getString(3));
                mesa.setData(rSet.getString(4));
                mesa.setLugares(rSet.getInt(5));
                mesa.setSituacao(rSet.getString(6));
                mesa.setDescricao(rSet.getString(7));
                mesa.setCredito(rSet.getDouble(8));

                lista.add(mesa);
            }

            conn.close();
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return lista;
    }

}

Wsdl file:

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns="http://SigadmWS.realsysten.com.br" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ax21="http://SigadmWS.realsysten.com.br/xsd" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 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:wsaw="http://www.w3.org/2006/05/addressing/wsdl" targetNamespace="http://SigadmWS.realsysten.com.br">
<wsdl:documentation>Please Type your service description here</wsdl:documentation>
<wsdl:types>
<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://SigadmWS.realsysten.com.br/xsd">
<xs:complexType name="Mesa">
<xs:sequence>
<xs:element minOccurs="0" name="barras" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="credito" type="xs:double"/>
<xs:element minOccurs="0" name="data" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="descricao" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="id" type="xs:int"/>
<xs:element minOccurs="0" name="lugares" type="xs:int"/>
<xs:element minOccurs="0" name="situacao" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="tipo" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
<xs:schema xmlns:ax22="http://SigadmWS.realsysten.com.br/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://SigadmWS.realsysten.com.br">
<xs:import namespace="http://SigadmWS.realsysten.com.br/xsd"/>
<xs:element name="buscarTodos">
<xs:complexType>
<xs:sequence/>
</xs:complexType>
</xs:element>
<xs:element name="buscarTodosResponse">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax22:Mesa"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
<wsdl:message name="buscarTodosRequest">
<wsdl:part name="parameters" element="ns:buscarTodos"/>
</wsdl:message>
<wsdl:message name="buscarTodosResponse">
<wsdl:part name="parameters" element="ns:buscarTodosResponse"/>
</wsdl:message>
<wsdl:portType name="MesaDAOPortType">
<wsdl:operation name="buscarTodos">
<wsdl:input message="ns:buscarTodosRequest" wsaw:Action="urn:buscarTodos"/>
<wsdl:output message="ns:buscarTodosResponse" wsaw:Action="urn:buscarTodosResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="MesaDAOSoap11Binding" type="ns:MesaDAOPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="buscarTodos">
<soap:operation soapAction="urn:buscarTodos" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="MesaDAOSoap12Binding" type="ns:MesaDAOPortType">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="buscarTodos">
<soap12:operation soapAction="urn:buscarTodos" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="MesaDAOHttpBinding" type="ns:MesaDAOPortType">
<http:binding verb="POST"/>
<wsdl:operation name="buscarTodos">
<http:operation location="buscarTodos"/>
<wsdl:input>
<mime:content type="application/xml" part="parameters"/>
</wsdl:input>
<wsdl:output>
<mime:content type="application/xml" part="parameters"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="MesaDAO">
<wsdl:port name="MesaDAOHttpSoap11Endpoint" binding="ns:MesaDAOSoap11Binding">
<soap:address location="http://localhost:8080/SigadmWS/services/MesaDAO.MesaDAOHttpSoap11Endpoint/"/>
</wsdl:port>
<wsdl:port name="MesaDAOHttpSoap12Endpoint" binding="ns:MesaDAOSoap12Binding">
<soap12:address location="http://localhost:8080/SigadmWS/services/MesaDAO.MesaDAOHttpSoap12Endpoint/"/>
</wsdl:port>
<wsdl:port name="MesaDAOHttpEndpoint" binding="ns:MesaDAOHttpBinding">
<http:address location="http://localhost:8080/SigadmWS/services/MesaDAO.MesaDAOHttpEndpoint/"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

if anyone can help me thank you from now on.

1 answer

1


I solved this problem, for those who have this same problem I solved as follows, in the service.xml file of the service you are trying to run add in receiver message:

for example, in my case I did so:

<operation name="buscarTodos" >
        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
                class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
        <messageReceiver  mep="http://www.w3.org/2004/08/wsdl/in-out" 
                class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
</operation>

here solved the problem

Browser other questions tagged

You are not signed in. Login or sign up in order to post.