Não consigo consumir serviço usando axis2

1 resposta
K
Quando entra nesse método ele lança um erro.
//Utiliza o webmethod "Soma"
	private void bSomaClick(){
    

    		//Obtem os valores digitados nas caixas de texto
    		double val1 = Double.parseDouble(tfValor1.getText());
    		double val2 = Double.parseDouble(tfValor2.getText());

    		//Cria um objeto apontando para o endereço do web service "Calculadora" 
    		CalculadoraStub stub = null;
			try {
				stub = new CalculadoraStub("http://localhost:8080/axis2/services/Calculadora");
			} catch (AxisFault e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
    		
            //Cria um objeto para setar os parâmetros do webmethod "Soma" 
    		CalculadoraStub.Soma req = new CalculadoraStub.Soma();
            
    		//Seta os parâmetros
            req.setI(val1);
            req.setJ(val2);
            
            //Executa o webmethod "Soma" e coloca o resultado na variável "resp"
            CalculadoraStub.SomaResponse resp = null;
			try {
				resp = stub.soma(req);
			} catch (RemoteException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
            
            //Apresenta o resultado
            lOperacao.setText("SOMA");
            lResultado.setText(df.format(resp.get_return()));
            
	}
log4j:WARN No appenders could be found for logger (org.apache.axis2.description.AxisOperation).
log4j:WARN Please initialize the log4j system properly.
org.apache.axis2.AxisFault: namespace mismatch require http://calc.ws.org found http://org.ws/xsd
	at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:531)
	at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:375)
	at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421)
	at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
	at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
	at org.ws.calc.cliente.stub.CalculadoraStub.soma(CalculadoraStub.java:221)
	at org.ws.calc.cliente.swing.CalcView.bSomaClick(CalcView.java:184)
	at org.ws.calc.cliente.swing.CalcView.access$1(CalcView.java:158)
	at org.ws.calc.cliente.swing.CalcView$2.actionPerformed(CalcView.java:107)
	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
	at java.awt.Component.processMouseEvent(Unknown Source)
	at javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.awt.EventQueue.access$200(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue$4.run(Unknown Source)
	at java.awt.EventQueue$4.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
	at org.ws.calc.cliente.swing.CalcView.bSomaClick(CalcView.java:192)
	at org.ws.calc.cliente.swing.CalcView.access$1(CalcView.java:158)
	at org.ws.calc.cliente.swing.CalcView$2.actionPerformed(CalcView.java:107)
	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
	at java.awt.Component.processMouseEvent(Unknown Source)
	at javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.awt.EventQueue.access$200(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue$4.run(Unknown Source)
	at java.awt.EventQueue$4.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)

1 Resposta

thiagobarso

Vc Tbm está usando o livro de WEB SERVICES SOAP em Java? Empaquei nesse exemplo tbm… achei alguma coisa aqui:

http://stackoverflow.com/questions/11008804/webservices-connection-using-axis2-and-apache

Mas preciso de ajuda.

Criado 8 de outubro de 2012
Ultima resposta 26 de mar. de 2013
Respostas 1
Participantes 2