1 /* zxidwspaxisout.java  -  Handler for Axis2 module for TAS3 WSP
2  * Copyright (c) 2009 Symlabs (symlabs@symlabs.com), All Rights Reserved.
3  * Author: Sampo Kellomaki (sampo@iki.fi)
4  * This is confidential unpublished proprietary source code of the author.
5  * NO WARRANTY, not even implied warranties. Contains trade secrets.
6  * Distribution prohibited unless authorized in writing.
7  * Licensed under Apache License 2.0, see file COPYING.
8  * $Id: zxidappdemo.java,v 1.4 2009-11-29 12:23:06 sampo Exp $
9  * 15.12.2009, created --Sampo
10  *
11  * See also: zxid-java.pd, zxidwspdemo.java for server side
12  */
13 
14 package zxidjava;
15 
16 import zxidjava.*;   // Pull in the zxidjni.az() API
17 import java.io.*;
18 import java.util.Iterator;
19 import javax.xml.namespace.QName;
20 
21 import org.apache.axiom.om.OMElement;
22 import org.apache.axiom.soap.SOAPHeader;
23 import org.apache.axiom.soap.SOAPHeaderBlock;
24 import org.apache.axis2.AxisFault;
25 import org.apache.axis2.context.MessageContext;
26 import org.apache.axis2.handlers.AbstractHandler;
27 import org.apache.axis2.util.XMLUtils;
28 import org.apache.ws.security.processor.SAMLTokenProcessor;
29 import org.w3c.dom.Element;
30 
31 public class zxidwspaxisout extends AbstractHandler {
32 
33     static final String conf = "URL=http://sp1.zxidsp.org:8080/sso&PATH=/var/zxid/";
34     static zxidjava.zxid_conf cf;
35     static {
36 	// CONFIG: You must have created /var/zxid directory hierarchy. See `make dir'
37 	// CONFIG: You must create edit the URL to match your domain name and port
38 	System.loadLibrary("zxidjni");
39 	cf = zxidjni.new_conf_to_cf(conf);
zxidjni.set_opt(cf, 1, 1)40 	zxidjni.set_opt(cf, 1, 1);
41     }
42 
zxidwspaxisout()43     public zxidwspaxisout() {
44 	// Constructor
45     }
46 
invoke(MessageContext context)47     public InvocationResponse invoke(MessageContext context) throws AxisFault {
48         if (!context.isEngaged(zxidwspaxismod.MODULE_NAME)) {
49             return InvocationResponse.CONTINUE;
50         }
51 	String env = mctx.getEnvelope().toString();
52 	System.err.print("wsp out processing env("+env+").\n");
53 	String ret = zxidjni.wsp_decorate(cf, ses, null, env);
54 	System.err.print("wsp out decorated("+ret+").\n");
55 	// *** Conversion of ret string to mctx.Envelope object missing
56 
57         return InvocationResponse.CONTINUE;
58     }
59 
60 }
61 
62 /* EOF */
63