package songND.ws1;

import javax.jws.WebService;

@WebService(targetNamespace = "http://myproject.com/NDWS1/" )
public class AuthorNDWS1Impl implements AuthorNDWS1{

	int stato = 0;
	
	public String SearchByAuthor(String author) 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 authorWS1");
    }
    
    public String Listen(String name)throws Exception{
		if(stato == 1){
    		String esecuzione = "...Yesterday, all my troubles seemed so faraway...";
    		stato = 0;
    		return esecuzione;
    		}
    
    	else throw new Exception("Operazione non disponibile in questo stato per il servizio authorWS1");
  
    }
    
    public int getStatus(){
    	return stato;
    }
    
    
}