Author: chinthaka
Date: Mon Oct 2 03:23:09 2006
New Revision: 451950
URL: http://svn.apache.org/viewvc?view=rev&rev=451950
Log:
- Adding fault handling samples in https://issues.apache.org/jira/browse/AXIS2-917
- committing the last patch in https://issues.apache.org/jira/browse/AXIS2-1270
Added:
webservices/axis2/trunk/java/modules/samples/FaultHandling/
webservices/axis2/trunk/java/modules/samples/FaultHandling/META-INF/
webservices/axis2/trunk/java/modules/samples/FaultHandling/META-INF/MANIFEST.MF
webservices/axis2/trunk/java/modules/samples/FaultHandling/ReadMe.html
webservices/axis2/trunk/java/modules/samples/FaultHandling/bank.wsdl
webservices/axis2/trunk/java/modules/samples/FaultHandling/build.xml
webservices/axis2/trunk/java/modules/samples/FaultHandling/client/
webservices/axis2/trunk/java/modules/samples/FaultHandling/client/build.xml
webservices/axis2/trunk/java/modules/samples/FaultHandling/client/src/
webservices/axis2/trunk/java/modules/samples/FaultHandling/client/src/example/
webservices/axis2/trunk/java/modules/samples/FaultHandling/client/src/example/BankClient.java
webservices/axis2/trunk/java/modules/samples/FaultHandling/service/
webservices/axis2/trunk/java/modules/samples/FaultHandling/service/build.xml
Modified:
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/TestClassTemplate.xsl
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/TestObjectCreationTemplate.xsl
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/Constants.java
webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java
webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/template/XmlbeansDatabindingTemplate.xsl
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java?view=diff&rev=451950&r1=451949&r2=451950
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java Mon Oct 2 03:23:09 2006
@@ -18,6 +18,7 @@
import org.apache.commons.logging.LogFactory;
import org.apache.neethi.Policy;
import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.woden.internal.util.dom.DOM2Writer;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -475,7 +476,7 @@
doc.appendChild(rootElement);
//////////////////////////////////////////////////////////
- //System.out.println(DOM2Writer.nodeToString(rootElement));
+// System.out.println(DOM2Writer.nodeToString(rootElement));
////////////////////////////////////////////////////////////
return doc;
}
@@ -969,7 +970,7 @@
doc.appendChild(rootElement);
//////////////////////////////////////////////////////////
- //System.out.println(DOM2Writer.nodeToString(rootElement));
+// System.out.println(DOM2Writer.nodeToString(rootElement));
////////////////////////////////////////////////////////////
return doc;
@@ -1094,7 +1095,7 @@
}
///////////////////////////////////////////////
- //System.out.println(DOM2Writer.nodeToString(rootElement));
+// System.out.println("databinding root element " + DOM2Writer.nodeToString(rootElement));
////////////////////////////////////////////////
return rootElement;
@@ -1874,7 +1875,8 @@
qName),
operation.getName(),
qName.getLocalPart(),
- (this.mapper.getTypeMappingStatus(qName)!=null))
+ (this.mapper.getTypeMappingStatus(qName)!=null),
+ Constants.ARRAY_TYPE.equals(this.mapper.getTypeMappingStatus(qName)))
);
}
@@ -1904,7 +1906,7 @@
String paramName,
String paramType,
QName operationName) {
- return generateParamComponent(doc,paramName,paramType,operationName,null,false);
+ return generateParamComponent(doc,paramName,paramType,operationName,null,false,false);
}
@@ -1919,7 +1921,7 @@
protected Element generateParamComponent(Document doc,
String paramName,
String paramType) {
- return generateParamComponent(doc,paramName,paramType,null,null,false);
+ return generateParamComponent(doc,paramName,paramType,null,null,false,false);
}
/**
@@ -1937,7 +1939,8 @@
String paramType,
QName opName,
String partName,
- boolean isPrimitive) {
+ boolean isPrimitive,
+ boolean isArray) {
Element paramElement = doc.createElement("param");
addAttribute(doc, "name",
paramName, paramElement);
@@ -1970,6 +1973,10 @@
if (isPrimitive){
addAttribute(doc,"primitive","yes",paramElement);
+ }
+
+ if (isArray){
+ addAttribute(doc,"array","yes",paramElement);
}
return paramElement;
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/TestClassTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/TestClassTemplate.xsl?view=diff&rev=451950&r1=451949&r2=451950
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/TestClassTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/TestClassTemplate.xsl Mon Oct 2 03:23:09 2006
@@ -53,21 +53,11 @@
<xsl:variable name="opname" select="@opname"/>
<xsl:variable name="paramname" select="@name"/>
<xsl:variable name="paramcount" select="count(param[@type!='' and @opname=$opname])"/>
- <xsl:variable name="shorttype" select="@shorttype"/>
- <xsl:variable name="complextype" select="@complextype"/>
<xsl:choose>
<xsl:when test="$paramcount > 0">
<xsl:for-each select="param[@type!='' and @opname=$opname]">
- <xsl:choose>
- <xsl:when test="string-length(normalize-space($complextype)) > 0">
- <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="$paramname"/>.get<xsl:value-of select="$shorttype"/>().get<xsl:value-of
- select="@partname"/>()
- </xsl:when>
- <xsl:otherwise>
- <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="$paramname"/>.get<xsl:value-of select="@partname"/>()
- </xsl:otherwise>
- </xsl:choose>
+ <xsl:if test="position()>1">,</xsl:if>get<xsl:value-of select="@partname"/>(<xsl:value-of select="$paramname"/>)
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
@@ -83,21 +73,11 @@
<xsl:variable name="opname" select="@opname"/>
<xsl:variable name="paramname" select="@name"/>
<xsl:variable name="paramcount" select="count(param[@type!='' and @opname=$opname])"/>
- <xsl:variable name="shorttype" select="@shorttype"/>
- <xsl:variable name="complextype" select="@complextype"/>
<xsl:choose>
<xsl:when test="$paramcount > 0">
<xsl:for-each select="param[@type!='' and @opname=$opname]">
- <xsl:choose>
- <xsl:when test="string-length(normalize-space($complextype)) > 0">
- <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="$paramname"/>.get<xsl:value-of select="$shorttype"/>().get<xsl:value-of
- select="@partname"/>()
- </xsl:when>
- <xsl:otherwise>
- <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="$paramname"/>.get<xsl:value-of select="@partname"/>()
- </xsl:otherwise>
- </xsl:choose>
+ <xsl:if test="position()>1">,</xsl:if>get<xsl:value-of select="@partname"/>(<xsl:value-of select="$paramname"/>)
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
@@ -147,21 +127,11 @@
<xsl:variable name="opname" select="@opname"/>
<xsl:variable name="paramname" select="@name"/>
<xsl:variable name="paramcount" select="count(param[@type!='' and @opname=$opname])"/>
- <xsl:variable name="shorttype" select="@shorttype"/>
- <xsl:variable name="complextype" select="@complextype"/>
<xsl:choose>
<xsl:when test="$paramcount > 0">
<xsl:for-each select="param[@type!='' and @opname=$opname]">
- <xsl:choose>
- <xsl:when test="string-length(normalize-space($complextype)) > 0">
- <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="$paramname"/>.get<xsl:value-of select="$shorttype"/>().get<xsl:value-of
- select="@partname"/>()
- </xsl:when>
- <xsl:otherwise>
- <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="$paramname"/>.get<xsl:value-of select="@partname"/>()
- </xsl:otherwise>
- </xsl:choose>
+ <xsl:if test="position()>1">,</xsl:if>get<xsl:value-of select="@partname"/>(<xsl:value-of select="$paramname"/>)
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
@@ -221,20 +191,11 @@
<xsl:variable name="paramname" select="@name"/>
<xsl:variable name="paramcount" select="count(param[@type!='' and @opname=$opname])"/>
<xsl:variable name="shorttype" select="@shorttype"/>
- <xsl:variable name="complextype" select="@complextype"/>
<xsl:choose>
<xsl:when test="$paramcount > 0">
<xsl:for-each select="param[@type!='' and @opname=$opname]">
- <xsl:choose>
- <xsl:when test="string-length(normalize-space($complextype)) > 0">
- <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="$paramname"/>.get<xsl:value-of select="$shorttype"/>().get<xsl:value-of
- select="@partname"/>()
- </xsl:when>
- <xsl:otherwise>
- <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="$paramname"/>.get<xsl:value-of select="@partname"/>()
- </xsl:otherwise>
- </xsl:choose>
+ <xsl:if test="position()>1">,</xsl:if>get<xsl:value-of select="@partname"/>(<xsl:value-of select="$paramname"/>)
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/TestObjectCreationTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/TestObjectCreationTemplate.xsl?view=diff&rev=451950&r1=451949&r2=451950
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/TestObjectCreationTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/TestObjectCreationTemplate.xsl Mon Oct 2 03:23:09 2006
@@ -1,5 +1,7 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
+ <xsl:key name="paramsIn" match="//databinders/param[@direction='in']" use="@type"/>
+ <xsl:key name="innerParams" match="//databinders/param[@direction='in']/param" use="@partname"/>
<!-- ################################################################################# -->
<!-- ############################ xmlbeans template ############################## -->
@@ -26,6 +28,42 @@
}
+ <xsl:for-each select="opnames/name">
+
+ <xsl:variable name="opname" select="."/>
+
+ <xsl:if test="count(../../param[@type!='' and @direction='in' and @opname=$opname])=1">
+ <!-- generate the get methods -->
+ <xsl:variable name="inputElement" select="../../param[@type!='' and @direction='in' and @opname=$opname]"></xsl:variable>
+ <xsl:variable name="inputElementType" select="../../param[@type!='' and @direction='in' and @opname=$opname]/@type"></xsl:variable>
+ <xsl:variable name="inputElementShortType" select="../../param[@type!='' and @direction='in' and @opname=$opname]/@shorttype"></xsl:variable>
+
+ <xsl:for-each select="../../param[@type!='' and @direction='in' and @opname=$opname]/param">
+ <xsl:variable name="paramElement" select="."></xsl:variable>
+ <xsl:variable name="partName" select="@partname"></xsl:variable>
+
+ <xsl:if test="(generate-id($paramElement) = generate-id(key('innerParams', $partName)[1])) or
+ (generate-id($inputElement) = generate-id(key('paramsIn', $inputElementType)[1]))">
+
+ private <xsl:value-of select="@type"/> get<xsl:value-of select="@partname"/>(
+ <xsl:value-of select="../@type"/> wrappedType){
+
+ <!-- there is not difference betwee having a seperate complex type and the
+ inline complex type implementation -->
+ <xsl:choose>
+ <xsl:when test="@array">
+ return wrappedType.get<xsl:value-of select="substring-before($inputElementShortType,'Document')"/>().xget<xsl:value-of select="$partName"/>Array();
+ </xsl:when>
+ <xsl:otherwise>
+ return wrappedType.get<xsl:value-of select="substring-before($inputElementShortType,'Document')"/>().xget<xsl:value-of select="$partName"/>();
+ </xsl:otherwise>
+ </xsl:choose>
+ }
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:if>
+ </xsl:for-each>
+
</xsl:template>
<!-- ################################################################################# -->
<!-- ############################ jaxme template ############################## -->
@@ -50,6 +88,42 @@
public org.apache.axis2.databinding.ADBBean getTestObject(java.lang.Class type) throws Exception{
return (org.apache.axis2.databinding.ADBBean) type.newInstance();
}
+
+ <!-- generate the getter methods for each databinders if it is in uwwrapped mode -->
+ <xsl:for-each select="opnames/name">
+ <xsl:variable name="opname" select="."/>
+
+ <xsl:if test="count(../../param[@type!='' and @direction='in' and @opname=$opname])=1">
+ <!-- generate the get methods -->
+ <xsl:variable name="inputElement" select="../../param[@type!='' and @direction='in' and @opname=$opname]"></xsl:variable>
+ <xsl:variable name="inputElementType" select="../../param[@type!='' and @direction='in' and @opname=$opname]/@type"></xsl:variable>
+ <xsl:variable name="inputElementShortType" select="../../param[@type!='' and @direction='in' and @opname=$opname]/@shorttype"></xsl:variable>
+ <xsl:variable name="inputElementComplexType" select="../../param[@type!='' and @direction='in' and @opname=$opname]/@complextype"></xsl:variable>
+
+ <xsl:for-each select="../../param[@type!='' and @direction='in' and @opname=$opname]/param">
+
+ <xsl:variable name="paramElement" select="."></xsl:variable>
+ <xsl:variable name="partName" select="@partname"></xsl:variable>
+
+ <xsl:if test="(generate-id($paramElement) = generate-id(key('innerParams', $partName)[1])) or
+ (generate-id($inputElement) = generate-id(key('paramsIn', $inputElementType)[1]))">
+
+ private <xsl:value-of select="@type"/> get<xsl:value-of select="@partname"/>(
+ <xsl:value-of select="../@type"/> wrappedType){
+ <xsl:choose>
+ <!--<xsl:when test="$inputElementComplexType != ''">-->
+ <xsl:when test="string-length(normalize-space($inputElementComplexType)) > 0">
+ return wrappedType.get<xsl:value-of select="$inputElementShortType"/>().get<xsl:value-of select="@partname"/>();
+ </xsl:when>
+ <xsl:otherwise>
+ return wrappedType.get<xsl:value-of select="@partname"/>();
+ </xsl:otherwise>
+ </xsl:choose>
+ }
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:if>
+ </xsl:for-each>
</xsl:template>
<!-- ################################################################################# -->
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/Constants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/Constants.java?view=diff&rev=451950&r1=451949&r2=451950
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/Constants.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/Constants.java Mon Oct 2 03:23:09 2006
@@ -16,6 +16,8 @@
package org.apache.axis2.wsdl.util;
+import java.util.List;
+
public interface Constants {
String BASE_64_PROPERTY_KEY = "base64map";
@@ -28,6 +30,7 @@
String UNWRAPPED_DETAILS = "UnWrapped_details";
String COMPLEX_TYPE = "complexType";
+ String ARRAY_TYPE = "arrayType";
public static final String ANY_ELEMENT_FIELD_NAME = "extraElement";
@@ -38,14 +41,14 @@
called by the message receiver code generation in order to process the
OMElement and invoke the service method. */
String DATABINDING_GENERATED_RECEIVER = "databinding-generated-receiver";
-
+
/** Property for interface implementation method handled by databinding
code generation. This is an optional parameter for an {@link
org.apache.axis2.description.AxisOperation}. If present, the value is a
<code>Boolean</code> flag to indicate that the method corresponding to that
operation will be generated by the data binding code generation. */
String DATABINDING_GENERATED_IMPLEMENTATION = "databinding-generated-implementation";
-
+
/** Property for details to be passed inside the <databinders> element.
This is an optional parameter for an {@link
org.apache.axis2.description.AxisOperation}. If present, the value is a DOM
Added: webservices/axis2/trunk/java/modules/samples/FaultHandling/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/samples/FaultHandling/META-INF/MANIFEST.MF?view=auto&rev=451950
==============================================================================
--- webservices/axis2/trunk/java/modules/samples/FaultHandling/META-INF/MANIFEST.MF (added)
+++ webservices/axis2/trunk/java/modules/samples/FaultHandling/META-INF/MANIFEST.MF Mon Oct 2 03:23:09 2006
@@ -0,0 +1,4 @@
+Manifest-Version: 1.0
+Ant-Version: Apache Ant 1.6.2
+Created-By: 1.5.0_04-b05 (Sun Microsystems Inc.)
+
Added: webservices/axis2/trunk/java/modules/samples/FaultHandling/ReadMe.html
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/samples/FaultHandling/ReadMe.html?view=auto&rev=451950
==============================================================================
--- webservices/axis2/trunk/java/modules/samples/FaultHandling/ReadMe.html (added)
+++ webservices/axis2/trunk/java/modules/samples/FaultHandling/ReadMe.html Mon Oct 2 03:23:09 2006
@@ -0,0 +1,109 @@
+<head>
+</head>
+
+<body>
+ <h1>
+ Exception Handling using WSDL Faults
+ </h1>
+ <p>
+ This example show cases how to specify a WSDL fault in order to allow
+ your service to communicate exception pathways to your clients.
+ </p>
+ <p>
+ Before you start you will need to set the <em>AXIS2_HOME</em> environment variable.
+ </p>
+ <h2>
+ Constructing the Service and the Client.
+ </h2>
+ <p>
+ The first step is to generate the service skeleton and other interface classes from the WSDL.
+ </p>
+ <p>
+ Look at <em>bank.wsdl</em>.
+ It defines the interface for our service. Of particular interest are
+ the <strong>AccountNotExistFault</strong> and <strong>InsufficientFundFault</strong>
+ types defined in the wsdl:types element.
+ </p>
+ <p>
+ From a command prompt in the folder of this example,
+ type <strong>ant generate.service</strong>. This will:
+ <ul>
+ <li>Generate the source for all the server classes in <strong>./service/target/src</strong></li>
+ <li>
+ Generate <em>services.xml</em> and a more complete
+ <em>BankService.wsdl</em> into the <em>./service//target/resources</em> folder.
+ </li>
+ <li>
+ Generate a <em>./service/target/build.xml</em> which can be used to
+ build the service archive using Ant
+ </li>
+ </ul>
+ </p>
+ <p>
+ Open up <em>./service/target/src/example/BankServiceSkeleton.java</em> and
+ insert the code below into the <strong>#withdraw</strong> method.
+
+ <pre>
+ final String account = param0.getAccount();
+ if (account.equals("13")) {
+ final AccountNotExistFault fault = new AccountNotExistFault();
+ fault.setAccount(account);
+ throw new AccountNotExistFaultMessageException("Account does not exist!", fault);
+ }
+
+ final int amount = param0.getAmount();
+ if (amount > 1000) {
+ final InsufficientFundFault fault = new InsufficientFundFault();
+ fault.setAccount(account);
+ fault.setBalance(1000);
+ fault.setRequestedFund(amount);
+ throw new InsufficientFundFaultMessageException("Insufficient funds", fault);
+ }
+
+ final WithdrawResponse response = new WithdrawResponse();
+ response.setBalance(1000 - amount);
+ return response;
+ </pre>
+ </p>
+ <p>
+ From a command prompt in the folder of this example, type <strong>ant jar</strong>. This will
+
+ and create the service archive at <em>./service/target/build/lib/BankService.aar</em>
+ <ul>
+ <li>Compile the Java classes for the service</li>
+ <li>Create the service archive and copy it to <em>./BankService.aar</em></li>
+ <li>Generate the stubs (for the client) from the WSDL</li>
+ <li>Compile the client classes</li>
+ <li>Create a Jar of the client classes and copy it to <em>./BankService-test-client.jar</em></li>
+ </ul>
+ </p>
+ <p>
+ Note that the source generated for the client will include the 2 faults and the local Exceptions
+ through which they will be transmitted. Note that the Exceptions are generated within the <em>BankStub</em> class.
+ </p>
+
+ <h2>
+ Running the Client.
+ </h2>
+ <p>
+ Deploy the service archive to the Axis2 web application.
+ </p>
+ <p>
+ Invoke the <em>example.BankClient</em> class. You may use the command scripts to do so.
+ You need to supply 3 parameters to the command, url, account and amount.
+ <ul>
+ <li>
+ <strong>run http://localhost:8080/axis2/services/BankService 13 400</strong><br/>
+ Throws AccountNotExistFaultMessageException<br/>
+ </li>
+ <li>
+ <strong>run http://localhost:8080/axis2/services/BankService 88 1200</strong><br/>
+ Throws InsufficientFundsFaultMessageException<br/>
+ </li>
+ <li>
+ <strong>run http://localhost:8080/axis2/services/BankService 88 400</strong><br/>
+ Succeeds with a balance of 600<br/>
+ </li>
+ </ul>
+ </p>
+</body>
\ No newline at end of file
Added: webservices/axis2/trunk/java/modules/samples/FaultHandling/bank.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/samples/FaultHandling/bank.wsdl?view=auto&rev=451950
==============================================================================
--- webservices/axis2/trunk/java/modules/samples/FaultHandling/bank.wsdl (added)
+++ webservices/axis2/trunk/java/modules/samples/FaultHandling/bank.wsdl Mon Oct 2 03:23:09 2006
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions targetNamespace="http://example"
+ xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:tns="http://example"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://example"
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:apachesoap="http://xml.apache.org/xml-soap"
+ xmlns:tns="http://example" xmlns:intf="http://example"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+
+ <element name="withdraw">
+ <complexType>
+ <sequence>
+ <element name="account" type="xsd:string"/>
+ <element name="amount" type="xsd:int"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="withdrawResponse">
+ <complexType>
+ <sequence>
+ <element name="balance" type="xsd:int"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="AccountNotExistFault">
+ <complexType>
+ <sequence>
+ <element name="account" type="xsd:string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="InsufficientFundFault">
+ <complexType>
+ <sequence>
+ <element name="account" type="xsd:string"/>
+ <element name="balance" type="xsd:int"/>
+ <element name="requestedFund" type="xsd:int"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="withdrawRequest">
+ <wsdl:part element="tns:withdraw" name="parameters"/>
+ </wsdl:message>
+
+ <wsdl:message name="withdrawResponse">
+ <wsdl:part element="tns:withdrawResponse" name="return"/>
+ </wsdl:message>
+
+ <wsdl:message name="InsufficientFundFaultMessage">
+ <wsdl:part element="tns:InsufficientFundFault" name="fault"/>
+ </wsdl:message>
+
+ <wsdl:message name="AccountNotExistFaultMessage">
+ <wsdl:part element="tns:AccountNotExistFault" name="fault"/>
+ </wsdl:message>
+
+ <wsdl:portType name="Bank">
+ <wsdl:operation name="withdraw">
+ <wsdl:input message="tns:withdrawRequest" name="withdrawRequest"/>
+ <wsdl:output message="tns:withdrawResponse" name="withdrawResponse"/>
+ <wsdl:fault message="tns:AccountNotExistFaultMessage" name="AccountNotExistException"/>
+ <wsdl:fault message="tns:InsufficientFundFaultMessage" name="InsufficientFundException"/>
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+ <wsdl:binding name="BankSoapBinding" type="tns:Bank">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="withdraw">
+ <wsdlsoap:operation soapAction=""/>
+ <wsdl:input name="withdrawRequest">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="withdrawResponse">
+ <wsdlsoap:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="InsufficientFundException">
+ <wsdlsoap:fault name="InsufficientFundException" use="literal"/>
+ </wsdl:fault>
+ <wsdl:fault name="AccountNotExistException">
+ <wsdlsoap:fault name="AccountNotExistException" use="literal"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="BankService">
+ <wsdl:port binding="tns:BankSoapBinding" name="Bank">
+ <wsdlsoap:address location="http://localhost:8080/bank/services/Bank"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
\ No newline at end of file
Added: webservices/axis2/trunk/java/modules/samples/FaultHandling/build.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/samples/FaultHandling/build.xml?view=auto&rev=451950
==============================================================================
--- webservices/axis2/trunk/java/modules/samples/FaultHandling/build.xml (added)
+++ webservices/axis2/trunk/java/modules/samples/FaultHandling/build.xml Mon Oct 2 03:23:09 2006
@@ -0,0 +1,19 @@
+<project basedir=".">
+
+ <property environment="env"/>
+
+ <target name="check.dependency" unless="env.AXIS2_HOME">
+ <echo message="AXIS2_HOME must be set"/>
+ </target>
+
+ <!-- Generate the service classes from the WSDL. -->
+ <target name="generate.service" if="env.AXIS2_HOME" depends="check.dependency">
+ <ant dir="service"/>
+ </target>
+
+ <!-- Build the service, then the client. -->
+ <target name="jar" if="env.AXIS2_HOME" depends="check.dependency">
+ <ant dir="service" target="jar.server"/>
+ <ant dir="client"/>
+ </target>
+</project>
\ No newline at end of file
Added: webservices/axis2/trunk/java/modules/samples/FaultHandling/client/build.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/samples/FaultHandling/client/build.xml?view=auto&rev=451950
==============================================================================
--- webservices/axis2/trunk/java/modules/samples/FaultHandling/client/build.xml (added)
+++ webservices/axis2/trunk/java/modules/samples/FaultHandling/client/build.xml Mon Oct 2 03:23:09 2006
@@ -0,0 +1,43 @@
+<project basedir="." default="jar.client">
+
+ <property environment="env"/>
+
+ <property name="project.base.dir" value="."/>
+ <property name="parent.dir" value=".."/>
+
+ <property name="wsdl.uri" value="${parent.dir}\bank.wsdl"/>
+
+ <property name="src" value="${project.base.dir}\src"/>
+ <property name="target" value="${project.base.dir}\target"/>
+ <property name="target.java" value="${target}\src"/>
+ <property name="target.classes" value="${target}\classes"/>
+
+ <target name="check.dependency" unless="env.AXIS2_HOME">
+ <echo message="AXIS2_HOME must be set"/>
+ </target>
+
+ <target name="gen.stub" if="env.AXIS2_HOME" depends="check.dependency">
+ <delete dir="${target}"/>
+ <mkdir dir="${target}"/>
+ <java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
+ <arg line="-uri ${wsdl.uri}"/>
+ <arg line="-u"/>
+ <arg line="-o ${target}"/>
+ <classpath>
+ <fileset dir="${env.AXIS2_HOME}\lib">
+ <include name="*.jar"/>
+ </fileset>
+ </classpath>
+ </java>
+ </target>
+
+ <!-- Create the service archive by executing target\build.xml (jar.server) -->
+ <target name="jar.client" if="env.AXIS2_HOME" depends="gen.stub">
+ <copy todir="${target.java}">
+ <fileset dir="${src}"/>
+ </copy>
+ <ant dir="${target}"/>
+ <copy file="${target}\build\lib\BankService-test-client.aar" todir=".."/>
+ </target>
+
+</project>
\ No newline at end of file
Added: webservices/axis2/trunk/java/modules/samples/FaultHandling/client/src/example/BankClient.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/samples/FaultHandling/client/src/example/BankClient.java?view=auto&rev=451950
==============================================================================
--- webservices/axis2/trunk/java/modules/samples/FaultHandling/client/src/example/BankClient.java (added)
+++ webservices/axis2/trunk/java/modules/samples/FaultHandling/client/src/example/BankClient.java Mon Oct 2 03:23:09 2006
@@ -0,0 +1,53 @@
+package example;
+
+import java.rmi.RemoteException;
+
+import example.BankServiceStub.AccountNotExistFaultMessageException;
+import example.BankServiceStub.InsufficientFundFaultMessageException;
+
+public final class BankClient {
+
+ /**
+ * If account# == "13", then you will get a AccountNotExistFault.
+ * otherwise if you provide an amount > 1000, you will get a InsufficientFundFaultMessageException,
+ * otherwise you will get a response with a balance equal to 1000 - amountWithdrawn.
+ */
+ public static void main(String[] args) {
+
+ if (args.length != 3) {
+ System.err.println("Usage: BankClient <url> <account> <amount>");
+ return;
+ }
+
+ final String url = args[0];
+ final String account = args[1];
+ final Integer withdrawalAmount = new Integer(args[2]);
+
+ System.out.println();
+ System.out.println("Withdrawing " + withdrawalAmount + " dollars from account#" + account);
+
+ try {
+ final BankService bankService = new BankServiceStub(url);
+ final Withdraw withdrawRequest = new Withdraw();
+ withdrawRequest.setAccount(account);
+ withdrawRequest.setAmount(withdrawalAmount.intValue());
+
+ final WithdrawResponse withdrawResponse = bankService.withdraw(withdrawRequest);
+ System.out.println("Balance = " + withdrawResponse.getBalance());
+
+ } catch (AccountNotExistFaultMessageException e) {
+ final AccountNotExistFault fault = e.getFaultMessage();
+ System.out.println("Account#" + fault.getAccount() + " does not exist");
+ } catch (InsufficientFundFaultMessageException e) {
+ final InsufficientFundFault fault = e.getFaultMessage();
+ System.out.println("Account#" + fault.getAccount() + " has balance of " + fault.getBalance() + ". It cannot support withdrawal of " + fault.getRequestedFund());
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+
+
+ }
+}
Added: webservices/axis2/trunk/java/modules/samples/FaultHandling/service/build.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/samples/FaultHandling/service/build.xml?view=auto&rev=451950
==============================================================================
--- webservices/axis2/trunk/java/modules/samples/FaultHandling/service/build.xml (added)
+++ webservices/axis2/trunk/java/modules/samples/FaultHandling/service/build.xml Mon Oct 2 03:23:09 2006
@@ -0,0 +1,38 @@
+<project basedir="." default="gen.skeleton">
+
+ <property environment="env"/>
+
+ <property name="project.base.dir" value="."/>
+ <property name="parent.dir" value=".."/>
+
+ <property name="wsdl.uri" value="${parent.dir}\bank.wsdl"/>
+
+ <property name="src" value="${project.base.dir}\src"/>
+ <property name="target" value="${project.base.dir}\target"/>
+
+ <target name="check.dependency" unless="env.AXIS2_HOME">
+ <echo message="AXIS2_HOME must be set"/>
+ </target>
+
+ <target name="gen.skeleton" if="env.AXIS2_HOME" depends="check.dependency">
+ <delete dir="${target}"/>
+ <mkdir dir="${target}"/>
+ <java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
+ <arg line="-uri ${wsdl.uri}"/>
+ <arg line="-ss"/>
+ <arg line="-sd"/>
+ <arg line="-o ${target}"/> <!-- Output directory in which to generate files --> <!-- NB it generates to the src folder under this directory!! -->
+ <classpath>
+ <fileset dir="${env.AXIS2_HOME}\lib">
+ <include name="*.jar"/>
+ </fileset>
+ </classpath>
+ </java>
+ </target>
+
+ <!-- Create the service archive by executing target\build.xml (jar.server) -->
+ <target name="jar.server" if="env.AXIS2_HOME">
+ <ant dir="${target}"/>
+ <copy file="${target}\build\lib\BankService.aar" todir=".."/>
+ </target>
+</project>
\ No newline at end of file
Modified: webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java?view=diff&rev=451950&r1=451949&r2=451950
==============================================================================
--- webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java (original)
+++ webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java Mon Oct 2 03:23:09 2006
@@ -111,8 +111,8 @@
//create the type mapper
//First try to take the one that is already there
TypeMapper mapper = cgconfig.getTypeMapper();
- if (mapper==null){
- mapper =new JavaTypeMapper();
+ if (mapper == null) {
+ mapper = new JavaTypeMapper();
}
//change the default class name of the mapper to
@@ -189,7 +189,6 @@
}
-
//process the unwrapped parameters
if (!cgconfig.isParametersWrapped()) {
//figure out the unwrapped operations
@@ -200,7 +199,7 @@
if (WSDLUtil.isInputPresentForMEP(op.getMessageExchangePattern())) {
AxisMessage message = op.getMessage(
WSDLConstants.MESSAGE_LABEL_IN_VALUE);
- if (message!= null && message.getParameter(Constants.UNWRAPPED_KEY) != null){
+ if (message != null && message.getParameter(Constants.UNWRAPPED_KEY) != null) {
SchemaGlobalElement xmlbeansElement = sts.findElement(message.getElementQName());
SchemaType sType = xmlbeansElement.getType();
@@ -214,11 +213,19 @@
//this type is based on a primitive type- use the
//primitive type name in this case
- mapper.addTypeMappingName(partQName,elementProperty.getType().getFullJavaName());
+ String fullJaveName = elementProperty.getType().getFullJavaName();
+ if (elementProperty.extendsJavaArray()) {
+ fullJaveName = fullJaveName.concat("[]");
+ }
+ mapper.addTypeMappingName(partQName, fullJaveName);
SchemaType primitiveType = elementProperty.getType().getPrimitiveType();
- if (primitiveType!=null){
- mapper.addTypeMappingStatus(partQName,Boolean.TRUE);
+
+ if (primitiveType != null) {
+ mapper.addTypeMappingStatus(partQName, Boolean.TRUE);
+ }
+ if (elementProperty.extendsJavaArray()){
+ mapper.addTypeMappingStatus(partQName,Constants.ARRAY_TYPE);
}
}
}
@@ -255,15 +262,17 @@
SchemaType sType = (SchemaType) allSeenTypes.get(i);
if (sType.getContentType() == SchemaType.SIMPLE_CONTENT && sType.getPrimitiveType() != null) {
- if (org.apache.axis2.namespace.Constants.BASE_64_CONTENT_QNAME.equals(sType.getPrimitiveType().getName())) {
+ if (org.apache.axis2.namespace.Constants.BASE_64_CONTENT_QNAME.equals(sType.getPrimitiveType().getName()))
+ {
outerType = sType.getOuterType();
//check the outer type further to see whether it has the contenttype attribute from
//XMime namespace
SchemaProperty[] properties = sType.getProperties();
for (int j = 0; j < properties.length; j++) {
- if (org.apache.axis2.namespace.Constants.XMIME_CONTENT_TYPE_QNAME.equals(properties[j].getName())) {
+ if (org.apache.axis2.namespace.Constants.XMIME_CONTENT_TYPE_QNAME.equals(properties[j].getName()))
+ {
//add this only if it is a document type ??
- if (outerType.isDocumentType()){
+ if (outerType.isDocumentType()) {
base64ElementQNamesList.add(outerType.getDocumentElementName());
}
break;
@@ -337,9 +346,9 @@
private File location;
private boolean flatten = false;
- private String resourceDirName;
- private String srcDirName;
- private static final String JAVA_FILE_EXTENSION = ".java";
+ private String resourceDirName;
+ private String srcDirName;
+ private static final String JAVA_FILE_EXTENSION = ".java";
private Axis2Filer(CodeGenConfiguration config) {
location = config.getOutputLocation();
@@ -351,8 +360,8 @@
public OutputStream createBinaryFile(String typename)
throws IOException {
File resourcesDirectory =
- flatten?
- location:
+ flatten ?
+ location :
new File(location, resourceDirName);
if (!resourcesDirectory.exists()) {
@@ -370,8 +379,8 @@
typename.replace('.', File.separatorChar);
File outputDir =
- flatten?
- location:
+ flatten ?
+ location :
new File(location, srcDirName);
if (!outputDir.exists()) {
@@ -456,9 +465,10 @@
traverseSchemas(schema, map);
return (XmlSchema[]) map.values().toArray(new XmlSchema[map.values().size()]);
}
+
private static void traverseSchemas(XmlSchema schema, HashMap map) {
String key = schema.getTargetNamespace() + ":" + schema.getSourceURI();
- if(map.containsKey(key)){
+ if (map.containsKey(key)) {
return;
}
map.put(key, schema);
@@ -494,20 +504,21 @@
* @see EntityResolver#resolveEntity(String, String)
*/
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
- if(systemId.startsWith("project://local/")) {
+ if (systemId.startsWith("project://local/")) {
systemId = systemId.substring("project://local/".length());
}
log.info("Resolving schema with publicId [" + publicId + "] and systemId [" + systemId + "]");
try {
- for (int i=0; i< schemas.length; i++) {
+ for (int i = 0; i < schemas.length; i++) {
XmlSchema schema = schemas[i];
boolean found = false;
- if(systemId.indexOf('/') == -1 && schema.getSourceURI() != null && schema.getSourceURI().endsWith(systemId)) {
+ if (systemId.indexOf('/') == -1 && schema.getSourceURI() != null && schema.getSourceURI().endsWith(systemId))
+ {
+ found = true;
+ } else if (schema.getSourceURI() != null && schema.getSourceURI().equals(systemId)) {
found = true;
- } else if(schema.getSourceURI() != null && schema.getSourceURI().equals(systemId)) {
- found = true;
}
- if(found) {
+ if (found) {
try {
return new InputSource(getSchemaAsStream(schemas[i]));
} catch (IOException e) {
@@ -515,9 +526,9 @@
}
}
}
- for (int i=0; i< schemas.length; i++) {
+ for (int i = 0; i < schemas.length; i++) {
XmlSchema schema = schemas[i];
- if(schema.getTargetNamespace() != null && schema.getTargetNamespace().equals(publicId)) {
+ if (schema.getTargetNamespace() != null && schema.getTargetNamespace().equals(publicId)) {
try {
return new InputSource(getSchemaAsStream(schemas[i]));
} catch (IOException e) {
Modified: webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/template/XmlbeansDatabindingTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/template/XmlbeansDatabindingTemplate.xsl?view=diff&rev=451950&r1=451949&r2=451950
==============================================================================
--- webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/template/XmlbeansDatabindingTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/template/XmlbeansDatabindingTemplate.xsl Mon Oct 2 03:23:09 2006
@@ -1,6 +1,10 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
+ <xsl:key name="paramsIn" match="//databinders/param[@direction='in']" use="@type"/>
+ <xsl:key name="paramsOut" match="//databinders/param[@direction='out']" use="@type"/>
+ <xsl:key name="innerParams" match="//databinders/param[@direction='in']/param" use="@partname"/>
+
<!-- ################################################################################# -->
<!-- ############################ xmlbeans template ############################## -->
<xsl:template match="databinders[@dbtype='xmlbeans']">
@@ -44,9 +48,14 @@
<xsl:if test="not($serverside)">
<xsl:choose>
<xsl:when test="$paramcount > 0">
+ <xsl:variable name="inputElement" select="../../param[@type!='' and @direction='in' and @opname=$opname]"></xsl:variable>
<xsl:variable name="inputElementType" select="../../param[@type!='' and @direction='in' and @opname=$opname]/@type"></xsl:variable>
+ <xsl:variable name="inputElementShortType" select="../../param[@type!='' and @direction='in' and @opname=$opname]/@shorttype"></xsl:variable>
+ <xsl:variable name="inputElementComplexType" select="../../param[@type!='' and @direction='in' and @opname=$opname]/@complextype"></xsl:variable>
<xsl:variable name="wrappedParameterCount" select="count(../../param[@type!='' and @direction='in' and @opname=$opname]/param)"></xsl:variable>
- <xsl:choose>
+
+ <xsl:if test="generate-id($inputElement) = generate-id(key('paramsIn', $inputElementType)[1])">
+ <xsl:choose>
<xsl:when test="$wrappedParameterCount > 0">
<!-- geneate the toEnvelope method-->
private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory,
@@ -56,23 +65,33 @@
boolean optimizeContent){
<xsl:value-of select="$inputElementType"/> wrappedType = <xsl:value-of select="$inputElementType"/>.Factory.newInstance();
- <xsl:value-of select="$inputElementType"/>.<xsl:value-of select="$opnameCapitalized"/> wrappedEltType = wrappedType.addNew<xsl:value-of select="$opnameCapitalized"/>();
+
+ <xsl:choose>
+ <xsl:when test="string-length(normalize-space($inputElementComplexType)) > 0">
+ <xsl:value-of select="$inputElementComplexType"/> innerType = wrappedType.addNew<xsl:value-of select="substring-before($inputElementShortType,'Document')"/>();
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$inputElementType"/>.<xsl:value-of select="substring-before($inputElementShortType,'Document')"/> innerType = wrappedType.addNew<xsl:value-of select="substring-before($inputElementShortType,'Document')"/>();
+ </xsl:otherwise>
+ </xsl:choose>
+
<xsl:for-each select="../../param[@type!='' and @direction='in' and @opname=$opname]/param">
<xsl:choose>
- <xsl:when test="@primitive">wrappedEltType.xset<xsl:value-of select="@partname"/>(param<xsl:value-of select="position()"/>);</xsl:when>
- <xsl:otherwise>wrappedEltType.set<xsl:value-of select="@partname"/>(param<xsl:value-of select="position()"/>);</xsl:otherwise>
+ <xsl:when test="@array">
+ innerType.xset<xsl:value-of select="@partname"/>Array(param<xsl:value-of select="position()"/>);
+ </xsl:when>
+ <xsl:otherwise>
+ innerType.xset<xsl:value-of select="@partname"/>(param<xsl:value-of select="position()"/>);
+ </xsl:otherwise>
</xsl:choose>
</xsl:for-each>
-
org.apache.axiom.soap.SOAPEnvelope envelope = factory.getDefaultEnvelope();
envelope.getBody().addChild(toOM(wrappedType, optimizeContent));
return envelope;
}
-
-
</xsl:when>
<xsl:otherwise>
<!-- Assumption - the parameter is always an XMLBeans -->
@@ -85,6 +104,7 @@
}
</xsl:otherwise>
</xsl:choose>
+ </xsl:if>
</xsl:when>
<xsl:otherwise>
@@ -94,32 +114,55 @@
</xsl:if>
<!-- this piece of logic needs to be generated only for the server side-->
<xsl:if test="$serverside">
+
+
<xsl:choose>
<xsl:when test="count(../../param[@type!='' and @direction='out' and @opname=$opname])=1">
+ <xsl:variable name="outElement" select="../../param[@type!='' and @direction='out' and @opname=$opname]"></xsl:variable>
+ <xsl:variable name="outElementType" select="../../param[@type!='' and @direction='out' and @opname=$opname]/@type"></xsl:variable>
+
<!-- Assumption - This is an XMLBeans element-->
- private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, <xsl:value-of select="../../param[@type!='' and @direction='out' and @opname=$opname]/@type"/> param, boolean optimizeContent){
- org.apache.axiom.soap.SOAPEnvelope envelope = factory.getDefaultEnvelope();
- if (param != null){
- envelope.getBody().addChild(toOM(param, optimizeContent));
- }
- return envelope;
- }
+ <xsl:if test="generate-id($outElement) = generate-id(key('paramsOut', $outElementType)[1])">
+ private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, <xsl:value-of select="../../param[@type!='' and @direction='out' and @opname=$opname]/@type"/> param, boolean optimizeContent){
+ org.apache.axiom.soap.SOAPEnvelope envelope = factory.getDefaultEnvelope();
+ if (param != null){
+ envelope.getBody().addChild(toOM(param, optimizeContent));
+ }
+ return envelope;
+ }
+ </xsl:if>
</xsl:when>
</xsl:choose>
<xsl:if test="count(../../param[@type!='' and @direction='in' and @opname=$opname])=1">
<!-- generate the get methods -->
+ <xsl:variable name="inputElement" select="../../param[@type!='' and @direction='in' and @opname=$opname]"></xsl:variable>
+ <xsl:variable name="inputElementType" select="../../param[@type!='' and @direction='in' and @opname=$opname]/@type"></xsl:variable>
+ <xsl:variable name="inputElementShortType" select="../../param[@type!='' and @direction='in' and @opname=$opname]/@shorttype"></xsl:variable>
+ <xsl:variable name="inputElementComplexType" select="../../param[@type!='' and @direction='in' and @opname=$opname]/@complextype"></xsl:variable>
+
<xsl:for-each select="../../param[@type!='' and @direction='in' and @opname=$opname]/param">
- private <xsl:value-of select="@type"/> get<xsl:value-of select="@partname"/>(
- <xsl:value-of select="../@type"/> wrappedType){
- <xsl:value-of select="../@type"/>.<xsl:value-of select="$opnameCapitalized"/> innerType =
- wrappedType.get<xsl:value-of select="$opnameCapitalized"/>();
- <xsl:choose>
- <xsl:when test="@primitive">return innerType.xget<xsl:value-of select="@partname"/>();</xsl:when>
- <xsl:otherwise>return innerType.get<xsl:value-of select="@partname"/>();</xsl:otherwise>
- </xsl:choose>
+ <xsl:variable name="paramElement" select="."></xsl:variable>
+ <xsl:variable name="partName" select="@partname"></xsl:variable>
+
+ <xsl:if test="(generate-id($paramElement) = generate-id(key('innerParams', $partName)[1])) or
+ (generate-id($inputElement) = generate-id(key('paramsIn', $inputElementType)[1]))">
+
+ private <xsl:value-of select="@type"/> get<xsl:value-of select="@partname"/>(
+ <xsl:value-of select="../@type"/> wrappedType){
+ <!-- there is not difference betwee having a seperate complex type and the
+ inline complex type implementation -->
+ <xsl:choose>
+ <xsl:when test="@array">
+ return wrappedType.get<xsl:value-of select="substring-before($inputElementShortType,'Document')"/>().xget<xsl:value-of select="$partName"/>Array();
+ </xsl:when>
+ <xsl:otherwise>
+ return wrappedType.get<xsl:value-of select="substring-before($inputElementShortType,'Document')"/>().xget<xsl:value-of select="$partName"/>();
+ </xsl:otherwise>
+ </xsl:choose>
}
+ </xsl:if>
</xsl:for-each>
</xsl:if>
</xsl:if>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org
|