Java EE Web Service client Quality report (ii)

Source: Internet
Author: User
Tags soap web services

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.