1 57 58 package org.apache.soap.providers ; 59 60 import java.io.* ; 61 import javax.servlet.* ; 62 import javax.servlet.http.* ; 63 import org.apache.soap.* ; 64 import org.apache.soap.rpc.* ; 65 import org.apache.soap.server.* ; 66 import org.apache.soap.server.http.* ; 67 import org.apache.soap.util.* ; 68 69 public class MsgJavaProvider implements Provider { 70 private DeploymentDescriptor dd ; 71 private Envelope envelope ; 72 private Call call ; 73 private String methodName ; 74 private String targetObjectURI ; 75 private HttpServlet servlet ; 76 private HttpSession session ; 77 78 private Object targetObject ; 79 80 public void locate( DeploymentDescriptor dd, 81 Envelope env, 82 Call call, 83 String methodName, 84 String targetObjectURI, 85 SOAPContext reqContext) 86 throws SOAPException { 87 88 HttpServlet servlet = (HttpServlet) reqContext.getProperty( Constants.BAG_HTTPSERVLET ); 89 HttpSession session = (HttpSession) reqContext.getProperty( Constants.BAG_HTTPSESSION ); 90 91 this.dd = dd ; 92 this.envelope = env ; 93 this.call = call ; 94 this.methodName = methodName ; 95 this.targetObjectURI = targetObjectURI ; 96 this.servlet = servlet ; 97 this.session = session ; 98 99 ServletConfig config = servlet.getServletConfig(); 100 ServletContext context = config.getServletContext (); 101 ServiceManager serviceManager = 102 ServerHTTPUtils.getServiceManagerFromContext (context); 103 104 if (!MessageRouter.validMessage (dd, methodName)) { 107 throw new SOAPException (Constants.FAULT_CODE_SERVER, 108 "Method '" + methodName + 109 "' is not supported."); 110 } 111 112 targetObject = ServerHTTPUtils.getTargetObject(serviceManager, 114 dd, targetObjectURI, 115 servlet, session, 116 reqContext, 117 context); 118 }; 119 120 121 public void invoke(SOAPContext reqContext, SOAPContext resContext) 122 throws SOAPException { 123 try { 125 MessageRouter.invoke( dd, envelope, targetObject, 126 methodName, reqContext, resContext ); 127 } 128 catch( Exception e ) { 129 if ( e instanceof SOAPException ) throw (SOAPException ) e ; 130 e.printStackTrace( System.err) ; 131 throw new SOAPException( Constants.FAULT_CODE_SERVER, e.toString() ); 132 } 133 }; 134 }; 135 | Popular Tags |