webwork/src/main/webwork/view/taglib/soap SoapTag.java,NONE,1.1
[email protected] Mon, 20 May 2002 22:27:00 -0700
| Newsgroups | gmane.comp.java.webwork.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/webwork/webwork/src/main/webwork/view/taglib/soap In directory usw-pr-cvs1:/tmp/cvs-serv11834/main/webwork/view/taglib/soap Added Files: SoapTag.java Log Message: -added support for VoiceXML JSP tags -added support for SOAP JSP tags -updated documentation --- NEW FILE: SoapTag.java --- /* * WebWork, Web Application Framework * * Distributable under Apache license. * See terms of license at opensource.org */ package webwork.view.taglib.soap; import org.apache.log4j.Category; import webwork.config.Configuration; import webwork.util.ContainUtil; import webwork.view.taglib.IncludeTag; import webwork.view.taglib.ParamTag; import webwork.view.taglib.WebWorkTagSupport; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse; import javax.servlet.jsp.PageContext; import javax.servlet.jsp.JspWriter; import javax.servlet.jsp.JspException; import javax.servlet.jsp.JspTagException; import java.util.List; import java.util.ArrayList; import java.io.IOException; import org.apache.axis.client.Call; import org.apache.axis.client.Service; import javax.xml.rpc.namespace.QName; /** * SOAP tag * * @author Jeff Haynie ([email protected]) * @version $Revision: 1.1 $ */ public class SoapTag extends WebWorkTagSupport implements ParamTag.UnnamedParametric { // Attributes ---------------------------------------------------- private static Category log = Category.getInstance(SoapTag.class); protected String endpointAttr; protected String operationAttr; protected String namespaceAttr; protected List params=new ArrayList(); private Call call; /** * set the endpoint */ public void setEndpoint (String value) { endpointAttr=value; } /** * set the operation name */ public void setOperation (String value) { operationAttr = value; } /** * set the operation namespace */ public void setNamespace (String value) { namespaceAttr = value; } /** * Set property in bean */ public void addParameter(Object value) { params.add(value); } public void addParameter(String name, Object value) { params.add(value); } // BodyTag implementation ---------------------------------------- public int doStartTag() throws JspException { try { Service service = new Service(); call = (Call) service.createCall(); String endpoint = (String)findValue(endpointAttr); String namespace = (String)findValue (namespaceAttr); String opName = (String)findValue(operationAttr); call.setTargetEndpointAddress( new java.net.URL(endpoint) ); call.setOperationName(new QName(namespace, opName) ); } catch (Exception e) { try { pageContext.handlePageException(e); } catch (Exception ex) { // Ignore } } // getStack().pushValue(bean); return EVAL_BODY_INCLUDE; } public int doEndTag() throws JspException { // invoke Object bean = null; try { Object args[]=params.toArray(); bean = call.invoke(args); log.debug("SOAP call returned: "+bean); } catch (Exception e) { e.printStackTrace(); try { pageContext.handlePageException(e); } catch (Exception ex) { // Ignore } } // Store as attribute? if(getId() != null && bean!=null) { pageContext.setAttribute(getId(), bean); pageContext.setAttribute(getId(), bean, PageContext.REQUEST_SCOPE); } // getStack().popValue(); call = null; return EVAL_PAGE; } } _______________________________________________________________ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm