You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by pr...@apache.org on 2008/01/15 17:22:27 UTC
svn commit: r612147 [7/17] - in /webservices/axis2/branches/java/jaxws21: ./
modules/adb-codegen/ modules/adb-codegen/src/org/apache/axis2/schema/
modules/adb-codegen/src/org/apache/axis2/schema/template/
modules/adb-codegen/src/org/apache/axis2/schema...
Modified: webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl (original)
+++ webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl Tue Jan 15 08:21:22 2008
@@ -62,11 +62,21 @@
private java.util.HashMap faultExceptionClassNameMap = new java.util.HashMap();
private java.util.HashMap faultMessageMap = new java.util.HashMap();
+ private static int counter = 0;
+
+ private synchronized int getUniqueSuffix(){
+ // reset the counter if it is greater than 10000
+ if (counter > 10000){
+ counter = 0;
+ }
+ return counter++;
+ }
+
private void populateAxisService() throws org.apache.axis2.AxisFault {
//creating the Service with a unique name
- _service = new org.apache.axis2.description.AxisService("<xsl:value-of select="@servicename"/>" + this.hashCode());
+ _service = new org.apache.axis2.description.AxisService("<xsl:value-of select="@servicename"/>" + getUniqueSuffix());
//creating the operations
org.apache.axis2.description.AxisOperation __operation;
@@ -220,7 +230,7 @@
<xsl:variable name="outputparamcount"><xsl:value-of select="count(output/param[@location='body']/param)"/></xsl:variable>
<xsl:variable name="outputparamshorttype"><xsl:value-of select="output/param[@location='body']/@shorttype"/></xsl:variable>
<xsl:variable name="outputparampartname"><xsl:value-of select="output/param[@location='body']/param/@partname"/></xsl:variable>
-
+ <xsl:variable name="isUnwrapParameters" select="input/param[@location='body' and @type!='']/@unwrappParameters"/>
<!-- MTOM -->
<xsl:variable name="method-name"><xsl:value-of select="@name"/></xsl:variable>
<xsl:variable name="method-ns"><xsl:value-of select="@namespace"/> </xsl:variable>
@@ -271,23 +281,24 @@
</xsl:for-each>)
</xsl:when>
<xsl:otherwise>
+
public <xsl:choose>
<xsl:when test="$outputtype=''">void</xsl:when>
<xsl:when test="$outputparamcount=1"><xsl:value-of select="output/param[@location='body']/param/@type"/></xsl:when>
<xsl:when test="string-length(normalize-space($outputcomplextype)) > 0"><xsl:value-of select="$outputcomplextype"/></xsl:when>
+ <xsl:when test="($outputparamcount=0) and ($isUnwrapParameters)">void</xsl:when>
<xsl:otherwise><xsl:value-of select="$outputtype"/></xsl:otherwise>
</xsl:choose>
<xsl:text> </xsl:text><xsl:value-of select="@name"/>(
<xsl:variable name="inputcount" select="count(input/param[@location='body' and @type!=''])"/>
- <xsl:variable name="isUnwrapParameters" select="input/param[@location='body' and @type!='']/@unwrappParameters"/>
<xsl:variable name="inputParamCount" select="count(input/param[@location='body' and @type!='']/param)"/>
<xsl:choose>
<xsl:when test="$inputcount=1">
<!-- Even when the parameters are 1 we have to see whether we have the
wrapped parameters -->
- <xsl:choose>
+ <xsl:choose>
<xsl:when test="$isUnwrapParameters">
<xsl:for-each select="input/param[@location='body' and @type!='']/param">
<xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
@@ -347,7 +358,6 @@
wrapped parameters -->
<!-- unwrapping takes place only if the back word compatiblity is off. if -b on
then we do not unwrapp and only remove the top element -->
- <xsl:variable name="isUnwrapParameters" select="input/param[@location='body' and @type!='']/@unwrappParameters"/>
<xsl:variable name="inputElementType" select="input/param[@location='body' and @type!='']/@type"></xsl:variable>
<xsl:variable name="inputElementComplexType" select="input/param[@location='body' and @type!='']/@complextype"></xsl:variable>
<xsl:variable name="opName" select="input/param[@location='body' and @type!='']/@opname"></xsl:variable>
@@ -505,6 +515,9 @@
<xsl:when test="(string-length(normalize-space($outputcomplextype)) > 0)">
return get<xsl:value-of select="$outputopname"/>((<xsl:value-of select="$outputtype"/>)object);
</xsl:when>
+ <xsl:when test="($outputparamcount=0) and ($isUnwrapParameters)">
+ return;
+ </xsl:when>
<xsl:otherwise>
return (<xsl:value-of select="$outputtype"/>)object;
</xsl:otherwise>
@@ -586,7 +599,6 @@
public void start<xsl:value-of select="@name"/>(
<xsl:variable name="inputcount" select="count(input/param[@location='body' and @type!=''])"/>
- <xsl:variable name="isUnwrapParameters" select="input/param[@location='body' and @type!='']/@unwrappParameters"/>
<xsl:variable name="inputWrappedCount" select="count(input/param[@location='body' and @type!='']/param)"/>
<xsl:choose>
@@ -642,7 +654,6 @@
<xsl:when test="$inputcount=1">
<!-- Even when the parameters are 1 we have to see whether we have the
wrapped parameters -->
- <xsl:variable name="isUnwrapParameters" select="input/param[@location='body' and @type!='']/@unwrappParameters"/>
<xsl:variable name="inputElementType" select="input/param[@location='body' and @type!='']/@type"></xsl:variable>
<xsl:choose>
@@ -781,6 +792,7 @@
<xsl:when test="string-length(normalize-space($outputcomplextype)) > 0">
(<xsl:value-of select="$outputcomplextype"/>)object);
</xsl:when>
+ <xsl:when test="($outputparamcount=0) and ($isUnwrapParameters)">);</xsl:when>
<xsl:otherwise>
(<xsl:value-of select="$outputtype"/>)object);
</xsl:otherwise>
@@ -904,7 +916,6 @@
<xsl:when test="$inputcount=1">
<!-- Even when the parameters are 1 we have to see whether we have the
wrapped parameters -->
- <xsl:variable name="isUnwrapParameters" select="input/param[@location='body' and @type!='']/@unwrappParameters"/>
<xsl:choose>
<xsl:when test="$isUnwrapParameters">
<xsl:for-each select="input/param[@location='body' and @type!='']/param">
@@ -962,7 +973,6 @@
<xsl:when test="$inputcount=1">
<!-- Even when the parameters are 1 we have to see whether we have the
wrapped parameters -->
- <xsl:variable name="isUnwrapParameters" select="input/param[@location='body' and @type!='']/@unwrappParameters"/>
<xsl:variable name="inputElementType" select="input/param[@location='body' and @type!='']/@type"></xsl:variable>
<xsl:choose>
Modified: webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceTemplate.xsl?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceTemplate.xsl (original)
+++ webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceTemplate.xsl Tue Jan 15 08:21:22 2008
@@ -55,8 +55,9 @@
<xsl:variable name="outputtype"><xsl:value-of select="output/param[@location='body']/@type"></xsl:value-of></xsl:variable>
<xsl:variable name="outputcomplextype"><xsl:value-of select="output/param[@location='body']/@complextype"></xsl:value-of></xsl:variable>
<xsl:variable name="outputparamcount"><xsl:value-of select="count(output/param[@location='body']/param)"></xsl:value-of></xsl:variable>
+ <xsl:variable name="isUnwrapParameters" select="input/param[@location='body' and @type!='']/@unwrappParameters"/>
- <!-- start of the sync block -->
+ <!-- start of the sync block -->
<xsl:if test="$isSync='1'">
/**
@@ -105,6 +106,7 @@
<xsl:when test="$outputparamcount=1"><xsl:value-of select="output/param[@location='body']/param/@type"/></xsl:when>
<xsl:when test="string-length(normalize-space($outputcomplextype)) > 0"><xsl:value-of
select="$outputcomplextype"/></xsl:when>
+ <xsl:when test="($outputparamcount=0) and ($isUnwrapParameters)">void</xsl:when>
<xsl:otherwise><xsl:value-of select="$outputtype"/></xsl:otherwise>
</xsl:choose>
<xsl:text> </xsl:text><xsl:value-of select="@name"/>(
@@ -114,7 +116,6 @@
<xsl:when test="$inputcount=1">
<!-- Even when the parameters are 1 we have to see whether we have the
wrapped parameters -->
- <xsl:variable name="isUnwrapParameters" select="input/param[@location='body' and @type!='']/@unwrappParameters"/>
<xsl:choose>
<xsl:when test="$isUnwrapParameters">
<xsl:for-each select="input/param[@location='body' and @type!='']/param">
@@ -155,8 +156,9 @@
*/
public void start<xsl:value-of select="@name"/>(
- <xsl:variable name="inputcount" select="count(input/param[@location='body' and @type!=''])"/>
- <xsl:choose>
+ <xsl:variable name="inputcount" select="count(input/param[@location='body' and @type!=''])"/>
+ <xsl:variable name="inputWrappedCount" select="count(input/param[@location='body' and @type!='']/param)"/>
+ <xsl:choose>
<xsl:when test="$inputcount=1">
<!-- Even when the parameters are 1 we have to see whether we have the
wrapped parameters -->
@@ -174,7 +176,7 @@
</xsl:when>
<xsl:otherwise><!-- Just leave it - nothing we can do here --></xsl:otherwise>
</xsl:choose>
- <xsl:if test="$inputcount=1">,</xsl:if>
+ <xsl:if test="($inputcount=1) and not($isUnwrapParameters and $inputWrappedCount=0)">,</xsl:if>
<xsl:for-each select="input/param[not(@location='body') and @type!='']">
<xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>,
</xsl:for-each>
Modified: webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl (original)
+++ webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl Tue Jan 15 08:21:22 2008
@@ -178,6 +178,7 @@
getEnvelopeNamespaces(msgContext.getEnvelope()));
<!-- Even when the parameters are 1 we have to see whether we have the
wrapped parameters -->
+ <xsl:variable name="isUnwrapParameters" select="input/param[@location='body' and @type!='']/@unwrappParameters"/>
<xsl:if test="string-length(normalize-space($returntype)) > 0"><xsl:value-of select="$returnvariable"/> =
<!-- set the response wrappers if unwrapping on -->
<xsl:choose>
@@ -188,9 +189,12 @@
<xsl:when test="string-length(normalize-space($returncomplextype)) > 0">
wrap<xsl:value-of select="$operationName"/>(
</xsl:when>
+ <xsl:when test="($returnparamcount=0) and ($isUnwrapParameters)">
+ wrap<xsl:value-of select="$operationName"/>();
+ </xsl:when>
</xsl:choose>
</xsl:if>
- <xsl:variable name="isUnwrapParameters" select="input/param[@location='body' and @type!='']/@unwrappParameters"/>
+
<xsl:choose>
<xsl:when test="($isUnwrapParameters)">
<!-- generate the references. the getters need to be
Modified: webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonInterfaceTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonInterfaceTemplate.xsl?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonInterfaceTemplate.xsl (original)
+++ webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonInterfaceTemplate.xsl Tue Jan 15 08:21:22 2008
@@ -112,10 +112,12 @@
)
</xsl:when>
<xsl:otherwise>
+ <xsl:variable name="isUnwrapParameters" select="input/param[@location='body' and @type!='']/@unwrappParameters"/>
public <xsl:choose>
<xsl:when test="$count=0 or $outputtype=''">void</xsl:when>
<xsl:when test="$outputparamcount=1"><xsl:value-of select="output/param[@location='body']/param/@type"/></xsl:when>
<xsl:when test="string-length(normalize-space($outputcomplextype)) > 0"><xsl:value-of select="$outputcomplextype"/></xsl:when>
+ <xsl:when test="($outputparamcount=0) and ($isUnwrapParameters)">void</xsl:when>
<xsl:otherwise><xsl:value-of select="$outputtype"/></xsl:otherwise></xsl:choose>
<xsl:text> </xsl:text><xsl:value-of select="@name"/>
(
Modified: webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonTemplate.xsl?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonTemplate.xsl (original)
+++ webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/java/SkeletonTemplate.xsl Tue Jan 15 08:21:22 2008
@@ -114,11 +114,12 @@
)
</xsl:when>
<xsl:otherwise>
-
+ <xsl:variable name="isUnwrapParameters" select="input/param[@location='body' and @type!='']/@unwrappParameters"/>
public <xsl:choose>
<xsl:when test="$count=0 or $outputtype=''">void</xsl:when>
<xsl:when test="$outputparamcount=1"><xsl:value-of select="output/param[@location='body']/param/@type"/></xsl:when>
<xsl:when test="string-length(normalize-space($outputcomplextype)) > 0"><xsl:value-of select="$outputcomplextype"/></xsl:when>
+ <xsl:when test="($outputparamcount=0) and ($isUnwrapParameters)">void</xsl:when>
<xsl:otherwise><xsl:value-of select="$outputtype"/></xsl:otherwise></xsl:choose>
<xsl:text> </xsl:text><xsl:value-of select="@name"/>
(
Modified: webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java Tue Jan 15 08:21:22 2008
@@ -89,6 +89,8 @@
WSDL2JavaConstants.WSDL_LOCATION_URI_OPTION.equalsIgnoreCase(optionType) ||
WSDL2JavaConstants.WSDL_VERSION_OPTION.equalsIgnoreCase(optionType) ||
WSDL2JavaConstants.WSDL_VERSION_OPTION_LONG.equalsIgnoreCase(optionType) ||
+ WSDL2JavaConstants.HTTP_PROXY_HOST_OPTION_LONG.equalsIgnoreCase(optionType) ||
+ WSDL2JavaConstants.HTTP_PROXY_PORT_OPTION_LONG.equalsIgnoreCase(optionType) ||
XMLBeansExtension.XSDCONFIG_OPTION.equalsIgnoreCase(optionType) ||
XMLBeansExtension.XSDCONFIG_OPTION_LONG.equalsIgnoreCase(optionType)
);
Modified: webservices/axis2/branches/java/jaxws21/modules/corba/src/org/apache/axis2/corba/deployer/CorbaDeployer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/corba/src/org/apache/axis2/corba/deployer/CorbaDeployer.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/corba/src/org/apache/axis2/corba/deployer/CorbaDeployer.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/corba/src/org/apache/axis2/corba/deployer/CorbaDeployer.java Tue Jan 15 08:21:22 2008
@@ -28,6 +28,7 @@
import org.apache.axis2.deployment.*;
import org.apache.axis2.deployment.repository.util.DeploymentFileData;
import org.apache.axis2.deployment.util.PhasesInfo;
+import org.apache.axis2.deployment.util.Utils;
import org.apache.axis2.description.*;
import org.apache.axis2.engine.AxisConfiguration;
import org.apache.axis2.engine.MessageReceiver;
@@ -564,6 +565,7 @@
public void unDeploy(String fileName) throws DeploymentException {
try {
+ fileName = Utils.getShortFileName(fileName);
axisConfig.removeServiceGroup(fileName);
log.info(Messages.getMessage(DeploymentErrorMsgs.SERVICE_REMOVED, fileName));
} catch (AxisFault axisFault) {
Modified: webservices/axis2/branches/java/jaxws21/modules/integration/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/integration/pom.xml?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/integration/pom.xml (original)
+++ webservices/axis2/branches/java/jaxws21/modules/integration/pom.xml Tue Jan 15 08:21:22 2008
@@ -41,6 +41,10 @@
</exclusion>
</exclusions>
</dependency>
+<dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-activation_1.1_spec</artifactId>
+ </dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-scripting</artifactId>
Modified: webservices/axis2/branches/java/jaxws21/modules/integration/test-resources/ComplexDataTypes/ComplexDataTypes.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/integration/test-resources/ComplexDataTypes/ComplexDataTypes.wsdl?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/integration/test-resources/ComplexDataTypes/ComplexDataTypes.wsdl (original)
+++ webservices/axis2/branches/java/jaxws21/modules/integration/test-resources/ComplexDataTypes/ComplexDataTypes.wsdl Tue Jan 15 08:21:22 2008
@@ -599,14 +599,8 @@
<xs:schema xmlns:ax23="http://arrays.data.complex.tempuri.org/xsd" xmlns:ax21="http://data.complex.tempuri.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://data.complex.tempuri.org/xsd">
<xs:import namespace="http://arrays.data.complex.tempuri.org/xsd"/>
<xs:complexType name="BitMask">
- <xs:sequence>
- <xs:element minOccurs="0" name="BIT_FIVE" nillable="true" type="ns2:BitMask"/>
- <xs:element minOccurs="0" name="BIT_FOUR" nillable="true" type="ns2:BitMask"/>
- <xs:element minOccurs="0" name="BIT_ONE" nillable="true" type="ns2:BitMask"/>
- <xs:element minOccurs="0" name="BIT_THREE" nillable="true" type="ns2:BitMask"/>
- <xs:element minOccurs="0" name="BIT_TWO" nillable="true" type="ns2:BitMask"/>
- </xs:sequence>
- </xs:complexType>
+ <xs:sequence/>
+ </xs:complexType>
<xs:complexType name="Employee">
<xs:sequence>
<xs:element minOccurs="0" name="baseDetails" nillable="true" type="ns2:Person"/>
Modified: webservices/axis2/branches/java/jaxws21/modules/integration/test/org/tempuri/BaseDataTypesTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/integration/test/org/tempuri/BaseDataTypesTest.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/integration/test/org/tempuri/BaseDataTypesTest.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/integration/test/org/tempuri/BaseDataTypesTest.java Tue Jan 15 08:21:22 2008
@@ -20,9 +20,11 @@
import org.apache.ws.java2wsdl.Java2WSDLBuilder;
import org.apache.axis2.integration.TestingUtils;
+import org.custommonkey.xmlunit.Diff;
+import org.custommonkey.xmlunit.DifferenceEngine;
import org.custommonkey.xmlunit.XMLTestCase;
import org.custommonkey.xmlunit.XMLUnit;
-import org.custommonkey.xmlunit.Diff;
+import org.tempuri.elementQualifier.WSDLElementQualifier;
import java.io.ByteArrayOutputStream;
import java.io.FileReader;
@@ -40,7 +42,12 @@
builder.generateWSDL();
FileReader control = new FileReader(wsdlLocation);
StringReader test = new StringReader(new String(out.toByteArray()));
- assertXMLEqual(control, test);
+
+ Diff myDiff = new Diff(XMLUnit.buildDocument(XMLUnit.getControlParser(), control),
+ XMLUnit.buildDocument(XMLUnit.getControlParser(), test),
+ (DifferenceEngine) null, new WSDLElementQualifier());
+ if (!myDiff.similar())
+ fail(myDiff.toString());
} finally {
XMLUnit.setIgnoreWhitespace(false);
}
Modified: webservices/axis2/branches/java/jaxws21/modules/integration/test/org/tempuri/complex/ComplexDataTypesTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/integration/test/org/tempuri/complex/ComplexDataTypesTest.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/integration/test/org/tempuri/complex/ComplexDataTypesTest.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/integration/test/org/tempuri/complex/ComplexDataTypesTest.java Tue Jan 15 08:21:22 2008
@@ -18,15 +18,19 @@
*/
package org.tempuri.complex;
+import org.custommonkey.xmlunit.Diff;
import org.custommonkey.xmlunit.XMLTestCase;
import org.custommonkey.xmlunit.XMLUnit;
+import org.tempuri.differenceEngine.WSDLController;
+import org.tempuri.differenceEngine.WSDLDifferenceEngine;
+import org.tempuri.elementQualifier.WSDLElementQualifier;
import org.apache.ws.java2wsdl.Java2WSDLBuilder;
-import org.tempuri.BaseDataTypes;
import java.io.ByteArrayOutputStream;
import java.io.FileReader;
import java.io.StringReader;
+
public class ComplexDataTypesTest extends XMLTestCase {
private String wsdlLocation = System.getProperty("basedir", ".") + "/" + "test-resources/ComplexDataTypes/ComplexDataTypes.wsdl";
@@ -39,7 +43,12 @@
builder.generateWSDL();
FileReader control = new FileReader(wsdlLocation);
StringReader test = new StringReader(new String(out.toByteArray()));
- assertXMLEqual(control, test);
+
+ Diff myDiff = new Diff(XMLUnit.buildDocument(XMLUnit.getControlParser(), control),
+ XMLUnit.buildDocument(XMLUnit.getControlParser(), test),
+ new WSDLDifferenceEngine(new WSDLController()), new WSDLElementQualifier());
+ if (!myDiff.similar())
+ fail(myDiff.toString());
} finally {
XMLUnit.setIgnoreWhitespace(false);
}
Modified: webservices/axis2/branches/java/jaxws21/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java Tue Jan 15 08:21:22 2008
@@ -158,6 +158,9 @@
}
public String getTargetNamespacePrefix() {
+ if (targetNamespacePrefix == null) {
+ this.targetNamespacePrefix = TARGETNAMESPACE_PREFIX;
+ }
return targetNamespacePrefix;
}
@@ -235,7 +238,7 @@
classLoader,
schemaGenerator, service);
schemaGenerator.setAxisService(axisService);
- axisService.setTargetNamespacePrefix(targetNamespacePrefix);
+ axisService.setTargetNamespacePrefix(getTargetNamespacePrefix());
axisService.setSchemaTargetNamespace(getSchemaTargetNamespace());
axisService.setSchematargetNamespacePrefix(getSchemaTargetNamespacePrefix());
String uri = locationUri;
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxbri/src/org/apache/axis2/jaxbri/CodeGenerationUtility.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxbri/src/org/apache/axis2/jaxbri/CodeGenerationUtility.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxbri/src/org/apache/axis2/jaxbri/CodeGenerationUtility.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxbri/src/org/apache/axis2/jaxbri/CodeGenerationUtility.java Tue Jan 15 08:21:22 2008
@@ -61,11 +61,7 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
public class CodeGenerationUtility {
private static final Log log = LogFactory.getLog(CodeGenerationUtility.class);
@@ -88,19 +84,27 @@
return new DefaultTypeMapper();
}
- final ArrayList xmlObjectsVector = new ArrayList();
+ final Map schemaToInputSourceMap = new HashMap();
//create the type mapper
JavaTypeMapper mapper = new JavaTypeMapper();
- final String baseURI = cgconfig.getBaseURI();
+ String baseURI = cgconfig.getBaseURI();
+ if (!baseURI.endsWith("/")){
+ baseURI = baseURI + "/";
+ }
+
for (int i = 0; i < schemas.size(); i++) {
XmlSchema schema = (XmlSchema)schemas.get(i);
InputSource inputSource =
new InputSource(new StringReader(getSchemaAsString(schema)));
- inputSource.setSystemId(schema.getTargetNamespace());
- xmlObjectsVector.add(inputSource);
+ //here we have to set a proper system ID. otherwise when processing the
+ // included schaemas for this schema we have a problem
+ // it creates the system ID using this target namespace value
+ inputSource.setSystemId(baseURI + "xsd" + i + ".xsd");
+ inputSource.setPublicId(schema.getTargetNamespace());
+ schemaToInputSourceMap.put(schema,inputSource);
}
File outputDir = new File(cgconfig.getOutputLocation(), "src");
@@ -109,23 +113,32 @@
Map nsMap = cgconfig.getUri2PackageNameMap();
EntityResolver resolver = new EntityResolver() {
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
- for (int i = 0; i < schemas.size(); i++) {
- XmlSchema schema = (XmlSchema) schemas.get(i);
- if(schema.getTargetNamespace().equals(publicId)){
- InputSource inputSource =
- new InputSource(new StringReader(getSchemaAsString(schema)));
- inputSource.setSystemId(schema.getTargetNamespace());
- return inputSource;
+ InputSource returnInputSource = null;
+ XmlSchema key = null;
+ for (Iterator iter = schemaToInputSourceMap.keySet().iterator();iter.hasNext();) {
+ key = (XmlSchema) iter.next();
+ if (key.getTargetNamespace().equals(publicId)) {
+ returnInputSource = (InputSource) schemaToInputSourceMap.get(key);
+ // we have the requried schema
+ break;
}
}
- return null;
+ if (returnInputSource == null){
+ // then we have to find this using the file system
+ if (systemId != null){
+ returnInputSource = new InputSource(systemId);
+ }
+ }
+ return returnInputSource;
}
};
- for (int i = 0; i < xmlObjectsVector.size(); i++) {
+ XmlSchema key = null;
+ for (Iterator schemaIter = schemaToInputSourceMap.keySet().iterator();
+ schemaIter.hasNext();) {
SchemaCompiler sc = XJC.createSchemaCompiler();
- XmlSchema schema = (XmlSchema)schemas.get(i);
+ key = (XmlSchema) schemaIter.next();
if (nsMap != null) {
Iterator iterator = nsMap.entrySet().iterator();
@@ -136,8 +149,8 @@
registerNamespace(sc, namespace, pkg);
}
} else {
- String namespace = schema.getTargetNamespace();
- String pkg = extractNamespace(schema);
+ String namespace = key.getTargetNamespace();
+ String pkg = extractNamespace(key);
registerNamespace(sc, namespace, pkg);
}
@@ -165,7 +178,7 @@
}
});
- sc.parseSchema((InputSource) xmlObjectsVector.get(i));
+ sc.parseSchema((InputSource) schemaToInputSourceMap.get(key));
// Bind the XML
S2JJAXBModel jaxbModel = sc.bind();
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java Tue Jan 15 08:21:22 2008
@@ -26,6 +26,7 @@
import javax.xml.ws.Binding;
import javax.xml.ws.EndpointReference;
import javax.xml.ws.WebServiceFeature;
+import javax.xml.ws.soap.SOAPBinding;
import javax.xml.ws.handler.HandlerResolver;
import javax.xml.ws.wsaddressing.W3CEndpointReference;
@@ -98,6 +99,15 @@
// TODO should we allow the ServiceDelegate to figure out the default handlerresolver? Probably yes, since a client app may look for one there.
HandlerResolver handlerResolver = null;
if(serviceDelegate.getHandlerResolver() != null){
+
+ // See if the metadata from creating the service indicates that MTOM should be enabled
+ if (binding instanceof SOAPBinding) {
+ boolean enableMTOMFromMetadata = endpointDesc.getServiceDescription().isMTOMEnabled(serviceDelegate);
+ if (enableMTOMFromMetadata) {
+ ((SOAPBinding) binding).setMTOMEnabled(true);
+ }
+ }
+
if(log.isDebugEnabled()){
log.debug("Reading default Handler Resolver ");
}
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/binding/BindingImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/binding/BindingImpl.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/binding/BindingImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/binding/BindingImpl.java Tue Jan 15 08:21:22 2008
@@ -65,7 +65,7 @@
if (this.bindingId == null) {
// server
this.bindingId = endpointDesc.getBindingType();
- }
+ }
framework = new ClientFramework();
framework.addConfigurator(RespectBindingFeature.ID, RESPECT_BINDING_CONFIGURATOR);
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/binding/BindingUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/binding/BindingUtils.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/binding/BindingUtils.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/binding/BindingUtils.java Tue Jan 15 08:21:22 2008
@@ -18,9 +18,10 @@
*/
package org.apache.axis2.jaxws.binding;
-import javax.xml.ws.Binding;
-
import org.apache.axis2.jaxws.description.EndpointDescription;
+import org.apache.axis2.jaxws.description.builder.MDQConstants;
+
+import javax.xml.ws.Binding;
public class BindingUtils {
@@ -56,12 +57,47 @@
if (url != null && (url.equals(SOAPBinding.SOAP11HTTP_BINDING) ||
url.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING) ||
url.equals(SOAPBinding.SOAP12HTTP_BINDING)||
- url.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING))) {
+ url.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING) ||
+ url.equals(MDQConstants.SOAP11JMS_BINDING) ||
+ url.equals(MDQConstants.SOAP11JMS_MTOM_BINDING) ||
+ url.equals(MDQConstants.SOAP12JMS_BINDING) ||
+ url.equals(MDQConstants.SOAP12JMS_MTOM_BINDING) )) {
+ return true;
+ }
+ return false;
+ }
+
+ public static boolean isSOAP11Binding(String url) {
+ if (url != null && (url.equals(SOAPBinding.SOAP11HTTP_BINDING) ||
+ url.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING) ||
+ url.equals(MDQConstants.SOAP11JMS_BINDING) ||
+ url.equals(MDQConstants.SOAP11JMS_MTOM_BINDING) )) {
+ return true;
+ }
+ return false;
+ }
+
+ public static boolean isSOAP12Binding(String url) {
+ if (url != null && (url.equals(SOAPBinding.SOAP12HTTP_BINDING) ||
+ url.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING) ||
+ url.equals(MDQConstants.SOAP12JMS_BINDING) ||
+ url.equals(MDQConstants.SOAP12JMS_MTOM_BINDING) )) {
return true;
}
return false;
}
+ public static boolean isMTOMBinding(String url) {
+ if (url != null &&
+ (url.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING) ||
+ url.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING) ||
+ url.equals(MDQConstants.SOAP11JMS_MTOM_BINDING) ||
+ url.equals(MDQConstants.SOAP12JMS_MTOM_BINDING) )) {
+ return true;
+ }
+ return false;
+ }
+
public static boolean isHTTPBinding(String url) {
if (url != null && url.equals(HTTPBinding.HTTP_BINDING)) {
return true;
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/binding/SOAPBinding.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/binding/SOAPBinding.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/binding/SOAPBinding.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/binding/SOAPBinding.java Tue Jan 15 08:21:22 2008
@@ -62,11 +62,6 @@
framework.addConfigurator(AddressingFeature.ID, ADDRESSING_CONFIGURATOR);
framework.addConfigurator(SubmissionAddressingFeature.ID, ADDRESSING_CONFIGURATOR);
framework.addConfigurator(MTOMFeature.ID, MTOM_CONFIGURATOR);
-
- if (SOAPBinding.SOAP11HTTP_MTOM_BINDING.equalsIgnoreCase(bindingId) ||
- SOAPBinding.SOAP12HTTP_MTOM_BINDING.equalsIgnoreCase(bindingId)) {
- setMTOMEnabled(true);
- }
}
/*
@@ -86,9 +81,9 @@
* "http://schemas.xmlsoap.org/wsdl/soap/http" (SOAP1.1)
* "http://www.w3.org/2003/05/soap/bindings/HTTP/" (SOAP1.2)
*/
- if (bindingId.equalsIgnoreCase(SOAPBinding.SOAP12HTTP_BINDING)
- || bindingId.equalsIgnoreCase(SOAPBinding.SOAP12HTTP_MTOM_BINDING)) {
- bindingNamespace = SOAP12_ENV_NS;
+
+ if (BindingUtils.isSOAP12Binding(bindingId)){
+ bindingNamespace = SOAP12_ENV_NS;
} else {
// TODO currently defaults to SOAP11. Should we be more stricct
// about checking?
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java Tue Jan 15 08:21:22 2008
@@ -499,8 +499,8 @@
// Check to see if BASIC_AUTH is enabled. If so, make sure
// the properties are setup correctly.
- if (mc.containsKey(BindingProvider.USERNAME_PROPERTY) &&
- mc.containsKey(BindingProvider.PASSWORD_PROPERTY)) {
+ if (mc.containsKey(BindingProvider.USERNAME_PROPERTY) ||
+ mc.containsKey(BindingProvider.PASSWORD_PROPERTY)) {
String userId = (String)mc.getProperty(BindingProvider.USERNAME_PROPERTY);
if (userId == null || userId == "") {
@@ -508,10 +508,9 @@
.makeWebServiceException(Messages.getMessage("checkUserName"));
}
- String password = (String)mc.getProperty(BindingProvider.PASSWORD_PROPERTY);
- if (password == null || password == "") {
- throw ExceptionFactory
- .makeWebServiceException(Messages.getMessage("checkPassword"));
+ String password = null;
+ if (mc.containsKey(BindingProvider.PASSWORD_PROPERTY)) {
+ password = (String) mc.getProperty(BindingProvider.PASSWORD_PROPERTY);
}
URL url = null;
@@ -532,12 +531,6 @@
basicAuthentication.setPreemptiveAuthentication(true);
mc.setProperty(HTTPConstants.AUTHENTICATE, basicAuthentication);
- } else if ((!mc.containsKey(BindingProvider.USERNAME_PROPERTY) &&
- mc.containsKey(BindingProvider.PASSWORD_PROPERTY)) ||
- (mc.containsKey(BindingProvider.USERNAME_PROPERTY) &&
- !mc.containsKey(BindingProvider.PASSWORD_PROPERTY))) {
- throw ExceptionFactory
- .makeWebServiceException(Messages.getMessage("checkUsernameAndPassword"));
}
}
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitBareMethodMarshaller.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitBareMethodMarshaller.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitBareMethodMarshaller.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitBareMethodMarshaller.java Tue Jan 15 08:21:22 2008
@@ -251,6 +251,11 @@
// Put values onto the message
MethodMarshallerUtils.toMessage(pvList, m, packages);
+
+ // Enable SWA for nested SwaRef attachments
+ if (operationDesc.hasResponseSwaRefAttachments()) {
+ m.setDoingSWA(true);
+ }
return m;
} catch (Exception e) {
@@ -301,6 +306,11 @@
// Put values onto the message
MethodMarshallerUtils.toMessage(pvList, m, packages);
+
+ // Enable SWA for nested SwaRef attachments
+ if (operationDesc.hasRequestSwaRefAttachments()) {
+ m.setDoingSWA(true);
+ }
return m;
} catch (Exception e) {
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitBareMinimalMethodMarshaller.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitBareMinimalMethodMarshaller.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitBareMinimalMethodMarshaller.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitBareMinimalMethodMarshaller.java Tue Jan 15 08:21:22 2008
@@ -283,6 +283,11 @@
// Put values onto the message
MethodMarshallerUtils.toMessage(pdeList, m, packages);
+
+ // Enable SWA for nested SwaRef attachments
+ if (operationDesc.hasResponseSwaRefAttachments()) {
+ m.setDoingSWA(true);
+ }
return m;
} catch (Exception e) {
@@ -343,6 +348,11 @@
// Put values onto the message...marshalling by type
MethodMarshallerUtils.toMessage(pdeList, m, packages);
+
+ // Enable SWA for nested SwaRef attachments
+ if (operationDesc.hasRequestSwaRefAttachments()) {
+ m.setDoingSWA(true);
+ }
return m;
} catch (Exception e) {
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMethodMarshaller.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMethodMarshaller.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMethodMarshaller.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMethodMarshaller.java Tue Jan 15 08:21:22 2008
@@ -364,6 +364,11 @@
if (!marshalDesc.getAnnotationDesc(cls).hasXmlRootElement()) {
object = new JAXBElement(wrapperQName, cls, object);
}
+
+ // Enable SWA for nested SwaRef attachments
+ if (operationDesc.hasResponseSwaRefAttachments()) {
+ m.setDoingSWA(true);
+ }
// Put the object into the message
JAXBBlockFactory factory =
@@ -453,6 +458,11 @@
// Make sure object can be rendered as an element
if (!marshalDesc.getAnnotationDesc(cls).hasXmlRootElement()) {
object = new JAXBElement(wrapperQName, cls, object);
+ }
+
+ // Enable SWA for nested SwaRef attachments
+ if (operationDesc.hasRequestSwaRefAttachments()) {
+ m.setDoingSWA(true);
}
// Put the object into the message
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMinimalMethodMarshaller.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMinimalMethodMarshaller.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMinimalMethodMarshaller.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedMinimalMethodMarshaller.java Tue Jan 15 08:21:22 2008
@@ -134,6 +134,11 @@
// Put values onto the message
MethodMarshallerUtils.toMessage(pdeList, m, packages);
+
+ // Enable SWA for nested SwaRef attachments
+ if (operationDesc.hasRequestSwaRefAttachments()) {
+ m.setDoingSWA(true);
+ }
return m;
} catch (Exception e) {
@@ -328,6 +333,11 @@
// TODO Should we check for null output body values? Should we check for null output header values ?
// Put values onto the message
MethodMarshallerUtils.toMessage(pdeList, m, packages);
+
+ // Enable SWA for nested SwaRef attachments
+ if (operationDesc.hasResponseSwaRefAttachments()) {
+ m.setDoingSWA(true);
+ }
return m;
} catch (Exception e) {
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedPlusMethodMarshaller.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedPlusMethodMarshaller.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedPlusMethodMarshaller.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/DocLitWrappedPlusMethodMarshaller.java Tue Jan 15 08:21:22 2008
@@ -557,6 +557,12 @@
}
MethodMarshallerUtils.toMessage(headerPDEList, m, packages);
}
+
+ // Enable SWA for nested SwaRef attachments
+ if (operationDesc.hasResponseSwaRefAttachments()) {
+ m.setDoingSWA(true);
+ }
+
return m;
} catch (Exception e) {
throw ExceptionFactory.makeWebServiceException(e);
@@ -674,6 +680,12 @@
MethodMarshallerUtils.toMessage(headerPDEList, m, packages);
}
+
+ // Enable SWA for nested SwaRef attachments
+ if (operationDesc.hasRequestSwaRefAttachments()) {
+ m.setDoingSWA(true);
+ }
+
return m;
} catch (Exception e) {
throw ExceptionFactory.makeWebServiceException(e);
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/RPCLitMethodMarshaller.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/RPCLitMethodMarshaller.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/RPCLitMethodMarshaller.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/RPCLitMethodMarshaller.java Tue Jan 15 08:21:22 2008
@@ -136,6 +136,11 @@
// Put values onto the message
MethodMarshallerUtils.toMessage(pdeList, m, packages);
+
+ // Enable SWA for nested SwaRef attachments
+ if (operationDesc.hasRequestSwaRefAttachments()) {
+ m.setDoingSWA(true);
+ }
return m;
} catch (Exception e) {
@@ -347,6 +352,11 @@
// TODO Should we check for null output body values? Should we check for null output header values ?
// Put values onto the message
MethodMarshallerUtils.toMessage(pdeList, m, packages);
+
+ // Enable SWA for nested SwaRef attachments
+ if (operationDesc.hasResponseSwaRefAttachments()) {
+ m.setDoingSWA(true);
+ }
return m;
} catch (Exception e) {
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/Protocol.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/Protocol.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/Protocol.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/Protocol.java Tue Jan 15 08:21:22 2008
@@ -18,6 +18,7 @@
*/
package org.apache.axis2.jaxws.message;
+import org.apache.axis2.jaxws.description.builder.MDQConstants;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -53,10 +54,15 @@
protocolMappings.put(Protocol.SOAP11_WSDL_BINDING, Protocol.soap11);
protocolMappings.put(SOAPBinding.SOAP11HTTP_BINDING, Protocol.soap11);
protocolMappings.put(SOAPBinding.SOAP11HTTP_MTOM_BINDING, Protocol.soap11);
+ protocolMappings.put(MDQConstants.SOAP11JMS_BINDING, Protocol.soap11);
+ protocolMappings.put(MDQConstants.SOAP11JMS_MTOM_BINDING, Protocol.soap11);
+
protocolMappings.put(Protocol.SOAP12_WSDL_BINDING, Protocol.soap12);
protocolMappings.put(SOAPBinding.SOAP12HTTP_BINDING, Protocol.soap12);
protocolMappings.put(SOAPBinding.SOAP12HTTP_MTOM_BINDING, Protocol.soap12);
protocolMappings.put(HTTPBinding.HTTP_BINDING, Protocol.rest);
+ protocolMappings.put(MDQConstants.SOAP12JMS_BINDING, Protocol.soap12);
+ protocolMappings.put(MDQConstants.SOAP12JMS_MTOM_BINDING, Protocol.soap12);
// Add each of the URLs with a "/" at the end for flexibility
Map<String, Protocol> updates = new HashMap<String, Protocol>();
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/attachments/JAXBAttachmentMarshaller.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/attachments/JAXBAttachmentMarshaller.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/attachments/JAXBAttachmentMarshaller.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/attachments/JAXBAttachmentMarshaller.java Tue Jan 15 08:21:22 2008
@@ -18,150 +18,50 @@
*/
package org.apache.axis2.jaxws.message.attachments;
-import org.apache.axiom.om.OMText;
-import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
-import org.apache.axiom.om.impl.llom.OMTextImpl;
-import org.apache.axis2.jaxws.ExceptionFactory;
import org.apache.axis2.jaxws.message.Message;
-import org.apache.axis2.transport.http.HTTPConstants;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import javax.activation.DataHandler;
-import javax.mail.internet.InternetHeaders;
-import javax.mail.internet.MimeBodyPart;
-import javax.mail.internet.MimePartDataSource;
-import javax.xml.bind.attachment.AttachmentMarshaller;
import javax.xml.stream.XMLStreamWriter;
/**
* An implementation of the JAXB AttachmentMarshaller that is used to handle binary data from JAXB
* and create populate the appropriate constructs within the JAX-WS Message Model.
*/
-public class JAXBAttachmentMarshaller extends AttachmentMarshaller {
-
- private static final Log log = LogFactory.getLog(JAXBAttachmentMarshaller.class);
-
+public class JAXBAttachmentMarshaller extends org.apache.axis2.datasource.jaxb.JAXBAttachmentMarshaller {
private Message message;
- private XMLStreamWriter writer;
- private final String APPLICATION_OCTET = "application/octet-stream";
public JAXBAttachmentMarshaller(Message message, XMLStreamWriter writer) {
+ super(null, writer);
this.message = message;
- this.writer = writer;
}
-
- @Override
- public boolean isXOPPackage() {
- boolean value = false;
-
- // For outbound messages, only trigger MTOM if
- // the message is mtom enabled (which indicates that
- // the api dispatch/provider/proxy/impl has an MTOM binding)
- if (message != null) {
- value = message.isMTOMEnabled();
- }
-
-
- // If the writer is not an MTOM XMLStreamWriter then we don't have
- // any place to store the attachment
- if (!(writer instanceof MTOMXMLStreamWriter)) {
- if (log.isDebugEnabled()) {
- log.debug("The writer is not enabled for MTOM. " +
- "MTOM values will not be optimized");
- }
- value = false;
- }
-
- if (log.isDebugEnabled()){
- log.debug("isXOPPackage returns " + value);
- }
- return value;
-
- }
-
- @Override
- public String addMtomAttachment(byte[] data, int offset, int length,
- String mimeType, String namespace, String localPart) {
-
- if (offset != 0 || length != data.length) {
- int len = length - offset;
- byte[] newData = new byte[len];
- System.arraycopy(data, offset, newData, 0, len);
- data = newData;
- }
-
- if (mimeType == null || mimeType.length() == 0) {
- mimeType = APPLICATION_OCTET;
- }
-
- if (log.isDebugEnabled()){
- log.debug("Adding MTOM/XOP byte array attachment for element: " +
- "{" + namespace + "}" + localPart);
- }
-
- String cid;
- try {
- // Create MIME Body Part
- InternetHeaders ih = new InternetHeaders();
- ih.setHeader(HTTPConstants.HEADER_CONTENT_TYPE, mimeType);
- MimeBodyPart mbp = new MimeBodyPart(ih, data);
-
- //Create a data source for the MIME Body Part
- MimePartDataSource mpds = new MimePartDataSource(mbp);
-
- DataHandler dataHandler = new DataHandler(mpds);
- cid = addDataHandler(dataHandler);
-
- // Add the content id to the mime body part
- mbp.setHeader(HTTPConstants.HEADER_CONTENT_ID, cid);
- } catch (Throwable t) {
- throw ExceptionFactory.makeWebServiceException(t);
- }
- return cid == null ? null : "cid:" + cid;
+ /**
+ * @return if MTOM enabled calculated from the context information
+ */
+ public boolean isMTOMEnabled() {
+ if (message == null) {
+ return false;
+ } else {
+ return message.isMTOMEnabled();
+ }
}
- @Override
- public String addMtomAttachment(DataHandler data, String namespace, String localPart) {
- if (log.isDebugEnabled()){
- log.debug("Adding MTOM/XOP datahandler attachment for element: " +
- "{" + namespace + "}" + localPart);
- }
- String cid = addDataHandler(data);
- return cid == null ? null : "cid:" + cid;
- }
-
- @Override
- public String addSwaRefAttachment(DataHandler data) {
- if (log.isDebugEnabled()){
- log.debug("Adding SWAREF attachment");
+ /**
+ * Indicate on the context that SWA attachments are encountered
+ */
+ public void setDoingSWA() {
+ if (message != null) {
+ message.setDoingSWA(true);
}
-
- String cid = addDataHandler(data);
- message.setDoingSWA(true);
- return "cid:" + cid;
}
- private String addDataHandler(DataHandler dh) {
- String cid = null;
- OMText textNode = null;
-
- // If this is an MTOMXMLStreamWriter then inform the writer
- // that it must write out this attchment (I guess we should do this
- // even if the attachment is SWAREF ?)
- if (writer instanceof MTOMXMLStreamWriter) {
- textNode = new OMTextImpl(dh, null);
- cid = textNode.getContentID();
- ((MTOMXMLStreamWriter) writer).writeOptimized(textNode);
- // Remember the attachment on the message.
+ /**
+ * Inform the context that an Attachment (DataHandler, CID) is written.
+ * @param dh
+ * @param cid
+ */
+ public void addDataHandler(DataHandler dh, String cid) {
+ if (message != null) {
message.addDataHandler(dh, cid);
}
-
- if (log.isDebugEnabled()){
- log.debug(" content id=" + cid);
- log.debug(" dataHandler =" + dh);
- }
- return cid;
}
-
}
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/attachments/JAXBAttachmentUnmarshaller.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/attachments/JAXBAttachmentUnmarshaller.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/attachments/JAXBAttachmentUnmarshaller.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/attachments/JAXBAttachmentUnmarshaller.java Tue Jan 15 08:21:22 2008
@@ -18,17 +18,9 @@
*/
package org.apache.axis2.jaxws.message.attachments;
-import org.apache.axis2.jaxws.ExceptionFactory;
import org.apache.axis2.jaxws.message.Message;
-import org.apache.axis2.jaxws.utility.JavaUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import javax.activation.DataHandler;
-import javax.xml.bind.attachment.AttachmentUnmarshaller;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
/**
* JAXBAttachmentUnmarshaller
@@ -36,119 +28,23 @@
* An implementation of the <link>javax.xml.bind.attachment.AttachmentUnmarshaller</link> that is
* used for deserializing XOP elements into their corresponding binary data packages.
*/
-public class JAXBAttachmentUnmarshaller extends AttachmentUnmarshaller {
-
- private static final Log log = LogFactory.getLog(JAXBAttachmentUnmarshaller.class);
+public class JAXBAttachmentUnmarshaller extends org.apache.axis2.datasource.jaxb.JAXBAttachmentUnmarshaller {
private Message message;
public JAXBAttachmentUnmarshaller(Message message) {
+ super(null);
this.message = message;
}
- @Override
- public boolean isXOPPackage() {
+ protected DataHandler getDataHandler(String cid) {
- // Any message that is received might contain MTOM.
- // So always return true.
- boolean value = true;
-
- if (log.isDebugEnabled()){
- log.debug("isXOPPackage returns " + value);
- }
- return value;
- }
-
- @Override
- public byte[] getAttachmentAsByteArray(String cid) {
- if (log.isDebugEnabled()) {
- log.debug("Attempting to retrieve attachment [" + cid + "] as a byte[]");
- }
- DataHandler dh = getAttachmentAsDataHandler(cid);
- if (dh != null) {
- try {
- return convert(dh);
- } catch (IOException ioe) {
- if (log.isDebugEnabled()) {
- log.debug("Exception occurred while getting the byte[] " + ioe);
- }
- throw ExceptionFactory.makeWebServiceException(ioe);
- }
- }
- if (log.isDebugEnabled()) {
- log.debug("returning null byte[]");
- }
+ // Get the attachment from the message using the cid
+ if (message != null) {
+ return message.getDataHandler(cid);
+ }
return null;
}
- @Override
- public DataHandler getAttachmentAsDataHandler(String cid) {
- if (log.isDebugEnabled()) {
- log.debug("Attempting to retrieve attachment [" + cid + "] as a DataHandler");
- }
-
- DataHandler dh = message.getDataHandler(cid);
- if (dh != null) {
- return dh;
- } else {
- String cid2 = getNewCID(cid);
- if (log.isDebugEnabled()) {
- log.debug("A dataHandler was not found for [" + cid + "] trying [" + cid2 + "]");
- }
- dh = message.getDataHandler(cid2);
- if (dh != null) {
- return dh;
- }
- }
- // No Data Handler found
- throw ExceptionFactory.makeWebServiceException("A data handler was not found " +
- "for content id " + cid);
- }
- /**
- * @param cid
- * @return cid with translated characters
- */
- private String getNewCID(String cid) {
- String cid2 = cid;
-
- try {
- cid2 = java.net.URLDecoder.decode(cid, "UTF-8");
- } catch (Exception e) {
- if (log.isDebugEnabled()) {
- log.debug("getNewCID decoding " + cid + " as UTF-8 decoding error: " + e);
- }
- }
- return cid2;
- }
-
- /**
- * Read the bytes from the DataHandler
- *
- * @param dh
- * @return byte[]
- * @throws IOException
- */
- private byte[] convert(DataHandler dh) throws IOException {
- if (log.isDebugEnabled()) {
- log.debug("Reading byte[] from DataHandler " + dh);
- }
- InputStream is = dh.getInputStream();
- if (log.isDebugEnabled()) {
- log.debug("DataHandler InputStream " + is);
- }
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- byte[] b = new byte[1024];
- int num = is.read(b);
- if (log.isDebugEnabled()) {
- if (num <= 0) {
- log.debug("DataHandler InputStream contains no data. num=" + num);
- }
- }
- while (num > 0) {
- baos.write(b, 0, num);
- num = is.read(b);
- }
- return baos.toByteArray();
- }
}
Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBBlockContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBBlockContext.java?rev=612147&r1=612146&r2=612147&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBBlockContext.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBBlockContext.java Tue Jan 15 08:21:22 2008
@@ -18,50 +18,36 @@
*/
package org.apache.axis2.jaxws.message.databinding;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.datasource.jaxb.JAXBDSContext;
+import org.apache.axis2.jaxws.message.Message;
+import org.apache.axis2.jaxws.message.attachments.JAXBAttachmentMarshaller;
+import org.apache.axis2.jaxws.message.attachments.JAXBAttachmentUnmarshaller;
+import org.apache.axis2.jaxws.spi.Constants;
import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.ws.Holder;
+import javax.xml.bind.attachment.AttachmentMarshaller;
+import javax.xml.bind.attachment.AttachmentUnmarshaller;
+import javax.xml.stream.XMLStreamWriter;
+
import java.util.TreeSet;
/*
- * A JAXBBlockContext controls access to the JAXB Context
+ * A JAXBBlockContext controls access to the JAXBContext
* In addition the JAXBBlockContext contains additional contextural information needed
* by the JAX-WS component
- *
- * This class is immutable after construction.
*/
-public class JAXBBlockContext {
-
- private static final Log log = LogFactory.getLog(JAXBBlockContext.class);
-
- private TreeSet<String> contextPackages; // List of packages needed by the context
- private String contextPackagesKey; // Unique key that represents the set of contextPackages (usually toString)
- private JAXBContext jaxbContext = null; // JAXBContext
- private JAXBUtils.CONSTRUCTION_TYPE // How the JAXBContext is constructed
- constructionType = JAXBUtils.CONSTRUCTION_TYPE.UNKNOWN;
-
- // There are two modes of marshalling and unmarshalling: "by java type" and "by schema element".
- // The prefered mode is "by schema element" because it is safe and xml-centric.
- // However there are some circumstances when "by schema element" is not available.
- // Examples: RPC Lit processing (the wire element is defined by a wsdl:part...not schema)
- // Doc/Lit Bare "Minimal" Processing (JAXB ObjectFactories are missing...and thus we must use "by type" for primitives/String)
- // Please don't use "by java type" processing to get around errors.
-
- private Class processType = null;
- private boolean isxmlList =false;
+public class JAXBBlockContext extends JAXBDSContext {
+ Message message = null;
/**
* Full Constructor JAXBBlockContext (most performant)
*
* @param packages Set of packages needed by the JAXBContext.
*/
public JAXBBlockContext(TreeSet<String> packages, String packagesKey) {
- this.contextPackages = packages;
- this.contextPackagesKey = packagesKey;
+ super(packages, packagesKey);
}
/**
@@ -80,9 +66,7 @@
* @deprecated
*/
public JAXBBlockContext(String contextPackage) {
- this.contextPackages = new TreeSet();
- this.contextPackages.add(contextPackage);
- this.contextPackagesKey = this.contextPackages.toString();
+ super(contextPackage);
}
/**
@@ -92,66 +76,41 @@
* @param jaxbContext
*/
public JAXBBlockContext(JAXBContext jaxbContext) {
- this.jaxbContext = jaxbContext;
+ super(jaxbContext);
}
- /** @return Class representing type of the element */
- public TreeSet<String> getContextPackages() {
- return contextPackages;
- }
-
- public JAXBContext getJAXBContext() throws JAXBException {
- return getJAXBContext(null);
- }
-
- /**
- * @return get the JAXBContext
- * @throws JAXBException
- */
- public JAXBContext getJAXBContext(ClassLoader cl) throws JAXBException {
- if (jaxbContext == null) {
- if (log.isDebugEnabled()) {
- log.debug(
- "A JAXBContext did not exist, creating a new one with the context packages.");
- }
- Holder<JAXBUtils.CONSTRUCTION_TYPE> constructType =
- new Holder<JAXBUtils.CONSTRUCTION_TYPE>();
- jaxbContext =
- JAXBUtils.getJAXBContext(contextPackages, constructType, contextPackagesKey, cl);
- constructionType = constructType.value;
- } else {
- if (log.isDebugEnabled()) {
- log.debug("Using an existing JAXBContext");
- }
- }
- return jaxbContext;
+ public Message getMessage() {
+ return message;
}
- /** @return RPC Declared Type */
- public Class getProcessType() {
- return processType;
+ public void setMessage(Message message) {
+ this.message = message;
}
- /**
- * Set RPC Declared Type. The use of use this property if the message is style=document is
- * discouraged.
- *
- * @param type
- */
- public void setProcessType(Class type) {
- processType = type;
+ @Override
+ protected AttachmentMarshaller createAttachmentMarshaller(XMLStreamWriter writer) {
+ return new JAXBAttachmentMarshaller(getMessage(), writer);
}
-
- public JAXBUtils.CONSTRUCTION_TYPE getConstructionType() {
- return constructionType;
+
+ @Override
+ protected AttachmentUnmarshaller createAttachmentUnmarshaller() {
+ return new JAXBAttachmentUnmarshaller(getMessage());
}
- public boolean isxmlList() {
- return isxmlList;
+ public ClassLoader getClassLoader() {
+ if(message != null && message.getMessageContext() != null) {
+ return (ClassLoader) message.getMessageContext().
+ getProperty(Constants.CACHE_CLASSLOADER);
+ }
+ return super.getClassLoader();
}
- public void setIsxmlList(boolean isxmlList) {
- this.isxmlList = isxmlList;
+ public MessageContext getMessageContext() {
+ if(message != null && message.getMessageContext() != null &&
+ message.getMessageContext().getAxisMessageContext() != null) {
+ super.setMessageContext(message.getMessageContext().getAxisMessageContext());
+ }
+ return super.getMessageContext();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org