2011-01-11 63 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

相关问题