I'm setting up a web service, previously it was already working normally but the scripts were all in one package, so I decided to organize my scripts in different packages
Butnowmywebservicedoesnotaccessclassesthatareinadifferentpackagethanthewebservicecodes,andIgetthismessageinSoapUI
<soapenv:Envelopexmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Server</faultcode>
<faultstring>br.com.sata.Classes.Usuario</faultstring>
<detail/>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
JAVA Code
package br.com.sata.WebService;
import java.sql.SQLException;
import br.com.sata.Classes.Usuario;
import br.com.sata.Crud.Crud_Usuario;
import br.com.sata.Validacao.ValidaUsuario;
public class WS_Usuario
{
public String inserirUsuario(Usuario usuario) throws SQLException
{
String message = ValidaUsuario.testaCampos(usuario);
if(message != "OK")
{
return message;
}
return Crud_Usuario.inserirUsuario(usuario);
}
}
Web Service XML
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://WebService.sata.com.br" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ax219="http://Classes.sata.com.br/xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ax217="http://sql.java/xsd" targetNamespace="http://WebService.sata.com.br">
<wsdl:documentation>Please Type your service description here</wsdl:documentation>
<wsdl:types>
<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://Classes.sata.com.br/xsd">
<xs:complexType name="Infos">
<xs:sequence>
<xs:element minOccurs="0" name="bairro" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="canc" type="xs:int"/>
<xs:element minOccurs="0" name="celular" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="complemento" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="conc" type="xs:int"/>
<xs:element minOccurs="0" name="cp" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="email" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="id" type="xs:int"/>
<xs:element minOccurs="0" name="idCidadeFK" type="xs:int"/>
<xs:element minOccurs="0" name="nome" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="numero" type="xs:int"/>
<xs:element minOccurs="0" name="reputacao" type="xs:double"/>
<xs:element minOccurs="0" name="rua" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="telefone" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Usuario">
<xs:complexContent>
<xs:extension base="ax219:Infos">
<xs:sequence>
<xs:element minOccurs="0" name="login" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="senha" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>
<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://sql.java/xsd">
<xs:complexType name="SQLException">
<xs:sequence>
<xs:element minOccurs="0" name="SQLState" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="errorCode" type="xs:int"/>
<xs:element minOccurs="0" name="nextException" nillable="true" type="ax217:SQLException"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
<xs:schema xmlns:ax220="http://Classes.sata.com.br/xsd" xmlns:ax218="http://sql.java/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://WebService.sata.com.br">
<xs:import namespace="http://sql.java/xsd"/>
<xs:import namespace="http://Classes.sata.com.br/xsd"/>
<xs:element name="WS_UsuarioSQLException">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="SQLException" nillable="true" type="ax218:SQLException"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="inserirUsuario">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="usuario" nillable="true" type="ax220:Usuario"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="inserirUsuarioResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="excluirUsuario">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="login" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="senha" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="excluirUsuarioResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="atualizarUsuario">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="usuario" nillable="true" type="ax220:Usuario"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="atualizarUsuarioResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
<wsdl:message name="excluirUsuarioRequest">
<wsdl:part name="parameters" element="ns:excluirUsuario"/>
</wsdl:message>
<wsdl:message name="excluirUsuarioResponse">
<wsdl:part name="parameters" element="ns:excluirUsuarioResponse"/>
</wsdl:message>
<wsdl:message name="WS_UsuarioSQLException">
<wsdl:part name="parameters" element="ns:WS_UsuarioSQLException"/>
</wsdl:message>
<wsdl:message name="atualizarUsuarioRequest">
<wsdl:part name="parameters" element="ns:atualizarUsuario"/>
</wsdl:message>
<wsdl:message name="atualizarUsuarioResponse">
<wsdl:part name="parameters" element="ns:atualizarUsuarioResponse"/>
</wsdl:message>
<wsdl:message name="inserirUsuarioRequest">
<wsdl:part name="parameters" element="ns:inserirUsuario"/>
</wsdl:message>
<wsdl:message name="inserirUsuarioResponse">
<wsdl:part name="parameters" element="ns:inserirUsuarioResponse"/>
</wsdl:message>
<wsdl:portType name="WS_UsuarioPortType">
<wsdl:operation name="excluirUsuario">
<wsdl:input message="ns:excluirUsuarioRequest" wsaw:Action="urn:excluirUsuario"/>
<wsdl:output message="ns:excluirUsuarioResponse" wsaw:Action="urn:excluirUsuarioResponse"/>
<wsdl:fault message="ns:WS_UsuarioSQLException" name="WS_UsuarioSQLException" wsaw:Action="urn:excluirUsuarioWS_UsuarioSQLException"/>
</wsdl:operation>
<wsdl:operation name="atualizarUsuario">
<wsdl:input message="ns:atualizarUsuarioRequest" wsaw:Action="urn:atualizarUsuario"/>
<wsdl:output message="ns:atualizarUsuarioResponse" wsaw:Action="urn:atualizarUsuarioResponse"/>
<wsdl:fault message="ns:WS_UsuarioSQLException" name="WS_UsuarioSQLException" wsaw:Action="urn:atualizarUsuarioWS_UsuarioSQLException"/>
</wsdl:operation>
<wsdl:operation name="inserirUsuario">
<wsdl:input message="ns:inserirUsuarioRequest" wsaw:Action="urn:inserirUsuario"/>
<wsdl:output message="ns:inserirUsuarioResponse" wsaw:Action="urn:inserirUsuarioResponse"/>
<wsdl:fault message="ns:WS_UsuarioSQLException" name="WS_UsuarioSQLException" wsaw:Action="urn:inserirUsuarioWS_UsuarioSQLException"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="WS_UsuarioSoap11Binding" type="ns:WS_UsuarioPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="excluirUsuario">
<soap:operation soapAction="urn:excluirUsuario" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="WS_UsuarioSQLException">
<soap:fault use="literal" name="WS_UsuarioSQLException"/>
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="atualizarUsuario">
<soap:operation soapAction="urn:atualizarUsuario" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="WS_UsuarioSQLException">
<soap:fault use="literal" name="WS_UsuarioSQLException"/>
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="inserirUsuario">
<soap:operation soapAction="urn:inserirUsuario" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="WS_UsuarioSQLException">
<soap:fault use="literal" name="WS_UsuarioSQLException"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="WS_UsuarioSoap12Binding" type="ns:WS_UsuarioPortType">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="excluirUsuario">
<soap12:operation soapAction="urn:excluirUsuario" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
<wsdl:fault name="WS_UsuarioSQLException">
<soap12:fault use="literal" name="WS_UsuarioSQLException"/>
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="atualizarUsuario">
<soap12:operation soapAction="urn:atualizarUsuario" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
<wsdl:fault name="WS_UsuarioSQLException">
<soap12:fault use="literal" name="WS_UsuarioSQLException"/>
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="inserirUsuario">
<soap12:operation soapAction="urn:inserirUsuario" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
<wsdl:fault name="WS_UsuarioSQLException">
<soap12:fault use="literal" name="WS_UsuarioSQLException"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="WS_UsuarioHttpBinding" type="ns:WS_UsuarioPortType">
<http:binding verb="POST"/>
<wsdl:operation name="excluirUsuario">
<http:operation location="excluirUsuario"/>
<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="atualizarUsuario">
<http:operation location="atualizarUsuario"/>
<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="inserirUsuario">
<http:operation location="inserirUsuario"/>
<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="WS_Usuario">
<wsdl:port name="WS_UsuarioHttpSoap11Endpoint" binding="ns:WS_UsuarioSoap11Binding">
<soap:address location="http://localhost:8009/ExemploWS/services/WS_Usuario.WS_UsuarioHttpSoap11Endpoint/"/>
</wsdl:port>
<wsdl:port name="WS_UsuarioHttpSoap12Endpoint" binding="ns:WS_UsuarioSoap12Binding">
<soap12:address location="http://localhost:8009/ExemploWS/services/WS_Usuario.WS_UsuarioHttpSoap12Endpoint/"/>
</wsdl:port>
<wsdl:port name="WS_UsuarioHttpEndpoint" binding="ns:WS_UsuarioHttpBinding">
<http:address location="http://localhost:8009/ExemploWS/services/WS_Usuario.WS_UsuarioHttpEndpoint/"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Console error
[ERROR] Exception occurred while trying to invoke service method insertUsuario org.apache.axis2.AxisFault: br.com.sata.Classes.User at org.apache.axis2.AxisFault.makeFault (AxisFault.java:430) at org.apache.axis2.engine.DefaultObjectSupplier.getObject (DefaultObjectSupplier.java:47) at org.apache.axis2.databinding.utils.BeanUtil.deserialize (BeanUtil.java:412) at org.apache.axis2.databinding.utils.BeanUtil.processObject (BeanUtil.java:818) at org.apache.axis2.databinding.utils.BeanUtil.ProcessElement (BeanUtil.java:737) at org.apache.axis2.databinding.utils.BeanUtil.deserialize (BeanUtil.java:646) at org.apache.axis2.rpc.receivers.RPCUtil.processRequest (RPCUtil.java:153) at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass (RPCUtil.java:206) at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic (RPCMessageReceiver.java:117) at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic (AbstractInOutMessageReceiver.java:40) at org.apache.axis2.receivers.AbstractMessageReceiver.receive (AbstractMessageReceiver.java:114) at org.apache.axis2.engine.AxisEngine.receive (AxisEngine.java:181) at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest (HTTPTransportUtils.java:172) at org.apache.axis2.transport.http.AxisServlet.doPost (AxisServlet.java:146) at javax.servlet.http.HttpServlet.service (HttpServlet.java:643) at javax.servlet.http.HttpServlet.service (HttpServlet.java:723) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke (StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke (StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:103) at org.apache.catalina.core.StandardEngineValve.invoke (StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service (CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process (Http11Processor.java:861) at Http11ConnectionHandler.process at org.apache.tomcat.util.net.JIoEndpoint $ Worker.run (JIoEndpoint.java:489) at java.lang.Thread.run (Unknown Source) Caused by: java.lang.InstantiationException: br.com.sata.Classes.Usuario at java.lang.Class.newInstance (Unknown Source) at org.apache.axis2.engine.DefaultObjectSupplier.getObject (DefaultObjectSupplier.java:42) ... more Caused by: java.lang.NoSuchMethodException: br.sata.Classes.Usuario. () at java.lang.Class.getConstructor0 (Unknown Source) ... 28 more
How can I resolve this? and this will affect all the other scripts that are in different package of web service? or just the scripts that are used as parameters in web service methods?