6-2 Programming Advanced Features of JAX-RPC Web Services for Oracle WebLogic Server
6.2 Example of a JWS File That Implements a Reliable Conversational Web Service
The following sample JWS file implements a Web service that is both reliable and conversational:
package examples.webservices.async_mega; import java.io.Serializable;
import weblogic.jws.WLHttpTransport; import weblogic.jws.Conversation;
import weblogic.jws.Policy;
import javax.jws.WebService; import javax.jws.WebMethod;
WebServicename=AsyncMegaPortType, serviceName=AsyncMegaService,
targetNamespace=http:examples.org
Policyuri=AsyncReliableConversationPolicy.xml, attachToWsdl=true
WLHttpTransportcontextPath=asyncMega, serviceUri=AsyncMegaService,
portName=AsyncMegaServicePort
Web Service that is both reliable and conversational. Asynchronous request-response
with buffering You must use the ServiceClient JWS annotation in the client Web service
that invokes the buffered Web service operation. Conversations with Web service
reliable messaging
■
JWS conversations are not the same as reliable sequences, and are not linked in any way. You must consider the management of reliable
sequences separately from the life cycle of a conversation. For example, when using reliable messaging to send messages between a client service
and a reliable and conversational service, finishing the conversation does not terminate the reliable sequence. You must explicitly cause the reliable
sequence to be terminated using WsrmUtils.setFinalMessage or other acceptable method or allows the reliable sequence to remain active
until it expires when the sequence lifetime is exceeded. For more information about reliable message sequence life cycle, see
Section 3.1.2, Managing the Life Cycle of the Reliable Message Sequence
.
■
If you set the property WLStub.CONVERSATIONAL_METHOD_BLOCK_ TIMEOUT
on the stub of the client Web service, the property is ignored because the client does not block.
■
At least one method of the reliable conversational Web service must not be marked with the Oneway annotation.
Conversations with asynchronous request-response
Asynchronous responses between a client conversational Web service and any other Web service also participate in the conversation. For example, assume
WebServiceA is conversational, and it invokes WebServiceB using asynchronous request-response. Because WebServiceA is conversational the
asynchronous responses from WebServiceB also participates in the same conversation.
Table 6–1 Cont. Considerations When Using Asynchronous Features Together
Feature Combination Consideration
Using the Asynchronous Features Together 6-3
public class AsyncMegaServiceImpl implements Serializable { WebMethod
Conversation Conversation.Phase.START public String start {
return Starting conversation; }
WebMethod Conversation Conversation.Phase.CONTINUE
public String middleString message { return Middle of conversation; the message is: + message;
}
WebMethod Conversation Conversation.Phase.FINISH
public String finishString message { return End of conversation; the message is: + message;
}
}
6.3 Example of Client Web Service That Asynchronously Invokes a Reliable Conversational Web Service