invokeAsync(inputMessage: String): JadeMethodContext updating;
The invokeAsync method of the JadeWebServiceConsumer class sends the SOAP-formatted message specified in the inputMessage parameter to the Web service and returns an instance of the
The workerApp property must be set to the name of an asynchronous worker application, which must execute the
The JadeMethodContext instance can be used as input to the waitForMethods method on the Process class, to enable your code to wait for the completion of the asynchronous execution of the Web service and obtain the results.
Reimplement the invokeAsync method in the following situations.
If you do not want to use the JADE Web service communications framework, which currently supports only HTTP (for example, if you prefer to use SMTP rather than the HTTP protocol), so that you can use your own communication handlers.
If you want to dynamically connect to a Web service (that is, without using or importing a WSDL file). If you have a JadeWebServiceConsumer subclass called DoItMyself, the method in the following example illustrates calling the Amazon Web service dynamically.
vars doItMyself : DoItMyself; inputMsg : String; context : JadeMethodContext; outputMsg : String; begin create doItMyself transient; doItMyself.workerApp := "AsyncWorkerApp"; doItMyself.setEndpointURL('http://soap.amazon.com/onca/soap2'); inputMsg := ""; //soap request here context := doItMyself.invokeAsync(inputMsg); // context now contains the JadeMethodContext that will send // the Web service request in a worker application and receive // the response from the Web service provider process.waitForMethods(context); // wait for asynchronous Web service message to complete // could do other processing while waiting for the completion outputMsg := context.getReturnValue.String; // outputMsg now contains the response from the Web service write outputMsg; epilog delete doItMyself; end;
In this case, you are dealing directly with SOAP messages.
This method uses the POST verb to send a message to the Web service via the associated JadeHTTPConnection. Use the JadeWebServiceConsumer class invokeAsyncWithVerb method to send a message to the Web service using a verb other than POST.