Insert by soapui in a webservice

0

When I try to insert using soapUI, the following error occurs:

    org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544347. validation error for column CON_CODIGO, value "*** null ***"
    at org.firebirdsql.jdbc.AbstractPreparedStatement.internalExecute(AbstractPreparedStatement.java:782)
    at org.firebirdsql.jdbc.AbstractPreparedStatement.executeUpdate(AbstractPreparedStatement.java:198)
    at br.com.realsysten.SigadmWS.MesaDAO.inserirMesa(MesaDAO.java:27)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:256)
    at org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver.invokeBusinessLogic(RPCInOnlyMessageReceiver.java:70)
    at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:106)
    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:169)
    at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:176)
    at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:163)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1099)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Unknown Source)
Caused by: org.firebirdsql.gds.GDSException: validation error for column CON_CODIGO, value "*** null ***"
    at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.readStatusVector(AbstractJavaGDSImpl.java:2098)
    at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.receiveResponse(AbstractJavaGDSImpl.java:2048)
    at org.firebirdsql.gds.impl.wire.AbstractJavaGDSImpl.iscDsqlExecute2(AbstractJavaGDSImpl.java:1155)
    at org.firebirdsql.gds.impl.GDSHelper.executeStatement(GDSHelper.java:232)
    at org.firebirdsql.jdbc.AbstractPreparedStatement.internalExecute(AbstractPreparedStatement.java:774)
    ... 35 more

Regardless of what I do or change in the error code always

Classes:

ConnectFirBird:

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:firebirdsql:localhost/3050:D:/SIGADM.FDB";
    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);
    }


}

Table:

package br.com.realsysten.SigadmWS;

import java.sql.Date;

public class Mesa {

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

    public Mesa(){
    }

    public Mesa(int id, String barras, String tipo, Date 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 Date getData() {
        return data;
    }

    public void setData(Date 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  boolean inserirMesa(Mesa mesa){

        try {
            Connection conn = ConectaFireBird.obtemConexao();
            String querryInsert = "INSERT INTO CONTROLE (CON_CODIGO_BARRAS, CON_TIPO, CON_DATA, "
                    + "CON_QTDE_LUGARES, CON_SITUACAO, CON_DESCRICAO, CON_VLR_CREDITO)"
                    + " VALUES(?, ?, ?, ?, ?, ?, ?)";
            PreparedStatement stmt = conn.prepareStatement(querryInsert);

            stmt.setString(1, mesa.getBarras());
            stmt.setString(2, mesa.getTipo());
            stmt.setDate(3, mesa.getData());
            stmt.setInt(4, mesa.getLugares());
            stmt.setString(5, mesa.getSituacao());
            stmt.setString(6, mesa.getDescricao());
            stmt.setDouble(7, mesa.getCredito());

            stmt.executeUpdate();

            conn.close();
        } catch (Exception e) {
            // TODO: handle exception
            e.printStackTrace();
            return false;
        }

        return true;
    }

    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.getDate(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) {
            e.printStackTrace();
        }
        return lista;
    }

}

wsdl:

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<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:date"/>
<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="inserirMesa">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="mesa" nillable="true" type="ax22:Mesa"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="inserirMesaResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="return" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<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="inserirMesaRequest">
<wsdl:part name="parameters" element="ns:inserirMesa"/>
</wsdl:message>
<wsdl:message name="inserirMesaResponse">
<wsdl:part name="parameters" element="ns:inserirMesaResponse"/>
</wsdl:message>
<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="inserirMesa">
<wsdl:input message="ns:inserirMesaRequest" wsaw:Action="urn:inserirMesa"/>
<wsdl:output message="ns:inserirMesaResponse" wsaw:Action="urn:inserirMesaResponse"/>
</wsdl:operation>
<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="inserirMesa">
<soap:operation soapAction="urn:inserirMesa" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<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="inserirMesa">
<soap12:operation soapAction="urn:inserirMesa" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<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="inserirMesa">
<http:operation location="inserirMesa"/>
<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: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>

Does anyone know why this occurs?

Thank you in advance

    
asked by anonymous 30.05.2016 / 15:54

1 answer

0

Take a look at the CON_CODIGO field in your table, it must be set to not accept the null value in the attribute. In this case I suggest you set it to auto-increment or pass some value to it in insert .     

21.11.2016 / 12:23