001    package railo.runtime.functions.xml;
002    
003    import org.apache.axis.AxisFault;
004    
005    import railo.runtime.PageContext;
006    import railo.runtime.exp.FunctionException;
007    import railo.runtime.exp.PageException;
008    import railo.runtime.ext.function.Function;
009    import railo.runtime.net.rpc.AxisUtil;
010    import railo.runtime.net.rpc.client.RPCClient;
011    import railo.runtime.op.Caster;
012    
013    public class AddSOAPRequestHeader implements Function {
014    
015            private static final long serialVersionUID = 4305004275924545217L;
016            public static boolean call(PageContext pc, Object client,String nameSpace, String name, Object value) throws PageException {
017                    return call(pc, client, nameSpace, name, value,false);
018            }
019            public static boolean call(PageContext pc, Object client,String nameSpace, String name, Object value, boolean mustUnderstand) throws PageException {
020                    //if(true)throw new FunctionNotSupported("AddSOAPRequestHeader");
021                    if(!(client instanceof RPCClient))
022                            throw new FunctionException(pc, "addSOAPRequestHeader", 1, "webservice", "value must be a webservice Object generated with createObject/<cfobject>");
023                    
024                    try {
025                            AxisUtil.addSOAPRequestHeader((RPCClient) client, nameSpace, name, value, mustUnderstand);
026                    } 
027                    catch (AxisFault e) {
028                            throw Caster.toPageException(e);
029                    }
030                    return true;
031            }
032    }