1 : public interface BillingService {
2 :
3 : public void serviceCompleted(String customer);
4 : }
5 :
6 : ...
7 :
8 : public class MyBillingService implements BillingService {
9 : public void serviceCompleted(String customer) {
10 : calculateInvoice(customer);
11 : }
12 :
13 : public String billingHoroscope(String sign) {
14 : ...
15 : }
16 : }
17 :
18 : public void invoke(SOAPContext reqContext,
19 : SOAPContext resContext) throws SOAPException {
20 :
21 : try {
22 : Response resp = RPCRouter.invoke( dd, call, targetObject,
23 : reqContext, resContext );
24 : if (targetObject instanceOf BillingService) { ((BillingService)targetObject).serviceCompleted(username);
25 : }
26 : Envelope env = resp.buildEnvelope();
27 : StringWriter sw = new StringWriter();
28 : env.marshall( sw, call.getSOAPMappingRegistry(), resContext );
29 : resContext.setRootPart( sw.toString(), Constants.HEADERVAL_CONTENT_TYPE_UTF8);
30 : }
31 : catch( Exception e ) {
32 : if ( e instanceof SOAPException ) throw (SOAPException ) e ;
33 : throw new SOAPException(Constants.FAULT_CODE_SERVER,
34 : e.toString() );
35 : }
36 : }
37 : }