views:

63

answers:

1

Hi,

(axis2 1.3, struts2 2.1.8.1, tomcat 6.x, java 1.5.0)

I've got problem with making my first web service.

  1. I create a MOCK api which i want to test. My action:

    public HotelMessage[] getMessages(String roomNr) {
    HotelMessage[] msg2return = new HotelMessage[1];
    HotelMessage m1 = new HotelMessage();
    m1.setId(1L);
    m1.setMessage("wiadomosc pierwsza");
    m1.setTitle("title pierwszy");
    m1.setRead(false);
    m1.setRoomNr(roomNr);
    System.err.println("returning messages");
    return msg2return;
    

    }

My HotelMessage class looks like that:

import java.io.Serializable;
import java.sql.Date;

public class HotelMessage implements Serializable{

    private static final long serialVersionUID = -6785924436619067967L;
        private long id;
    private boolean read;
    private String roomNr;
    private String title;
    private String message;
    private Date create_date;

    //setters + getters
        }

After making aar, i upload this to mu axis2 on tomcat, then:

wsdl2java.bat -uri http://localhost:8088/axis2/services/HotelAPI?wsdl -d adb -s -S .

everything works just fine, but I got this exception, while i was trying to call getMessages("STH") action with code:

HotelAPIStub.GetMessages getMessages = new HotelAPIStub.GetMessages();
    getMessages.setParam0("ble");
    HotelAPIStub.HotelMessage[] tmp; 
    try{
        HotelAPIStub.GetMessagesResponse resp3 = stub.getMessages(getMessages);
        tmp = resp3.get_return();
        System.err.println("THERE ARE "+tmp.length+"MESSAGES!");
    }catch (RemoteException ex){
        System.err.println("NO MESSAGES!");
        ex.printStackTrace();
    }

i've got this Exception:

org.apache.axis2.AxisFault: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:486)
    at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:343)
    at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:389)
    at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:211)
    at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
    at com.swmind.IPTV.hotel.HotelAPIStub.getMessages(HotelAPIStub.java:371)
    at com.swmind.IPTV.hotel.actions.ShowBillClass.execute(ShowBillClass.java:57)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

Could anyone please help me ? I've tried to google it, but didn't found anything useful. Thx Tzim

A: 

Solution: restart tomcat with axis2 in it...

tzim