1 57 58 package org.apache.soap.server; 59 60 import org.apache.soap.util.Bean; 61 import org.apache.soap.SOAPException; 62 import org.apache.soap.Constants; 63 import org.apache.soap.server.DeploymentDescriptor; 64 import com.ibm.bsf.*; 65 66 67 77 public class InvokeBSF { 78 79 88 public static void init (DeploymentDescriptor dd, Object target, 89 String scriptStr) throws SOAPException { 90 try { 91 BSFManager mgr = (BSFManager) target; 92 mgr.exec (dd.getScriptLanguage (), "service script for '" + 93 dd.getID () + "'", 0, 0, scriptStr); 94 } catch (BSFException e) { 95 throw new SOAPException (Constants.FAULT_CODE_SERVER, 96 "BSF Error: " + e.getMessage (), e); 97 } 98 } 99 100 112 public static Bean service (DeploymentDescriptor dd, Object target, 113 String methodName, Object [] args) 114 throws SOAPException { 115 try { 116 BSFManager mgr = (BSFManager) target; 117 BSFEngine eng = mgr.loadScriptingEngine (dd.getScriptLanguage ()); 118 Object result = eng.call (null, methodName, args); 119 return new Bean ((result != null) ? result.getClass () : Object .class, 120 result); 121 } catch (BSFException e) { 122 throw new SOAPException (Constants.FAULT_CODE_SERVER, 123 "BSF Error: " + e.getMessage (), e); 124 } 125 } 126 } 127 | Popular Tags |