KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis2 > services > OutService


1 package org.apache.axis2.services;
2
3 import org.apache.axis2.om.OMAbstractFactory;
4 import org.apache.axis2.om.OMNode;
5 import org.apache.axis2.soap.SOAPEnvelope;
6 import org.apache.axis2.soap.SOAPFactory;
7 import org.apache.commons.logging.Log;
8 import org.apache.commons.logging.LogFactory;
9
10 import java.util.Date JavaDoc;
11
12 /**
13  * Created by IntelliJ IDEA.
14  * Author : Deepal Jayasinghe
15  * Date: Mar 16, 2005
16  * Time: 3:56:50 PM
17  */

18
19 public class OutService extends Thread JavaDoc{
20     protected Log log = LogFactory.getLog(getClass());
21
22     public void run() {
23         while(true){
24             sentOutMessage();
25         }
26     }
27
28     private void sentOutMessage() {
29         SOAPFactory omFactory = OMAbstractFactory.getSOAP11Factory();
30         SOAPEnvelope env = omFactory.getDefaultEnvelope();
31         OMNode testNode = omFactory.createText("This is auto generated messge by the server at " + new Date JavaDoc());
32         env.getBody().addChild(testNode);
33         log.info("Generated Message" + env.getBody().getFirstChild());
34
35         /*EndpointReference targetEPR = null;
36         String action = null;
37         Writer out = null;
38         try {
39         final AxisEngine engine = new AxisEngine();
40         MessageContext msgctx = new MessageContext(registry, null, null,Utils.createHTTPTransport(registry));
41         msgctx.setEnvelope(env);
42         msgctx.setTo(targetEPR);
43
44         msgctx.setTo(targetEPR);
45         if (action != null) {
46         msgctx.setProperty(MessageContext.SOAP_ACTION, action);
47         }
48         engine.send(msgctx);
49         } catch (IOException e) {
50         throw AxisFault.makeFault(e);
51         } finally {
52         try {
53         out.close();
54         } catch (IOException e1) {
55         throw new AxisFault();
56         }
57         }
58 */

59     }
60 }
61
Popular Tags