cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: xml-cocoon2/webapp/docs/samples/soap soap-lib.xsl soap.xml
Date Tue, 19 Jun 2001 15:58:17 GMT
dims        01/06/19 08:58:17

  Modified:    webapp/docs/samples/soap Tag: cocoon_20_branch soap-lib.xsl
                        soap.xml
  Added:       lib      Tag: cocoon_20_branch axis-samples.jar axis.jar
  Log:
  - Start using Axis for the SOAP sample.
  - Tested only with Tomcat 3.2.X so far.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +491 -0    xml-cocoon2/lib/Attic/axis-samples.jar
  
  	<<Binary file>>
  
  
  1.1.2.1   +1180 -0   xml-cocoon2/lib/Attic/axis.jar
  
  	<<Binary file>>
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.2   +40 -59    xml-cocoon2/webapp/docs/samples/soap/soap-lib.xsl
  
  Index: soap-lib.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/webapp/docs/samples/soap/soap-lib.xsl,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- soap-lib.xsl	2001/06/15 16:23:48	1.1.2.1
  +++ soap-lib.xsl	2001/06/19 15:58:11	1.1.2.2
  @@ -19,11 +19,12 @@
   				<xsp:include>java.net.*</xsp:include>
   				<xsp:include>java.util.*</xsp:include>
   
  -				<!-- Apache soap support -->
  -				<xsp:include>org.apache.soap.util.xml.*</xsp:include>
  -				<xsp:include>org.apache.soap.*</xsp:include>
  -				<xsp:include>org.apache.soap.rpc.*</xsp:include>
  -				<xsp:include>org.apache.soap.transport.http.*</xsp:include>
  +				<!-- Apache Axis support -->
  +				<xsp:include>org.apache.axis.*</xsp:include>
  +				<xsp:include>org.apache.axis.client.*</xsp:include>
  +				<xsp:include>org.apache.axis.client.http.*</xsp:include>
  +				<xsp:include>org.apache.axis.utils.*</xsp:include>
  +				<xsp:include>org.apache.axis.encoding.*</xsp:include>
   			</xsp:structure>
   
   			<xsl:apply-templates/>
  @@ -35,67 +36,47 @@
   	</xsl:template>
   
   	<xsl:template match="soap:request">
  -		<xsl:variable name="url"><xsl:value-of select="@endpoint"/></xsl:variable>
  -		<xsl:variable name="proxyhost"><xsl:value-of select="@proxyhost"/></xsl:variable>
  -		<xsl:variable name="proxyport"><xsl:value-of select="@proxyport"/></xsl:variable>
  +		<xsl:variable name="endpoint"><xsl:value-of select="@endpoint"/></xsl:variable>
  +		<xsl:variable name="description"><xsl:value-of select="@description"/></xsl:variable>
   
  -
   		<!-- Do not process xp:text -->
   		<xsl:for-each select="./SOAP-ENV:Envelope/SOAP-ENV:Body/*[name()!='xsp:text']">
   			<xsp:logic>
  -			{
  -
  -			Call call = new Call ();
  -
  -			// Service uses standard SOAP encoding
  -			String encodingStyleURI = org.apache.soap.Constants.NS_URI_SOAP_ENC;
  -			call.setEncodingStyleURI(encodingStyleURI);
  -
  -			// Set service locator parameters
  -			call.setTargetObjectURI("<xsl:value-of select="namespace-uri()"/>");
  -			call.setMethodName("<xsl:value-of select="local-name()"/>");
  -
  -			// Create input parameter vector
  -			Vector params = new Vector ();
  -
  -			// All parms
  -			<!-- TODO: Add support for mapping java parameters to soap parameters -->
  -			<xsl:for-each select="*[name() != 'xsp:text']">
  -				<xsl:variable name="text"><xsl:value-of select="./text()"/></xsl:variable>
  -	
  -				params.addElement(new Parameter("<xsl:value-of select="name()"/>", String.class,
"<xsl:value-of select="xsp:text"/>", null));
  -			</xsl:for-each>
  -
  -			call.setParams (params);
  -
  -			// Invoke the service ....
   			try {
  -
  -				URL url = new URL("<xsl:value-of select="$url"/>");
  -				Response resp = call.invoke(url,"");
  -
  -			     	 // ... and evaluate the response
  -				if (resp.generatedFault ()) {
  -					Fault fault = resp.getFault();
  -			            <xsp:content>
  -						<faultcode><xsp:expr>fault.getFaultCode()</xsp:expr></faultcode>
  -						<faultstring><xsp:expr>fault.getFaultString()</xsp:expr></faultstring>
  -					</xsp:content>
  -				} else {
  -					<!-- TODO: Output response envelope in XML -->
  -					<xsp:content>
  -						<response><xsp:expr>resp.toString()</xsp:expr></response>
  -					</xsp:content>
  -				}
  -			} catch (MalformedURLException ex) {
  -				<xsp:content>
  -					<malformedurlexception><xsp:expr>ex.getMessage()</xsp:expr></malformedurlexception>
  -				</xsp:content>
  -			} catch (SOAPException ex) {
  +                // Create input parameter vector
  +                Vector params = new Vector ();
  +                String action = "<xsl:value-of select="namespace-uri()"/>";
  +
  +                // All parameters.
  +                <!-- TODO: Add support for mapping java parameters to soap parameters
-->
  +                <xsl:for-each select="*[name() != 'xsp:text']">
  +	                <xsl:variable name="text"><xsl:value-of select="./text()"/></xsl:variable>
  +	                params.addElement("<xsl:value-of select="xsp:text"/>");
  +                </xsl:for-each>
  +
  +                ServiceClient call = new ServiceClient (
  +                       new HTTPTransport("<xsl:value-of select="$endpoint"/>", action));
  +                ServiceDescription sd = new ServiceDescription("<xsl:value-of select="$description"/>",
true);
  +                call.setServiceDescription(sd);
  +
  +                Object ret = call.invoke( action, "<xsl:value-of select="local-name()"/>",
params.toArray() );
  +
  +                if (ret instanceof String) {
  +                  System.out.println("Received problem response from server: "+ret);
  +                  throw new AxisFault("", (String)ret, null, null);
  +                }
  +                <xsp:content>
  +                    <response><xsp:expr>ret.toString()</xsp:expr></response>
  +                </xsp:content>
  +			} catch (Exception e) {
  +                if ( e instanceof AxisFault ) {
  +                    ((AxisFault)e).dump();
  +                } else {
  +                    e.printStackTrace();
  +                }
   				<xsp:content>
  -					<soapexception><xsp:expr>ex.getMessage()</xsp:expr></soapexception>
  +					<soapexception><xsp:expr>e.getMessage()</xsp:expr></soapexception>
   				</xsp:content>
  -			}
   			}
   			</xsp:logic>
   		</xsl:for-each>
  
  
  
  1.1.2.4   +23 -1     xml-cocoon2/webapp/docs/samples/soap/soap.xml
  
  Index: soap.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/webapp/docs/samples/soap/soap.xml,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- soap.xml	2001/06/15 18:11:22	1.1.2.3
  +++ soap.xml	2001/06/19 15:58:13	1.1.2.4
  @@ -5,8 +5,30 @@
   	xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
   >
   <page>
  +	<call source="axis">
  +		<soap:request description="stockQuotes" endpoint="http://localhost:8080/cocoon/servlet/org.apache.axis.transport.http.AxisServlet">
  +			<SOAP-ENV:Envelope xsi="http://www.w3.org/1999/XMLSchema-instance" xsd="http://www.w3.org/1999/XMLSchema">

  +				<SOAP-ENV:Body > 
  +					<ns1:getQuote xmlns:ns1="urn:xmltoday-delayed-quotes" xmlns_ns1="urn:xmltoday-delayed-quotes"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> 
  +						<ticker xsi_type="xsd:string">SUNW</ticker> 
  +					</ns1:getQuote> 
  +				</SOAP-ENV:Body> 
  +			</SOAP-ENV:Envelope> 
  +		</soap:request>
  +	</call>
  +	<call source="axis">
  +		<soap:request description="stockQuotes" endpoint="http://localhost:8080/cocoon/servlet/org.apache.axis.transport.http.AxisServlet">
  +			<SOAP-ENV:Envelope xsi="http://www.w3.org/1999/XMLSchema-instance" xsd="http://www.w3.org/1999/XMLSchema">

  +				<SOAP-ENV:Body > 
  +					<ns1:getQuote xmlns:ns1="urn:xmltoday-delayed-quotes" xmlns_ns1="urn:xmltoday-delayed-quotes"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> 
  +						<ticker xsi_type="xsd:string">IBM</ticker> 
  +					</ns1:getQuote> 
  +				</SOAP-ENV:Body> 
  +			</SOAP-ENV:Envelope> 
  +		</soap:request>
  +	</call>
   	<call source="xmethods">
  -		<soap:request endpoint="http://services.xmethods.net:80/soap/servlet/rpcrouter">
  +		<soap:request description="getTemp" endpoint="http://services.xmethods.net:80/soap/servlet/rpcrouter">
   			<SOAP-ENV:Envelope xsi="http://www.w3.org/1999/XMLSchema-instance" xsd="http://www.w3.org/1999/XMLSchema">

   				<SOAP-ENV:Body > 
   					<ns1:getTemp xmlns:ns1="urn:xmethods-Temperature" xmlns_ns1="urn:xmethods-Temperature"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> 
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message