Server Web Services Package
The Server Web service package can be automatically generated. In Sun One studio, the creation of a Web module simply selects a set of EJB Java methods, and the Web Service package's classes can be created by the Web module.
The package contains many classes and interfaces. One of the key points here is the Servantinterface_tie class, in which the service name is . The class tie is the topmost stack of the Web service module, which binds the introduced service invocation to the EJB component that created it. We just need to modify the class tie to add the number of records.
The tie includes many methods, but we just need to modify the method associated with the EJB business method Invoke_ . In method Invoke_ , represents the name of the EJB business method. We add an import payload.*; Onto the tie and made a small change to each business method. Let's look at the following method Invoke_submitwork ():
/*
* This method does the actual method invocation for Operation:submitwork
*/
private void Invoke_submitwork (Streaminghandlerstate state) throws Exception {
Transactionservice.xactservicegenserver.
xactserviceservantinterface_submitwork_requeststruct
myxactserviceservantinterface_submitwork_requeststruct = null;
Object myxactserviceservantinterface_submitwork_requeststructobj =
State.getrequest (). GetBody (). GetValue ();
/* Line added to generated method: * *
Serializer.queuefirstattachmenttext (State.getmessagecontext ());
if (myxactserviceservantinterface_submitwork_requeststructobj
instanceof soapdeserializationstate) {
myxactserviceservantinterface_submitwork_requeststruct =
(transactionservice.xactservicegenserver.
xactserviceservantinterface_submitwork_requeststruct)
((soapdeserializationstate)
myxactserviceservantinterface_submitwork_requeststructobj)
. getinstance ();
} else {
myxactserviceservantinterface_submitwork_requeststruct =
(transactionservice.xactservicegenserver.
xactserviceservantinterface_submitwork_requeststruct)
Myxactserviceservantinterface_submitwork_requeststructobj;
}
java.lang.String result =
((TransactionService.XactServiceGenServer.XactServiceServantInterface)
Gettarget ()). Submitwork
(Myxactserviceservantinterface_submitwork_requeststruct.getstring_1 ());
Transactionservice.xactservicegenserver.
xactserviceservantinterface_submitwork_responsestruct
myxactserviceservantinterface_submitwork_responsestruct =
New Transactionservice.xactservicegenserver
. Xactserviceservantinterface_submitwork_responsestruct ();
Soapheaderblockinfo HeaderInfo;
Myxactserviceservantinterface_submitwork_responsestruct.setresult (Result);
soapblockinfo bodyblock = new Soapblockinfo
(Ns1_submitwork_submitworkresponse_qname);
Bodyblock.setvalue (myxactserviceservantinterface_submitwork_responsestruct);
Bodyblock.setserializer
(Myxactserviceservantinterface_submitwork_responsestruct_soapserializer);
state.getresponse (). Setbody (Bodyblock);
}
We added a single line to Invoke_submitwork ():
Serializer.queueFirstAttachmentText(state.getMessageContext());
Getmessagecontext () Returns the object that implements the interface Javax.xml.rpc.handler.soap.SOAPMessageContext. This object provides access to the current soap information. We pass the object that implements the interface Soapmessagecontext to a static method in Payload.serializer. The static method obtains the XML string from the first information attachment and queues it to wait for the number of calls to the processor EJB component.
We have made the same modifications to each Invoke_ method.