package songND.ws2;

import javax.jws.WebService;

@WebService(targetNamespace = "http://myproject.com/NDWS2/" )
public class TitleNDWS2Impl implements TitleNDWS2{

	int stato = 0;
	
	public String SearchByTitle(String title) throws Exception{
		if(stato == 0){
		String canzone = "yesterday";
			stato = 1;
		return canzone;
		}else throw new Exception("Operazione non disponibile in questo stato per il servizio titleNDWS2");
    }
    
    public String Listen(String name)throws Exception{
    	if(stato == 1){
    	stato = 0;
    	String esecuzione = "...Yesterday, all my troubles seemed so faraway...";
    	return esecuzione;
    }else throw new Exception("Operazione non disponibile in questo stato per il servizio titleNDWS2");
    }
    public int getStatus(){
    	return stato;
    }
    
    
}