是否可以从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服务......
任何接受者?
以下是我需要从if语句启动的Web服务
/**
* 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;
}
答案 0 :(得分:1)
是可以生成您要调用的服务的客户端并从那里调用该服务,
但是,如果您可以访问该服务的代码,请直接使用其服务层,而不是从那里调用SOAP