2011-01-11 104 views
0

是否可以從Web服務中觸發Web服務?Web服務觸發另一個Web服務?

/** 
* Web service operation 
*/ 
@WebMethod(operationName = "bookFlight") 
public String bookFlight(@WebParam(name = "destination") 
String destination, @WebParam(name = "seats") 
int seats) { 
    try { 
     String ret = composite.bookFlight(destination, seats); 
      if(composite.checkDistance(destination) > 15) 
      { 

      } 
     return ret; 
    } catch (FileNotFoundException_Exception ex) { 
     Logger.getLogger(compositeBookings.class.getName()).log(Level.SEVERE, null, ex); 
    } catch (InterruptedException_Exception ex) { 
     Logger.getLogger(compositeBookings.class.getName()).log(Level.SEVERE, null, ex); 
    } 
    return null; 
} 

在空if函數體我需要觸發另一個Web服務...

任何考生?

這裏是Web服務,我需要從if語句推出

/** 
* Web service operation 
*/ 
@WebMethod(operationName = "bookHotel") 
public String bookHotel(@WebParam(name = "destination") 
String destination, @WebParam(name = "rooms") 
int rooms) {   
    try { 
     String ret = composite.bookHotel(destination, rooms);    
     return ret; 
    } catch (myhotels.InterruptedException_Exception ex) { 
     Logger.getLogger(compositeBookings.class.getName()).log(Level.SEVERE, null, ex); 
    } catch (myhotels.FileNotFoundException_Exception ex) { 
     Logger.getLogger(compositeBookings.class.getName()).log(Level.SEVERE, null, ex); 
    }   
    return null; 
} 

回答

1

有可能,生成要呼叫,並從那裏調用該服務的服務的客戶端,

但是,如果您有權訪問該服務的代碼,請直接使用其服務層,而不是從那裏調用SOAP。

+0

我有權訪問代碼,但它需要用戶輸入,就像父服務一樣。 – 2011-01-11 17:39:28

相關問題