Is it possible to trigger a web service from within a web service?
/**
 * 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;
}
In the empty if function body I need to trigger another web service...
Any takers??
Here is the web service I need to launch from the if statement
/**
 * 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;
}
Yes it is possible, generate client of the service you want to call and invoke that service from there,
But if you have access to the code of that service , use its service layer directly rather than invoking a SOAP from there
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论