You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by pr...@apache.org on 2007/10/30 13:11:15 UTC
svn commit: r590048 [5/9] - in /webservices/axis2/branches/java/jaxws21:
legal/ 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/sch...
Modified: webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java?rev=590048&r1=590047&r2=590048&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java Tue Oct 30 05:10:34 2007
@@ -61,7 +61,7 @@
private Templates templateCache;
- private List namesList;
+ private Map packageNameToClassNamesMap;
private static int count = 0;
@@ -311,7 +311,7 @@
this.rootDir = rootDir;
}
- namesList = new ArrayList();
+ this.packageNameToClassNamesMap = new HashMap();
javaBeanTemplateName = SchemaPropertyLoader.getBeanTemplate();
}
@@ -330,7 +330,12 @@
String packageName = getPackage(namespaceURI);
String originalName = qName.getLocalPart();
- String className = makeUniqueJavaClassName(this.namesList, originalName);
+
+ if (!this.packageNameToClassNamesMap.containsKey(packageName)){
+ this.packageNameToClassNamesMap.put(packageName, new ArrayList());
+ }
+ String className =
+ makeUniqueJavaClassName((List) this.packageNameToClassNamesMap.get(packageName), originalName);
String packagePrefix = null;
@@ -713,6 +718,7 @@
javaClassNameForElement = metainf.getClassNameForQName(name);
}
+
if (javaClassNameForElement == null) {
javaClassNameForElement = getDefaultClassName();
log.warn(SchemaCompilerMessages
@@ -730,6 +736,15 @@
XSLTUtils.addAttribute(model, "primitive", "yes", property);
}
+ // add the default value
+ if (metainf.isDefaultValueAvailable(name)){
+ QName schemaQName = metainf.getSchemaQNameForQName(name);
+ if (baseTypeMap.containsKey(schemaQName)){
+ XSLTUtils.addAttribute(model, "defaultValue",
+ metainf.getDefaultValueForQName(name), property);
+ }
+ }
+
//in the case the original element is an array but the derived one is not.
if (parentMetaInf != null && metainf.isRestriction() && !missingQNames.contains(name) &&
(parentMetaInf.getArrayStatusForQName(name) && !metainf.getArrayStatusForQName(name))) {
@@ -1128,7 +1143,11 @@
}
while (listOfNames.contains(javaName.toLowerCase())) {
- javaName = javaName + count++;
+ if (!listOfNames.contains((javaName + "E").toLowerCase())){
+ javaName = javaName + "E";
+ } else {
+ javaName = javaName + count++;
+ }
}
listOfNames.add(javaName.toLowerCase());
Modified: webservices/axis2/branches/java/jaxws21/modules/adb-codegen/sub-build.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/adb-codegen/sub-build.xml?rev=590048&r1=590047&r2=590048&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/adb-codegen/sub-build.xml (original)
+++ webservices/axis2/branches/java/jaxws21/modules/adb-codegen/sub-build.xml Tue Oct 30 05:10:34 2007
@@ -378,6 +378,14 @@
<arg file="${testsuite.source.dir}/union2.xsd"/>
<arg file="${schema.generated.src.dir}"/>
</java>
+ <echo>Compiling default_value.xsd</echo>
+ <java classname="org.apache.axis2.schema.XSD2Java" fork="true">
+ <jvmarg line="${maven.junit.jvmargs}"/>
+ <classpath refid="maven.dependency.classpath"/>
+ <classpath location="${compiled.classes.dir}"/>
+ <arg file="${testsuite.source.dir}/default_value.xsd"/>
+ <arg file="${schema.generated.src.dir}"/>
+ </java>
</target>
</project>
Modified: webservices/axis2/branches/java/jaxws21/modules/adb-codegen/test-resources/testsuite/restrictions.xsd
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/adb-codegen/test-resources/testsuite/restrictions.xsd?rev=590048&r1=590047&r2=590048&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/adb-codegen/test-resources/testsuite/restrictions.xsd (original)
+++ webservices/axis2/branches/java/jaxws21/modules/adb-codegen/test-resources/testsuite/restrictions.xsd Tue Oct 30 05:10:34 2007
@@ -160,5 +160,36 @@
<xsd:element name="PersonElement" type="tns:Person"/>
+ <xsd:element name="SMSElement">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="EndDate" type="tns:WSTypeDate" nillable="true"/>
+ <xsd:element name="SMS_Provider" type="tns:WSTypeChar3" nillable="true"/>
+ </xsd:sequence>
+ <xsd:attribute name="MultipleRestriction">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:pattern value="String"/>
+ <xsd:pattern value="Base64"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:attribute>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:simpleType name="WSTypeDate">
+ <xsd:restriction base="xsd:date">
+ <xsd:pattern value='[0-9]{4}-[0-9]{2}-[0-9]{2}'/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="WSTypeChar3">
+ <xsd:restriction base="xsd:string">
+ <xsd:maxLength value="3"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+
+
</xsd:schema>
Modified: webservices/axis2/branches/java/jaxws21/modules/adb-codegen/test/org/apache/axis2/schema/populate/simple/SimpleTypeDatePopulateTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/adb-codegen/test/org/apache/axis2/schema/populate/simple/SimpleTypeDatePopulateTest.java?rev=590048&r1=590047&r2=590048&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/adb-codegen/test/org/apache/axis2/schema/populate/simple/SimpleTypeDatePopulateTest.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/adb-codegen/test/org/apache/axis2/schema/populate/simple/SimpleTypeDatePopulateTest.java Tue Oct 30 05:10:34 2007
@@ -27,7 +27,7 @@
public class SimpleTypeDatePopulateTest extends AbstractSimplePopulater{
private String values[]={
"2002-10-10Z",
- "2000-12-31Z",
+ "2000-12-31+05:30",
"2002-02-28Z"
} ;
private String xmlString[] = {
@@ -47,12 +47,11 @@
// force others to implement this method
public void testPopulate() throws Exception {
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-ddZ");
Date date = null;
for (int i = 0; i < values.length; i++) {
date = ConverterUtil.convertToDate(values[i]);
- checkValue(xmlString[i],simpleDateFormat.format(date));
+ checkValue(xmlString[i],ConverterUtil.convertToString(date));
}
}
Modified: webservices/axis2/branches/java/jaxws21/modules/adb/src/org/apache/axis2/databinding/utils/ConverterUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/adb/src/org/apache/axis2/databinding/utils/ConverterUtil.java?rev=590048&r1=590047&r2=590048&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/adb/src/org/apache/axis2/databinding/utils/ConverterUtil.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/adb/src/org/apache/axis2/databinding/utils/ConverterUtil.java Tue Oct 30 05:10:34 2007
@@ -29,6 +29,8 @@
import org.apache.axis2.databinding.ADBException;
import org.apache.axis2.databinding.i18n.ADBMessages;
import org.apache.axis2.databinding.types.*;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import javax.activation.DataHandler;
import javax.xml.namespace.QName;
@@ -41,6 +43,7 @@
import java.lang.reflect.Array;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.text.ParseException;
@@ -57,9 +60,17 @@
* simpletype 4. Object list -> array
*/
public class ConverterUtil {
+
+ private static Log log = LogFactory.getLog(ConverterUtil.class);
+
private static final String POSITIVE_INFINITY = "INF";
private static final String NEGATIVE_INFINITY = "-INF";
+ public static final String SYSTEM_PROPERTY_ADB_CONVERTERUTIL = "adb.converterutil";
+
+ private static boolean isCustomClassPresent;
+ private static Class customClass;
+
/* String conversion methods */
public static String convertToString(int i) {
return Integer.toString(i);
@@ -94,18 +105,51 @@
}
public static String convertToString(Date value) {
- // lexical form of the date is '-'? yyyy '-' mm '-' dd zzzzzz?
- // we have to serialize it with the GMT timezone
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-ddZ");
- return simpleDateFormat.format(value);
+ if (isCustomClassPresent) {
+ // this means user has define a seperate converter util class
+ return invokeToStringMethod(value,Date.class);
+ } else {
+ // lexical form of the date is '-'? yyyy '-' mm '-' dd zzzzzz?
+ // we have to serialize it with the GMT timezone
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-ddZ");
+ // this does not create the semicolen need so add that.
+ String dateString = simpleDateFormat.format(value);
+ // append semicolen
+ dateString = dateString.substring(0, dateString.length() - 2) +
+ ":" + dateString.substring(dateString.length() - 2);
+
+ return dateString;
+ }
+ }
+
+ private static String invokeToStringMethod(Object value, Class type) {
+
+ try {
+ Method method = customClass.getMethod("convertToString", new Class[]{type});
+ String result = (String) method.invoke(null,new Object[]{value});
+ return result;
+ } catch (NoSuchMethodException e) {
+ throw new RuntimeException("can not find the method convertToString("
+ + type.getName() + ") in converter util class " + customClass.getName(), e);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException("can not access the method convertToString("
+ + type.getName() + ") in converter util class " + customClass.getName(), e);
+ } catch (InvocationTargetException e) {
+ throw new RuntimeException("can not invocate the method convertToString("
+ + type.getName() + ") in converter util class " + customClass.getName(), e);
+ }
}
public static String convertToString(Calendar value) {
- // lexical form of the calendar is '-'? yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)? (zzzzzz)?
- SimpleDateFormat zulu = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
- zulu.setTimeZone(TimeZone.getTimeZone("GMT"));
- // Sun JDK bug http://developer.java.sun.com/developer/bugParade/bugs/4229798.html
- return zulu.format(value.getTime());
+ if (isCustomClassPresent) {
+ return invokeToStringMethod(value,Calendar.class);
+ } else {
+ // lexical form of the calendar is '-'? yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)? (zzzzzz)?
+ SimpleDateFormat zulu = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
+ zulu.setTimeZone(TimeZone.getTimeZone("GMT"));
+ // Sun JDK bug http://developer.java.sun.com/developer/bugParade/bugs/4229798.html
+ return zulu.format(value.getTime());
+ }
}
public static String convertToString(Day o) {
@@ -212,6 +256,9 @@
public static int convertToInt(String s) {
+ if ((s == null) || s.equals("")){
+ return Integer.MIN_VALUE;
+ }
if (s.startsWith("+")) {
s = s.substring(1);
}
@@ -219,6 +266,9 @@
}
public static BigDecimal convertToBigDecimal(String s) {
+ if ((s == null) || s.equals("")){
+ return null;
+ }
if (s.startsWith("+")) {
s = s.substring(1);
}
@@ -226,6 +276,9 @@
}
public static double convertToDouble(String s) {
+ if ((s == null) || s.equals("")){
+ return Double.NaN;
+ }
if (s.startsWith("+")) {
s = s.substring(1);
}
@@ -238,6 +291,9 @@
}
public static BigDecimal convertToDecimal(String s) {
+ if ((s == null) || s.equals("")){
+ return null;
+ }
if (s.startsWith("+")) {
s = s.substring(1);
}
@@ -245,6 +301,9 @@
}
public static float convertToFloat(String s) {
+ if ((s == null) || s.equals("")){
+ return Float.NaN;
+ }
if (s.startsWith("+")) {
s = s.substring(1);
}
@@ -261,6 +320,9 @@
}
public static long convertToLong(String s) {
+ if ((s == null) || s.equals("")){
+ return Long.MIN_VALUE;
+ }
if (s.startsWith("+")) {
s = s.substring(1);
}
@@ -268,6 +330,9 @@
}
public static short convertToShort(String s) {
+ if ((s == null) || s.equals("")){
+ return Short.MIN_VALUE;
+ }
if (s.startsWith("+")) {
s = s.substring(1);
}
@@ -303,36 +368,60 @@
}
public static YearMonth convertToGYearMonth(String s) {
+ if ((s == null) || s.equals("")){
+ return null;
+ }
return new YearMonth(s);
}
public static MonthDay convertToGMonthDay(String s) {
+ if ((s == null) || s.equals("")){
+ return null;
+ }
return new MonthDay(s);
}
public static Year convertToGYear(String s) {
+ if ((s == null) || s.equals("")){
+ return null;
+ }
return new Year(s);
}
public static Month convertToGMonth(String s) {
+ if ((s == null) || s.equals("")){
+ return null;
+ }
return new Month(s);
}
public static Day convertToGDay(String s) {
+ if ((s == null) || s.equals("")){
+ return null;
+ }
return new Day(s);
}
public static Duration convertToDuration(String s) {
+ if ((s == null) || s.equals("")){
+ return null;
+ }
return new Duration(s);
}
public static HexBinary convertToHexBinary(String s) {
+ if ((s == null) || s.equals("")){
+ return null;
+ }
return new HexBinary(s);
}
public static javax.activation.DataHandler convertToBase64Binary(String s) {
// reusing the byteArrayDataSource from the Axiom classes
+ if ((s == null) || s.equals("")){
+ return null;
+ }
ByteArrayDataSource byteArrayDataSource = new ByteArrayDataSource(
Base64.decode(s)
);
@@ -352,6 +441,9 @@
public static Date convertToDate(String source) {
// the lexical form of the date is '-'? yyyy '-' mm '-' dd zzzzzz?
+ if ((source == null) || source.equals("")){
+ return null;
+ }
Calendar calendar = Calendar.getInstance();
SimpleDateFormat simpleDateFormat = null;
boolean bc = false;
@@ -372,7 +464,9 @@
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
} else if (restpart.startsWith("+") || restpart.startsWith("-")) {
// this is a specific time format string
- simpleDateFormat = new SimpleDateFormat("yyyy-MM-ddZ");
+ simpleDateFormat = new SimpleDateFormat("yyyy-MM-ddz");
+ // have to add the GMT part to process the message
+ source = source.substring(0, 10) + "GMT" + restpart;
} else {
throw new RuntimeException("In valid string sufix");
}
@@ -397,19 +491,31 @@
}
public static Time convertToTime(String s) {
+ if ((s == null) || s.equals("")){
+ return null;
+ }
return new Time(s);
}
public static Token convertToToken(String s) {
+ if ((s == null) || s.equals("")){
+ return null;
+ }
return new Token(s);
}
public static NormalizedString convertToNormalizedString(String s) {
+ if ((s == null) || s.equals("")){
+ return null;
+ }
return new NormalizedString(s);
}
public static UnsignedLong convertToUnsignedLong(String s) {
+ if ((s == null) || s.equals("")){
+ return null;
+ }
if (s.startsWith("+")) {
s = s.substring(1);
}
@@ -417,6 +523,9 @@
}
public static UnsignedInt convertToUnsignedInt(String s) {
+ if ((s == null) || s.equals("")){
+ return null;
+ }
if (s.startsWith("+")) {
s = s.substring(1);
}
@@ -424,6 +533,9 @@
}
public static UnsignedShort convertToUnsignedShort(String s) {
+ if ((s == null) || s.equals("")){
+ return null;
+ }
if (s.startsWith("+")) {
s = s.substring(1);
}
@@ -431,6 +543,9 @@
}
public static UnsignedByte convertToUnsignedByte(String s) {
+ if ((s == null) || s.equals("")){
+ return null;
+ }
if (s.startsWith("+")) {
s = s.substring(1);
}
@@ -438,6 +553,9 @@
}
public static NonNegativeInteger convertToNonNegativeInteger(String s) {
+ if ((s == null) || s.equals("")){
+ return null;
+ }
if (s.startsWith("+")) {
s = s.substring(1);
}
@@ -445,6 +563,9 @@
}
public static NegativeInteger convertToNegativeInteger(String s) {
+ if ((s == null) || s.equals("")){
+ return null;
+ }
if (s.startsWith("+")) {
s = s.substring(1);
}
@@ -452,6 +573,9 @@
}
public static PositiveInteger convertToPositiveInteger(String s) {
+ if ((s == null) || s.equals("")){
+ return null;
+ }
if (s.startsWith("+")) {
s = s.substring(1);
}
@@ -459,6 +583,9 @@
}
public static NonPositiveInteger convertToNonPositiveInteger(String s) {
+ if ((s == null) || s.equals("")){
+ return null;
+ }
if (s.startsWith("+")) {
s = s.substring(1);
}
@@ -466,14 +593,23 @@
}
public static Name convertToName(String s) {
+ if ((s == null) || s.equals("")){
+ return null;
+ }
return new Name(s);
}
public static NCName convertToNCName(String s) {
+ if ((s == null) || s.equals("")){
+ return null;
+ }
return new NCName(s);
}
public static Id convertToID(String s) {
+ if ((s == null) || s.equals("")){
+ return null;
+ }
return new Id(s);
}
@@ -482,14 +618,23 @@
}
public static Language convertToLanguage(String s) {
+ if ((s == null) || s.equals("")){
+ return null;
+ }
return new Language(s);
}
public static NMToken convertToNMTOKEN(String s) {
+ if ((s == null) || s.equals("")){
+ return null;
+ }
return new NMToken(s);
}
public static NMTokens convertToNMTOKENS(String s) {
+ if ((s == null) || s.equals("")){
+ return null;
+ }
return new NMTokens(s);
}
@@ -499,26 +644,44 @@
}
public static Entity convertToENTITY(String s) {
+ if ((s == null) || s.equals("")){
+ return null;
+ }
return new Entity(s);
}
public static Entities convertToENTITIES(String s) {
+ if ((s == null) || s.equals("")){
+ return null;
+ }
return new Entities(s);
}
public static IDRef convertToIDREF(String s) {
+ if ((s == null) || s.equals("")){
+ return null;
+ }
return new IDRef(s);
}
public static IDRefs convertToIDREFS(String s) {
+ if ((s == null) || s.equals("")){
+ return null;
+ }
return new IDRefs(s);
}
public static URI convertToURI(String s){
+ if ((s == null) || s.equals("")){
+ return null;
+ }
return convertToAnyURI(s);
}
public static URI convertToAnyURI(String s) {
+ if ((s == null) || s.equals("")){
+ return null;
+ }
try {
return new URI(s);
} catch (URI.MalformedURIException e) {
@@ -528,6 +691,9 @@
}
public static BigInteger convertToInteger(String s) {
+ if ((s == null) || s.equals("")){
+ return null;
+ }
if (s.startsWith("+")) {
s = s.substring(1);
}
@@ -535,6 +701,9 @@
}
public static BigInteger convertToBigInteger(String s) {
+ if ((s == null) || s.equals("")){
+ return null;
+ }
if (s.startsWith("+")) {
s = s.substring(1);
}
@@ -542,6 +711,9 @@
}
public static byte convertToByte(String s) {
+ if ((s == null) || s.equals("")){
+ return Byte.MIN_VALUE;
+ }
return Byte.parseByte(s);
}
@@ -553,6 +725,9 @@
*/
public static Calendar convertToDateTime(String source) {
+ if ((source == null) || source.equals("")){
+ return null;
+ }
// the lexical representation of the date time as follows
// '-'? yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)? (zzzzzz)?
SimpleDateFormat simpleDateFormat = null;
@@ -602,7 +777,7 @@
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
} else if (rest.startsWith("+") || rest.startsWith("-")) {
// this is given in a general time zione
- simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
+ simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssz");
source = source.substring(0, 19) + "GMT" + rest;
} else {
throw new NumberFormatException("in valid time zone attribute");
@@ -746,7 +921,7 @@
for (int i = 0; i < listSize; i++) {
Object o = objectList.get(i);
if (o != null) {
- array[i] = Boolean.getBoolean(o.toString());
+ array[i] = Boolean.parseBoolean(o.toString());
}
}
returnArray = array;
@@ -970,25 +1145,16 @@
public static Object getObjectForClass(Class clazz, String value) {
//first see whether this class has a constructor that can
//take the string as an argument.
- boolean continueFlag = false;
try {
Constructor stringConstructor = clazz.getConstructor(new Class[] { String.class });
return stringConstructor.newInstance(new Object[] { value });
} catch (NoSuchMethodException e) {
//oops - no such constructors - continue with the
//parse method
- continueFlag = true;
} catch (Exception e) {
throw new ObjectConversionException(
ADBMessages.getMessage("converter.cannotGenerate",
- clazz.getName()),
- e);
- }
-
- if (!continueFlag) {
- throw new ObjectConversionException(
- ADBMessages.getMessage("converter.cannotConvert",
- clazz.getName()));
+ clazz.getName()), e);
}
try {
@@ -1064,14 +1230,14 @@
attributeValue = prefix + ":" + attributeValue;
}
serializeAnyType("QName", attributeValue, xmlStreamWriter);
+ } else if (value instanceof UnsignedByte) {
+ serializeAnyType("unsignedByte", convertToString((UnsignedByte) value), xmlStreamWriter);
} else if (value instanceof UnsignedLong) {
serializeAnyType("unsignedLong", convertToString((UnsignedLong) value), xmlStreamWriter);
- } else if (value instanceof UnsignedInt) {
- serializeAnyType("unsignedInt", convertToString((UnsignedInt) value), xmlStreamWriter);
} else if (value instanceof UnsignedShort) {
serializeAnyType("unsignedShort", convertToString((UnsignedShort) value), xmlStreamWriter);
- } else if (value instanceof UnsignedByte) {
- serializeAnyType("unsignedByte", convertToString((UnsignedByte) value), xmlStreamWriter);
+ } else if (value instanceof UnsignedInt) {
+ serializeAnyType("unsignedInt", convertToString((UnsignedInt) value), xmlStreamWriter);
} else if (value instanceof PositiveInteger) {
serializeAnyType("positiveInteger", convertToString((PositiveInteger) value), xmlStreamWriter);
} else if (value instanceof NegativeInteger) {
@@ -1208,6 +1374,20 @@
}
}
return returnObject;
+ }
+
+ static {
+ isCustomClassPresent = (System.getProperty(SYSTEM_PROPERTY_ADB_CONVERTERUTIL) != null);
+ if (isCustomClassPresent){
+ String className = System.getProperty(SYSTEM_PROPERTY_ADB_CONVERTERUTIL);
+ try {
+ customClass = Class.forName(className);
+ } catch (ClassNotFoundException e) {
+ log.error("Can not load the converter util class "
+ + className + " using default org.apache.axis2.databinding.utils.ConverterUtil class");
+ isCustomClassPresent = false;
+ }
+ }
}
}
Modified: webservices/axis2/branches/java/jaxws21/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingFinalInHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingFinalInHandler.java?rev=590048&r1=590047&r2=590048&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingFinalInHandler.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingFinalInHandler.java Tue Oct 30 05:10:34 2007
@@ -65,46 +65,36 @@
}
/** @see AddressingValidationHandler#checkMessageIDHeader */
- protected void checkForMandatoryHeaders(ArrayList alreadyFoundAddrHeader,
+ protected void checkForMandatoryHeaders(boolean[] alreadyFoundAddrHeader,
MessageContext messageContext) throws AxisFault {
//Unable to validate the wsa:MessageID header here as we do not yet know which MEP
//is in effect.
- if (!alreadyFoundAddrHeader.contains(WSA_ACTION)) {
+ if (!alreadyFoundAddrHeader[ACTION_FLAG]) {
AddressingFaultsHelper
.triggerMessageAddressingRequiredFault(messageContext, WSA_ACTION);
}
}
- protected void setDefaults(ArrayList alreadyFoundAddrHeader, MessageContext messageContext) {
+ protected void setDefaults(boolean[] alreadyFoundAddrHeader, MessageContext messageContext) {
//According to the WS-Addressing spec, we should default the wsa:To header to the
//anonymous URI. Doing that, however, might prevent a different value from being
//used instead, such as the transport URL. Therefore, we only apply the default
//on the inbound response side of a synchronous request-response exchange.
- if (!alreadyFoundAddrHeader.contains(WSA_TO) && !messageContext.isServerSide()) {
- Options messageContextOptions = messageContext.getOptions();
+ if (!alreadyFoundAddrHeader[TO_FLAG] && !messageContext.isServerSide()) {
if (log.isTraceEnabled()) {
log.trace(messageContext.getLogIDString() +
" setDefaults: Setting WS-Addressing default value for the To property.");
}
- messageContextOptions.setTo(new EndpointReference(Final.WSA_ANONYMOUS_URL));
+ messageContext.setTo(new EndpointReference(Final.WSA_ANONYMOUS_URL));
}
- if (!alreadyFoundAddrHeader.contains(WSA_REPLY_TO)) {
- Options messageContextOptions = messageContext.getOptions();
- EndpointReference epr = messageContextOptions.getReplyTo();
-
- if (epr == null) {
- epr = new EndpointReference("");
- messageContextOptions.setReplyTo(epr);
- }
-
+ if (!alreadyFoundAddrHeader[REPLYTO_FLAG]) {
+ messageContext.setReplyTo(new EndpointReference(Final.WSA_ANONYMOUS_URL));
if (log.isTraceEnabled()) {
log.trace(messageContext.getLogIDString() +
" setDefaults: Setting WS-Addressing default value for the ReplyTo property.");
}
-
- epr.setAddress(Final.WSA_ANONYMOUS_URL);
}
}
}
Modified: webservices/axis2/branches/java/jaxws21/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java?rev=590048&r1=590047&r2=590048&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java Tue Oct 30 05:10:34 2007
@@ -140,85 +140,100 @@
return InvocationResponse.CONTINUE;
}
-
+
+ protected static final int TO_FLAG = 1, FROM_FLAG = 2, REPLYTO_FLAG = 3,
+ FAULTO_FLAG = 4, MESSAGEID_FLAG = 6, ACTION_FLAG = 0;
protected Options extractAddressingInformation(SOAPHeader header, MessageContext messageContext,
ArrayList addressingHeaders, String namespace)
throws AxisFault {
Options messageContextOptions = messageContext.getOptions();
+
+ ArrayList duplicateHeaderNames = new ArrayList(1); // Normally will not be used for more than 1 header
- ArrayList checkedHeaderNames = new ArrayList(7); // Up to 7 header names to be recorded
- ArrayList duplicateHeaderNames =
- new ArrayList(1); // Normally will not be used for more than 1 header
-
- // Per the SOAP Binding spec "headers with an incorrect cardinality MUST NOT be used" So
- // these variables are used to keep track of invalid cardinality headers so they are not
- // deserialised.
- boolean ignoreTo = false, ignoreFrom = false, ignoreReplyTo = false, ignoreFaultTo =
- false, ignoreMessageID = false, ignoreAction = false;
-
+ ArrayList relatesToHeaders = null;
+ SOAPHeaderBlock actionBlock = null, toBlock = null, messageIDBlock = null, replyToBlock = null, faultToBlock = null, fromBlock = null;
+
+ // Per the SOAP Binding spec "headers with an incorrect cardinality MUST NOT be used" So these variables
+ // are used to keep track of invalid cardinality headers so they are not deserialised.
+ boolean[] ignoreHeaders = new boolean[7];
+ boolean[] checkedHeaderNames = new boolean[7];
+
// First pass just check for duplicates
- Iterator addressingHeadersIt = addressingHeaders.iterator();
- while (addressingHeadersIt.hasNext()) {
- SOAPHeaderBlock soapHeaderBlock = (SOAPHeaderBlock)addressingHeadersIt.next();
- // TODO - Don't do role processing here!
- if (!SOAP12Constants.SOAP_ROLE_NONE.equals(soapHeaderBlock.getRole())) {
- String localName = soapHeaderBlock.getLocalName();
- if (WSA_ACTION.equals(localName)) {
- ignoreAction = checkDuplicateHeaders(WSA_ACTION, checkedHeaderNames,
- duplicateHeaderNames);
- } else if (WSA_TO.equals(localName)) {
- ignoreTo =
- checkDuplicateHeaders(WSA_TO, checkedHeaderNames, duplicateHeaderNames);
- } else if (WSA_MESSAGE_ID.equals(localName)) {
- ignoreMessageID = checkDuplicateHeaders(WSA_MESSAGE_ID, checkedHeaderNames,
- duplicateHeaderNames);
- } else if (WSA_REPLY_TO.equals(localName)) {
- ignoreReplyTo = checkDuplicateHeaders(WSA_REPLY_TO, checkedHeaderNames,
- duplicateHeaderNames);
- } else if (WSA_FAULT_TO.equals(localName)) {
- ignoreFaultTo = checkDuplicateHeaders(WSA_FAULT_TO, checkedHeaderNames,
- duplicateHeaderNames);
- } else if (WSA_FROM.equals(localName)) {
- ignoreFrom = checkDuplicateHeaders(WSA_FROM, checkedHeaderNames,
- duplicateHeaderNames);
- }
- }
- }
-
- // Now extract information
- Iterator addressingHeadersIt2 = addressingHeaders.iterator();
- while (addressingHeadersIt2.hasNext()) {
- SOAPHeaderBlock soapHeaderBlock = (SOAPHeaderBlock)addressingHeadersIt2.next();
- if (!SOAP12Constants.SOAP_ROLE_NONE.equals(soapHeaderBlock.getRole())) {
- String localName = soapHeaderBlock.getLocalName();
- if (WSA_ACTION.equals(localName) && !ignoreAction) {
- extractActionInformation(soapHeaderBlock, messageContext);
- } else if (WSA_TO.equals(localName) && !ignoreTo) {
- extractToEPRInformation(soapHeaderBlock, messageContextOptions, header,
- namespace);
- } else
- if (WSA_MESSAGE_ID.equals(localName) && !ignoreMessageID) {
- extractMessageIDInformation(soapHeaderBlock, messageContext);
- } else if (WSA_REPLY_TO.equals(localName) && !ignoreReplyTo) {
- extractReplyToEPRInformation(soapHeaderBlock, namespace, messageContext);
- } else if (WSA_FAULT_TO.equals(localName) && !ignoreFaultTo) {
- extractFaultToEPRInformation(soapHeaderBlock, namespace, messageContext);
- } else if (WSA_RELATES_TO.equals(localName)) {
- extractRelatesToInformation(soapHeaderBlock, messageContextOptions);
- } else if (WSA_FROM.equals(localName) && !ignoreFrom) {
- extractFromEPRInformation(soapHeaderBlock, namespace, messageContext);
- }
- }
+ for(int i=0;i<addressingHeaders.size();i++){
+ SOAPHeaderBlock soapHeaderBlock = (SOAPHeaderBlock) addressingHeaders.get(i);
+ if (messageContext.isSOAP11() || !SOAP12Constants.SOAP_ROLE_NONE.equals(soapHeaderBlock.getRole())) {
+ String localName = soapHeaderBlock.getLocalName();
+ if (WSA_ACTION.equals(localName)) {
+ actionBlock = soapHeaderBlock;
+ checkDuplicateHeaders(WSA_ACTION, ACTION_FLAG,
+ checkedHeaderNames, ignoreHeaders,
+ duplicateHeaderNames);
+ } else if (WSA_TO.equals(localName)) {
+ toBlock = soapHeaderBlock;
+ checkDuplicateHeaders(WSA_TO, TO_FLAG, checkedHeaderNames, ignoreHeaders, duplicateHeaderNames);
+ } else if (WSA_MESSAGE_ID.equals(localName)) {
+ messageIDBlock = soapHeaderBlock;
+ checkDuplicateHeaders(WSA_MESSAGE_ID, MESSAGEID_FLAG,
+ checkedHeaderNames, ignoreHeaders,
+ duplicateHeaderNames);
+ } else if (WSA_REPLY_TO.equals(localName)) {
+ replyToBlock = soapHeaderBlock;
+ checkDuplicateHeaders(WSA_REPLY_TO, REPLYTO_FLAG,
+ checkedHeaderNames, ignoreHeaders,
+ duplicateHeaderNames);
+ } else if (WSA_FAULT_TO.equals(localName)) {
+ faultToBlock = soapHeaderBlock;
+ checkDuplicateHeaders(WSA_FAULT_TO,FAULTO_FLAG,
+ checkedHeaderNames, ignoreHeaders,
+ duplicateHeaderNames);
+ } else if (WSA_FROM.equals(localName)) {
+ fromBlock = soapHeaderBlock;
+ checkDuplicateHeaders(WSA_FROM,FROM_FLAG,
+ checkedHeaderNames, ignoreHeaders,
+ duplicateHeaderNames);
+ } else if(WSA_RELATES_TO.equals(localName)){
+ if(relatesToHeaders == null){
+ relatesToHeaders = new ArrayList(1);
+ }
+ relatesToHeaders.add(soapHeaderBlock);
+ }
+ }
}
+ if (actionBlock!=null && !ignoreHeaders[ACTION_FLAG]) {
+ extractActionInformation(actionBlock, messageContext);
+ }
+ if (toBlock != null &&!ignoreHeaders[TO_FLAG]) {
+ extractToEPRInformation(toBlock,
+ messageContextOptions,
+ header,
+ namespace);
+ }
+ if (messageIDBlock!=null && !ignoreHeaders[MESSAGEID_FLAG]) {
+ extractMessageIDInformation(messageIDBlock, messageContext);
+ }
+ if (relatesToHeaders!=null) {
+ for(int i=0;i<relatesToHeaders.size();i++){
+ extractRelatesToInformation((SOAPHeaderBlock)relatesToHeaders.get(i), messageContextOptions);
+ }
+ }
+ if (replyToBlock!=null && !ignoreHeaders[REPLYTO_FLAG]) {
+ extractReplyToEPRInformation(replyToBlock, namespace, messageContext);
+ }
+ if (faultToBlock!=null && !ignoreHeaders[FAULTO_FLAG]) {
+ extractFaultToEPRInformation(faultToBlock, namespace, messageContext);
+ }
+ if (fromBlock!=null && !ignoreHeaders[FROM_FLAG]) {
+ extractFromEPRInformation(fromBlock, namespace, messageContext);
+ }
+
// Now that all the valid wsa headers have been read, throw an exception if there was an invalid cardinality
// This means that if for example there are multiple MessageIDs and a FaultTo, the FaultTo will be respected.
if (!duplicateHeaderNames.isEmpty()) {
// Simply choose the first problem header we came across as we can only fault for one of them.
AddressingFaultsHelper.triggerInvalidCardinalityFault(messageContext,
- (String)duplicateHeaderNames
- .get(0));
+ (String) duplicateHeaderNames.get(0));
}
// check for the presence of madatory addressing headers
@@ -230,31 +245,31 @@
return messageContextOptions;
}
- protected abstract void checkForMandatoryHeaders(ArrayList alreadyFoundAddrHeader,
- MessageContext messageContext)
- throws AxisFault;
-
- protected abstract void setDefaults(ArrayList alreadyFoundAddrHeader,
- MessageContext messageContext) throws AxisFault;
-
- private boolean checkDuplicateHeaders(String addressingHeaderName, ArrayList checkedHeaderNames,
- ArrayList duplicateHeaderNames) {//throws AxisFault {
- // If the header name has been seen before then we should return true and add it to the list
- // of duplicate header names. Otherwise it is the first time we've seen the header so add it
- // to the checked liat and return false.
- boolean shouldIgnore = checkedHeaderNames.contains(addressingHeaderName);
- if (shouldIgnore) {
- duplicateHeaderNames.add(addressingHeaderName);
- } else {
- checkedHeaderNames.add(addressingHeaderName);
- }
-
- if (log.isTraceEnabled()) {
- log.trace("checkDuplicateHeaders: addressingHeaderName=" + addressingHeaderName +
- " isDuplicate=" + shouldIgnore);
- }
-
- return shouldIgnore;
+ protected abstract void checkForMandatoryHeaders(boolean[] alreadyFoundAddrHeader,
+ MessageContext messageContext)
+ throws AxisFault;
+
+ protected abstract void setDefaults(boolean[] alreadyFoundAddrHeader,
+ MessageContext messageContext) throws AxisFault;
+
+
+ private void checkDuplicateHeaders(String addressingHeaderName, int headerFlag,
+ boolean[] checkedHeaderNames, boolean[] ignoreHeaders,
+ ArrayList duplicateHeaderNames) {//throws AxisFault {
+ // If the header name has been seen before then we should return true and add it to the list
+ // of duplicate header names. Otherwise it is the first time we've seen the header so add it
+ // to the checked liat and return false.
+ ignoreHeaders[headerFlag] = checkedHeaderNames[headerFlag];
+ if (ignoreHeaders[headerFlag]) {
+ duplicateHeaderNames.add(addressingHeaderName);
+ } else {
+ checkedHeaderNames[headerFlag] = true;
+ }
+
+ if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
+ log.trace("checkDuplicateHeaders: addressingHeaderName=" + addressingHeaderName
+ + " isDuplicate=" + ignoreHeaders[headerFlag]);
+ }
}
protected abstract void extractToEprReferenceParameters(EndpointReference toEPR,
Modified: webservices/axis2/branches/java/jaxws21/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java?rev=590048&r1=590047&r2=590048&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java Tue Oct 30 05:10:34 2007
@@ -41,6 +41,7 @@
import org.apache.axis2.description.Parameter;
import org.apache.axis2.handlers.AbstractHandler;
import org.apache.axis2.util.JavaUtils;
+import org.apache.axis2.util.LoggingControl;
import org.apache.axis2.util.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -58,7 +59,7 @@
public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
// it should be able to disable addressing by some one.
if (msgContext.isPropertyTrue(DISABLE_ADDRESSING_FOR_OUT_MESSAGES)) {
- if (log.isTraceEnabled()) {
+ if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
log.trace(msgContext.getLogIDString() +
" Addressing is disabled. Not adding WS-Addressing headers.");
}
@@ -67,7 +68,7 @@
// Determine the addressin namespace in effect.
Object addressingVersionFromCurrentMsgCtxt = msgContext.getProperty(WS_ADDRESSING_VERSION);
- if (log.isTraceEnabled()) {
+ if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
log.trace("Addressing version string from messageContext=" +
addressingVersionFromCurrentMsgCtxt);
}
@@ -117,7 +118,7 @@
public WSAHeaderWriter(MessageContext mc, boolean isSubmissionNamespace, boolean addMU,
boolean replace, boolean includeOptional) {
- if (log.isDebugEnabled()) {
+ if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
log.debug("WSAHeaderWriter: isFinal=" + isSubmissionNamespace + " addMU=" + addMU +
" replace=" + replace + " includeOptional=" + includeOptional);
}
@@ -126,27 +127,19 @@
envelope = mc.getEnvelope();
factory = (SOAPFactory)envelope.getOMFactory();
- header = envelope.getHeader();
-
- // if there is no soap header in the envelope being processed, add one.
- if (header == null) {
- header = factory.createSOAPHeader(envelope);
- }
-
messageContextOptions = messageContext.getOptions();
addressingNamespace =
(isSubmissionNamespace ? Submission.WSA_NAMESPACE : Final.WSA_NAMESPACE);
- addressingNamespaceObject =
- factory.createOMNamespace(addressingNamespace, WSA_DEFAULT_PREFIX);
+ header = envelope.getHeader();
// if there is no soap header in the envelope being processed, add one.
if (header == null) {
header = factory.createSOAPHeader(envelope);
}else{
ArrayList addressingHeaders = header.getHeaderBlocksWithNSURI(addressingNamespace);
if(addressingHeaders!=null && !addressingHeaders.isEmpty()){
- existingWSAHeaders = new ArrayList();
+ existingWSAHeaders = new ArrayList(addressingHeaders.size());
for(Iterator iter=addressingHeaders.iterator();iter.hasNext();){
OMElement oe = (OMElement)iter.next();
existingWSAHeaders.add(oe.getLocalName());
@@ -166,7 +159,7 @@
// we have tested at the start of this whether messageInformationHeaders are null or not.
// So rather than declaring addressing namespace in each and every addressing header, lets
// define that in the Header itself.
- envelope.declareNamespace(addressingNamespaceObject);
+ addressingNamespaceObject = header.declareNamespace(addressingNamespace, WSA_DEFAULT_PREFIX);
// processing WSA To
processToEPR();
@@ -201,29 +194,23 @@
String messageID = messageContextOptions.getMessageId();
if (messageID != null && !isAddressingHeaderAlreadyAvailable(WSA_MESSAGE_ID, false))
{//optional
- OMElement oe = processStringInfo(messageID, WSA_MESSAGE_ID);
- ArrayList attributes = (ArrayList)messageContext.getProperty(
+ ArrayList attributes = (ArrayList)messageContext.getProperty(
AddressingConstants.MESSAGEID_ATTRIBUTES);
- if (attributes != null && !attributes.isEmpty()) {
- Iterator attrIterator = attributes.iterator();
- while (attrIterator.hasNext()) {
- AttributeHelper.importOMAttribute((OMAttribute)attrIterator.next(), oe);
- }
- }
+ createSOAPHeaderBlock(messageID, WSA_MESSAGE_ID, attributes);
}
}
private void processWSAAction() throws AxisFault {
String action = messageContextOptions.getAction();
- if (log.isTraceEnabled()) {
+ if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
log.trace(messageContext.getLogIDString() +
" processWSAAction: action from messageContext: " + action);
}
- if (action == null || "".equals(action)) {
+ if (action == null || action.length()==0) {
if (messageContext.getAxisOperation() != null) {
action = messageContext.getAxisOperation().getOutputAction();
- if (log.isTraceEnabled()) {
+ if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
log.trace(messageContext.getLogIDString() +
" processWSAAction: action from AxisOperation: " + action);
}
@@ -231,25 +218,30 @@
}
// Use the correct fault action for the selected namespace
- if (Final.WSA_FAULT_ACTION.equals(action) || Submission.WSA_FAULT_ACTION.equals(action))
- {
- action = isFinalAddressingNamespace ? Final.WSA_FAULT_ACTION :
- Submission.WSA_FAULT_ACTION;
- messageContextOptions.setAction(action);
- } else if (!isFinalAddressingNamespace && Final.WSA_SOAP_FAULT_ACTION.equals(action)) {
- action = Submission.WSA_FAULT_ACTION;
- messageContextOptions.setAction(action);
+ if(isFinalAddressingNamespace){
+ if(Submission.WSA_FAULT_ACTION.equals(action)){
+ action = Final.WSA_FAULT_ACTION;
+ messageContextOptions.setAction(action);
+ }
+ }else{
+ if(Final.WSA_FAULT_ACTION.equals(action)){
+ action = Submission.WSA_FAULT_ACTION;
+ messageContextOptions.setAction(action);
+ }else if(Final.WSA_SOAP_FAULT_ACTION.equals(action)){
+ action = Submission.WSA_FAULT_ACTION;
+ messageContextOptions.setAction(action);
+ }
}
// If we need to add a wsa:Action header
if (!isAddressingHeaderAlreadyAvailable(WSA_ACTION, false)) {
- if (log.isTraceEnabled()) {
+ if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
log.trace(messageContext.getLogIDString() +
" processWSAAction: No existing wsa:Action header found");
}
// If we don't have an action to add,
- if (action == null || "".equals(action)) {
- if (log.isTraceEnabled()) {
+ if (action == null || action.length()==0) {
+ if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
log.trace(messageContext.getLogIDString() +
" processWSAAction: No action to add to header");
}
@@ -260,21 +252,14 @@
throw new AxisFault(AddressingMessages.getMessage("outboundNoAction"));
}
} else {
- if (log.isTraceEnabled()) {
+ if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
log.trace(messageContext.getLogIDString() +
" processWSAAction: Adding action to header: " + action);
}
// Otherwise just add the header
- OMElement oe = processStringInfo(action, WSA_ACTION);
ArrayList attributes = (ArrayList)messageContext.getProperty(
AddressingConstants.ACTION_ATTRIBUTES);
- if (attributes != null && !attributes.isEmpty()) {
- Iterator attrIterator = attributes.iterator();
- while (attrIterator.hasNext()) {
- AttributeHelper
- .importOMAttribute((OMAttribute)attrIterator.next(), oe);
- }
- }
+ createSOAPHeaderBlock(action, WSA_ACTION, attributes);
}
}
}
@@ -308,36 +293,24 @@
if (relatesTo != null) {
for (int i = 0, length = relatesTo.length; i < length; i++) {
- OMElement relatesToHeader = processStringInfo(relatesTo[i].getValue(),
- WSA_RELATES_TO);
+ OMElement relatesToHeader = createSOAPHeaderBlock(relatesTo[i].getValue(),
+ WSA_RELATES_TO, relatesTo[i].getExtensibilityAttributes());
String relationshipType = relatesTo[i].getRelationshipType();
-
if (relatesToHeader != null) {
- if (relatesTo[i].getExtensibilityAttributes() != null) {
- Iterator attributes =
- relatesTo[i].getExtensibilityAttributes().iterator();
- while (attributes.hasNext()) {
- OMAttribute oma = (OMAttribute)attributes.next();
- AttributeHelper.importOMAttribute(oma, relatesToHeader);
- }
- }
-
- if (Final.WSA_DEFAULT_RELATIONSHIP_TYPE.equals(relationshipType) ||
- Submission.WSA_DEFAULT_RELATIONSHIP_TYPE
- .equals(relationshipType)) {
- if (includeOptionalHeaders) {
- relationshipType = isFinalAddressingNamespace ?
- Final.WSA_DEFAULT_RELATIONSHIP_TYPE :
- Submission.WSA_DEFAULT_RELATIONSHIP_TYPE;
- relatesTo[i].setRelationshipType(relationshipType);
- } else {
- continue; //Omit the relationship type
- }
+
+ if(!includeOptionalHeaders){
+ if (Final.WSA_DEFAULT_RELATIONSHIP_TYPE.equals(relationshipType) ||
+ Submission.WSA_DEFAULT_RELATIONSHIP_TYPE
+ .equals(relationshipType)) {
+ relationshipType = null;
+ }
+ }
+
+ if(relationshipType != null){
+ relatesToHeader.addAttribute(WSA_RELATES_TO_RELATIONSHIP_TYPE,
+ relationshipType,
+ null);
}
-
- relatesToHeader.addAttribute(WSA_RELATES_TO_RELATIONSHIP_TYPE,
- relationshipType,
- null);
}
}
}
@@ -378,10 +351,8 @@
private void processToEPR() {
EndpointReference epr = messageContextOptions.getTo();
if (epr != null && !isAddressingHeaderAlreadyAvailable(WSA_TO, false)) {
- Map referenceParameters = epr.getAllReferenceParameters();
String address = epr.getAddress();
-
- if (!"".equals(address) && address != null) {
+ if (address != null && address.length()!=0) {
if (!includeOptionalHeaders && isFinalAddressingNamespace &&
(Final.WSA_ANONYMOUS_URL.equals(address) ||
//Don't use epr.hasAnonymousAddress() here as it may
@@ -389,30 +360,27 @@
{ //recognize none WS-Addressing anonymous values.
return; //Omit the header.
}
-
- SOAPHeaderBlock toHeaderBlock =
- header.addHeaderBlock(WSA_TO, addressingNamespaceObject);
- toHeaderBlock.setText(address);
- if (epr.getAddressAttributes() != null) {
- Iterator addressAttributes = epr.getAddressAttributes().iterator();
- while (addressAttributes.hasNext()) {
- OMAttribute attr = (OMAttribute)addressAttributes.next();
- AttributeHelper.importOMAttribute(attr, toHeaderBlock);
- }
- }
+ createSOAPHeaderBlock(address, WSA_TO, epr.getAddressAttributes());
}
- processToEPRReferenceInformation(referenceParameters, header);
+ processToEPRReferenceInformation(epr.getAllReferenceParameters(), header);
}
}
- private OMElement processStringInfo(String value, String headerName) {
- if (log.isTraceEnabled()) {
- log.trace("processStringInfo: value=" + value + " headerName=" + headerName);
+ private OMElement createSOAPHeaderBlock(String value, String headerName, ArrayList attributes) {
+ if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
+ log.trace("createSOAPHeaderBlock: value=" + value + " headerName=" + headerName);
}
- if (!"".equals(value) && value != null) {
+ if (value != null && value.length()!=0) {
SOAPHeaderBlock soapHeaderBlock =
header.addHeaderBlock(headerName, addressingNamespaceObject);
soapHeaderBlock.addChild(factory.createOMText(value));
+ if (attributes != null && !attributes.isEmpty()) {
+ Iterator attrIterator = attributes.iterator();
+ while (attrIterator.hasNext()) {
+ AttributeHelper
+ .importOMAttribute((OMAttribute)attrIterator.next(), soapHeaderBlock);
+ }
+ }
return soapHeaderBlock;
}
return null;
@@ -423,7 +391,7 @@
String anonymous = isFinalAddressingNamespace ?
Final.WSA_ANONYMOUS_URL : Submission.WSA_ANONYMOUS_URL;
- if (log.isTraceEnabled()) {
+ if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
log.trace("addToSOAPHeader: epr=" + epr + " headerName=" + headerName);
}
@@ -491,46 +459,46 @@
* true - if new headers can't be added.
*/
private boolean isAddressingHeaderAlreadyAvailable(String name, boolean multipleHeaders) {
- QName qname = new QName(addressingNamespace, name, WSA_DEFAULT_PREFIX);
- boolean status = false;
+ boolean status = false;
- if (multipleHeaders) {
- if (replaceHeaders) {
- Iterator iterator = header.getChildrenWithName(qname);
- while (iterator.hasNext()) {
- OMElement addressingHeader = (OMElement)iterator.next();
- addressingHeader.detach();
- }
- }
- } else {
- boolean exists = didAddressingHeaderExist(name);
-
- if (exists && replaceHeaders) {
- OMElement addressingHeader = header.getFirstChildWithName(qname);
- if (log.isTraceEnabled()) {
- log.trace("isAddressingHeaderAlreadyAvailable: Removing existing header:" +
- addressingHeader.getLocalName());
- }
- addressingHeader.detach();
- } else {
- status = exists;
- }
- }
+ if (multipleHeaders) {
+ if (replaceHeaders) {
+ QName qname = new QName(addressingNamespace, name, WSA_DEFAULT_PREFIX);
+ Iterator iterator = header.getChildrenWithName(qname);
+ while (iterator.hasNext()) {
+ OMElement addressingHeader = (OMElement)iterator.next();
+ addressingHeader.detach();
+ }
+ }
+ } else {
+ boolean exists = didAddressingHeaderExist(name);
+ if (exists && replaceHeaders) {
+ QName qname = new QName(addressingNamespace, name, WSA_DEFAULT_PREFIX);
+ OMElement addressingHeader = header.getFirstChildWithName(qname);
+ if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
+ log.trace("isAddressingHeaderAlreadyAvailable: Removing existing header:" +
+ addressingHeader.getLocalName());
+ }
+ addressingHeader.detach();
+ } else {
+ status = exists;
+ }
+ }
- if (log.isTraceEnabled()) {
- log.trace("isAddressingHeaderAlreadyAvailable: name=" + name + " status=" + status);
- }
- return status;
+ if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
+ log.trace("isAddressingHeaderAlreadyAvailable: name=" + name + " status=" + status);
+ }
+ return status;
}
-
+
private boolean didAddressingHeaderExist(String headerName){
- if (log.isTraceEnabled()) {
+ if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
log.trace("didAddressingHeaderExist: headerName=" + headerName);
}
boolean result = false;
if(existingWSAHeaders != null){
result = existingWSAHeaders.contains(headerName);
- if (log.isTraceEnabled()) {
+ if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
log.trace("didAddressingHeaderExist: existingWSAHeaders=" + existingWSAHeaders+" result="+result);
}
}
@@ -548,7 +516,7 @@
for (int i = 0, size = headers.size(); i < size; i++) {
SOAPHeaderBlock soapHeaderBlock = (SOAPHeaderBlock)headers.get(i);
soapHeaderBlock.setMustUnderstand(true);
- if (log.isTraceEnabled()) {
+ if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
log.trace(
"processMustUnderstandProperty: Setting mustUnderstand=true on: " +
soapHeaderBlock.getLocalName());
Modified: webservices/axis2/branches/java/jaxws21/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingSubmissionInHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingSubmissionInHandler.java?rev=590048&r1=590047&r2=590048&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingSubmissionInHandler.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingSubmissionInHandler.java Tue Oct 30 05:10:34 2007
@@ -48,46 +48,37 @@
// TODO : Chinthaka
}
- protected void checkForMandatoryHeaders(ArrayList alreadyFoundAddrHeader,
+ protected void checkForMandatoryHeaders(boolean[] alreadyFoundAddrHeader,
MessageContext messageContext) throws AxisFault {
- if (!alreadyFoundAddrHeader.contains(WSA_TO)) {
+ if (!alreadyFoundAddrHeader[TO_FLAG]) {
AddressingFaultsHelper.triggerMessageAddressingRequiredFault(messageContext, WSA_TO);
}
- if (!alreadyFoundAddrHeader.contains(WSA_ACTION)) {
+ if (!alreadyFoundAddrHeader[ACTION_FLAG]) {
AddressingFaultsHelper
.triggerMessageAddressingRequiredFault(messageContext, WSA_ACTION);
}
- if (alreadyFoundAddrHeader.contains(WSA_REPLY_TO) ||
- alreadyFoundAddrHeader.contains(WSA_FAULT_TO)) {
+ if (alreadyFoundAddrHeader[REPLYTO_FLAG] ||
+ alreadyFoundAddrHeader[FAULTO_FLAG]) {
- if (!alreadyFoundAddrHeader.contains(WSA_MESSAGE_ID)) {
+ if (!alreadyFoundAddrHeader[MESSAGEID_FLAG]) {
AddressingFaultsHelper
.triggerMessageAddressingRequiredFault(messageContext, WSA_MESSAGE_ID);
}
}
}
- protected void setDefaults(ArrayList alreadyFoundAddrHeader, MessageContext messageContext) {
+ protected void setDefaults(boolean[] alreadyFoundAddrHeader, MessageContext messageContext) {
//The none URI is not defined in the 2004/08 spec, but it is used here anyway
//as a flag to indicate the correct semantics to apply, i.e. in the 2004/08 spec
//the absence of a ReplyTo header indicates that a response is NOT required.
- if (!alreadyFoundAddrHeader.contains(WSA_REPLY_TO)) {
- Options messageContextOptions = messageContext.getOptions();
- EndpointReference epr = messageContextOptions.getReplyTo();
-
- if (epr == null) {
- epr = new EndpointReference("");
- messageContextOptions.setReplyTo(epr);
- }
-
+ if (!alreadyFoundAddrHeader[REPLYTO_FLAG]) {
+ messageContext.setReplyTo(new EndpointReference(Final.WSA_NONE_URI));
if (log.isTraceEnabled()) {
log.trace(
"setDefaults: Setting WS-Addressing default value for the ReplyTo property.");
}
-
- epr.setAddress(Final.WSA_NONE_URI);
}
}
}
Modified: webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java?rev=590048&r1=590047&r2=590048&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java Tue Oct 30 05:10:34 2007
@@ -22,6 +22,7 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.description.WSDL11ToAllAxisServicesBuilder;
import org.apache.axis2.description.WSDL11ToAxisServiceBuilder;
+import org.apache.axis2.description.WSDL20ToAllAxisServicesBuilder;
import org.apache.axis2.description.WSDL20ToAxisServiceBuilder;
import org.apache.axis2.util.CommandLineOption;
import org.apache.axis2.util.CommandLineOptionConstants;
@@ -36,13 +37,11 @@
import org.apache.commons.logging.LogFactory;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
-import org.xml.sax.InputSource;
import javax.wsdl.Definition;
import javax.wsdl.WSDLException;
import javax.wsdl.factory.WSDLFactory;
import javax.wsdl.xml.WSDLReader;
-import javax.wsdl.xml.WSDLLocator;
import javax.xml.namespace.QName;
import javax.xml.parsers.ParserConfigurationException;
import java.io.File;
@@ -94,11 +93,25 @@
if (CommandLineOptionConstants.WSDL2JavaConstants.WSDL_VERSION_2.
equals(configuration.getWSDLVersion())) {
- WSDL20ToAxisServiceBuilder builder = new WSDL20ToAxisServiceBuilder(wsdlUri,
- configuration.getServiceName(),
- configuration.getPortName());
- builder.setCodegen(true);
- configuration.addAxisService(builder.populateService());
+
+ WSDL20ToAxisServiceBuilder builder;
+
+ // jibx currently does not support multiservice
+ if ((configuration.getServiceName() != null) || (configuration.getDatabindingType().equals("jibx"))) {
+ builder = new WSDL20ToAxisServiceBuilder(
+ wsdlUri,
+ configuration.getServiceName(),
+ configuration.getPortName(),
+ configuration.isAllPorts());
+ builder.setCodegen(true);
+ configuration.addAxisService(builder.populateService());
+ } else {
+ builder = new WSDL20ToAllAxisServicesBuilder(wsdlUri, configuration.getPortName());
+ builder.setCodegen(true);
+ builder.setAllPorts(configuration.isAllPorts());
+ configuration.setAxisServices(
+ ((WSDL20ToAllAxisServicesBuilder)builder).populateAllServices());
+ }
} else {
//It'll be WSDL 1.1
@@ -124,7 +137,7 @@
configuration.getServiceName());
}
- WSDL11ToAxisServiceBuilder builder = null;
+ WSDL11ToAxisServiceBuilder builder;
// jibx currently does not support multiservice
if ((serviceQname != null) || (configuration.getDatabindingType().equals("jibx"))) {
builder = new WSDL11ToAxisServiceBuilder(
@@ -283,7 +296,15 @@
Document doc;
try {
doc = XMLUtils.newDocument(uri);
- return reader.readWSDL(getBaseURI(uri), doc);
+
+ // Set the URI of the base document for the Definition.
+ // This identifies the origin of the Definition
+ // Note that this is the URI of the base document, not the imports.
+ Definition def = reader.readWSDL(getBaseURI(uri), doc);
+ def.setDocumentBaseURI(getURI(uri));
+
+ return def;
+
} catch (ParserConfigurationException e) {
throw new WSDLException(WSDLException.PARSER_ERROR,
"Parser Configuration Error",
@@ -311,6 +332,17 @@
Class extensionClass = getClass().getClassLoader().loadClass(className);
return extensionClass.newInstance();
} catch (ClassNotFoundException e) {
+ // TODO REVIEW FOR JAVA 6
+ // In Java 5, if you passed an array string such as "[Lcom.mypackage.MyClass;" to
+ // loadClass, the class would indeed be loaded.
+ // In JDK6, a ClassNotFoundException is thrown.
+ // The work-around is to use code Class.forName instead.
+ // Example:
+ // try {
+ // classLoader.loadClass(name);
+ // } catch (ClassNotFoundException e) {
+ // Class.forName(name, false, loader);
+ // }
log.debug(CodegenMessages.getMessage("engine.extensionLoadProblem"), e);
return null;
} catch (InstantiationException e) {
@@ -340,5 +372,22 @@
}
String uriFragment = currentURI.substring(0, currentURI.lastIndexOf("/"));
return uriFragment + (uriFragment.endsWith("/") ? "" : "/");
+ }
+
+ /**
+ * calculates the URI
+ * needs improvement
+ *
+ * @param currentURI
+ */
+ private String getURI(String currentURI) throws URISyntaxException, IOException {
+
+ File file = new File(currentURI);
+ if (file.exists()){
+ return file.getCanonicalFile().toURI().toString();
+ } else {
+ return currentURI;
+ }
+
}
}
Modified: webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java?rev=590048&r1=590047&r2=590048&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java Tue Oct 30 05:10:34 2007
@@ -2890,6 +2890,12 @@
}
}
+ //added the unwapparameters attribute this is use full to unwrap if paramerters are
+ //zero
+ if (!this.codeGenConfiguration.isParametersWrapped()){
+ addAttribute(doc, "unwrappParameters", "true", mainParameter);
+ }
+
// this message has been unwrapped - find the correct references of the
// the message by looking at the unwrapped details object and attach the
// needed parameters inside main parameter element
Modified: webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/CTypeInfo.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/CTypeInfo.java?rev=590048&r1=590047&r2=590048&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/CTypeInfo.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/CTypeInfo.java Tue Oct 30 05:10:34 2007
@@ -25,8 +25,8 @@
import java.util.Map;
/**
- * The java type map. uses a static map for caching Most code from Axis 1 Codebase* Most code
- * JavaTypeMap
+ * The C type map. uses a static map for caching Most code from Axis 1 Codebase* Most code
+ * CTypeMap
*/
public class CTypeInfo extends Constants {
@@ -54,35 +54,30 @@
CTypeInfo.addTypemapping(XSD_ANY, "axiom_node_t*");
CTypeInfo.addTypemapping(XSD_DECIMAL, "double");
- //anytype is mapped to the OMElement instead of the java.lang.Object
CTypeInfo.addTypemapping(XSD_ANYTYPE,
"axiom_node_t*");
- //Qname maps to jax rpc QName class
CTypeInfo.addTypemapping(XSD_QNAME,
"axutil_qname_t*");
- //xsd Date is mapped to the java.util.date!
CTypeInfo.addTypemapping(XSD_DATE,
"axutil_date_time_t*");
- // Mapping for xsd:time. Map to Axis type Time
CTypeInfo.addTypemapping(XSD_TIME,
"axutil_date_time_t*");
CTypeInfo.addTypemapping(XSD_DATETIME,
"axutil_date_time_t*");
- //as for the base 64 encoded binary stuff we map it to a javax.
- // activation.Datahandler object
CTypeInfo.addTypemapping(XSD_BASE64,
"axutil_base64_binary_t*");
CTypeInfo.addTypemapping(XSD_HEXBIN,
- "void*");
+ "axiom_node_t*");
// These are the g* types (gYearMonth, etc) which map to Axis types
+ // These types are mapped to an integer
CTypeInfo.addTypemapping(XSD_YEARMONTH,
- "int");
+ "axutil_date_time_t*");
CTypeInfo.addTypemapping(XSD_YEAR,
"int");
CTypeInfo.addTypemapping(XSD_MONTH,
@@ -90,7 +85,7 @@
CTypeInfo.addTypemapping(XSD_DAY,
"int");
CTypeInfo.addTypemapping(XSD_MONTHDAY,
- "int");
+ "axutil_date_time_t*");
// xsd:token
CTypeInfo.addTypemapping(XSD_TOKEN, "axis2_char_t*");
@@ -113,7 +108,7 @@
// a xsd:unsignedByte
CTypeInfo.addTypemapping(XSD_UNSIGNEDBYTE,
- "unsigned char");
+ "axis2_byte_t");
// a xsd:nonNegativeInteger
CTypeInfo.addTypemapping(XSD_NONNEGATIVEINTEGER,
@@ -129,43 +124,40 @@
// a xsd:nonPositiveInteger
CTypeInfo.addTypemapping(XSD_NONPOSITIVEINTEGER,
- "int");
+ "unsigned int");
// a xsd:Name
- CTypeInfo.addTypemapping(XSD_NAME, "axiom_node_t*");
+ CTypeInfo.addTypemapping(XSD_NAME, "axis2_char_t*");
// a xsd:NCName
- CTypeInfo.addTypemapping(XSD_NCNAME, "axiom_node_t*");
+ CTypeInfo.addTypemapping(XSD_NCNAME, "axis2_char_t*");
// a xsd:ID
- CTypeInfo.addTypemapping(XSD_ID, "axiom_node_t*");
-
- // a xml:lang
- // addTypemapping(XML_LANG,Language.class.getName());
+ CTypeInfo.addTypemapping(XSD_ID, "axis2_char_t*");
// a xsd:language
CTypeInfo.addTypemapping(XSD_LANGUAGE, "axis2_char_t*");
// a xsd:NmToken
- CTypeInfo.addTypemapping(XSD_NMTOKEN, "axiom_node_t*");
+ CTypeInfo.addTypemapping(XSD_NMTOKEN, "axis2_char_t*");
// a xsd:NmTokens
- CTypeInfo.addTypemapping(XSD_NMTOKENS, "axiom_node_t*");
+ CTypeInfo.addTypemapping(XSD_NMTOKENS, "axis2_char_t*");
// a xsd:NOTATION
CTypeInfo.addTypemapping(XSD_NOTATION, "axiom_node_t*");
// a xsd:XSD_ENTITY
- CTypeInfo.addTypemapping(XSD_ENTITY, "axiom_node_t*");
+ CTypeInfo.addTypemapping(XSD_ENTITY, "axis2_char_t*");
// a xsd:XSD_ENTITIES
- CTypeInfo.addTypemapping(XSD_ENTITIES, "axiom_node_t*");
+ CTypeInfo.addTypemapping(XSD_ENTITIES, "axis2_char_t*");
// a xsd:XSD_IDREF
- CTypeInfo.addTypemapping(XSD_IDREF, "axiom_node_t*");
+ CTypeInfo.addTypemapping(XSD_IDREF, "axis2_char_t*");
// a xsd:XSD_XSD_IDREFS
- CTypeInfo.addTypemapping(XSD_IDREFS, "axiom_node_t*");
+ CTypeInfo.addTypemapping(XSD_IDREFS, "axis2_char_t*");
// a xsd:Duration
CTypeInfo.addTypemapping(XSD_DURATION, "axutil_duration_t*");
Modified: webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDL11Writer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDL11Writer.java?rev=590048&r1=590047&r2=590048&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDL11Writer.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDL11Writer.java Tue Oct 30 05:10:34 2007
@@ -74,8 +74,8 @@
if (axisService != null) {
Map baseURIwsdlNameMap = new HashMap();
// add the initial definition to the map
- baseURIwsdlNameMap.put(definition.getDocumentBaseURI(),axisService.getName());
- writeWSDL(definition, axisService.getName(), changedMap, baseURIwsdlNameMap);
+ baseURIwsdlNameMap.put(definition.getDocumentBaseURI(),axisService.getName() + ".wsdl");
+ writeWSDL(definition, axisService.getName() + ".wsdl", changedMap, baseURIwsdlNameMap);
}
} catch (Exception e) {
throw new RuntimeException("WSDL writing failed!", e);
@@ -83,7 +83,7 @@
}
private void writeWSDL(Definition definition,
- String serviceName,
+ String fileName,
Map changedMap,
Map baseURIwsdlNameMap) throws Exception {
// first process the imports and save them.
@@ -102,18 +102,28 @@
// we have to process this wsdl file only if it has not been processed earlier
if (!baseURIwsdlNameMap.containsKey(wsdlLocation)) {
wsdlName = wsdlLocation.substring(wsdlLocation.lastIndexOf('/') + 1);
+ if (!wsdlName.endsWith(".wsdl") && !wsdlName.endsWith(".xsd")){
+ // this seems to be an online wsdl so we generate a dummy name
+ if (wsdlName.indexOf("xsd") > -1){
+ wsdlName = "xsd" + count++ + ".xsd";
+ } else {
+ wsdlName = "wsdl" + count++ + ".wsdl";
+ }
+ }
//trim the wsdl part
- wsdlName = wsdlName.substring(0, wsdlName.indexOf(".wsdl"));
while (baseURIwsdlNameMap.containsValue(wsdlName)) {
- wsdlName = wsdlName + count++;
+ // import file name can either be xsd or wsdl
+ String fileNamePart = wsdlName.substring(0,wsdlName.lastIndexOf("."));
+ String extension = wsdlName.substring(wsdlName.lastIndexOf("."));
+ wsdlName = fileNamePart + count++ + extension;
}
baseURIwsdlNameMap.put(wsdlLocation, wsdlName);
Definition innerDefinition = wsdlImport.getDefinition();
writeWSDL(innerDefinition, wsdlName, changedMap, baseURIwsdlNameMap);
}
- wsdlImport.setLocationURI(baseURIwsdlNameMap.get(wsdlLocation) + ".wsdl");
+ wsdlImport.setLocationURI((String)baseURIwsdlNameMap.get(wsdlLocation));
}
}
}
@@ -122,7 +132,7 @@
// finally save the file
WSDLWriter wsdlWriter = WSDLFactory.newInstance().newWSDLWriter();
File outputFile = FileWriter.createClassFile(baseFolder,
- null, serviceName, ".wsdl");
+ null, fileName, null);
FileOutputStream out = new FileOutputStream(outputFile);
// we have a catch here
@@ -142,7 +152,7 @@
Service service;
for (Iterator iter = servicesList.iterator();iter.hasNext();){
service = (Service) iter.next();
- if (!service.getQName().getLocalPart().equals(serviceName)){
+ if (!service.getQName().getLocalPart().equals(fileName)){
definition.removeService(service.getQName());
removedServices.add(service);
}
Modified: webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/c/ServiceSkeleton.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/c/ServiceSkeleton.xsl?rev=590048&r1=590047&r2=590048&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/c/ServiceSkeleton.xsl (original)
+++ webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/c/ServiceSkeleton.xsl Tue Oct 30 05:10:34 2007
@@ -176,7 +176,14 @@
input_val<xsl:value-of select="$position"/>_<xsl:value-of select="position()"/> = <xsl:choose>
<xsl:when test="@ours">
adb_<xsl:value-of select="@type"/>_create( env);
- adb_<xsl:value-of select="@type"/>_deserialize(input_val<xsl:value-of select="$position"/>_<xsl:value-of select="position()"/>, env, content_node );
+ if( AXIS2_FAILURE == adb_<xsl:value-of select="@type"/>_deserialize(input_val<xsl:value-of select="$position"/>_<xsl:value-of select="position()"/>, env, content_node ))
+ {
+ adb_<xsl:value-of select="@type"/>_free(input_val<xsl:value-of select="$position"/>_<xsl:value-of select="position()"/>, env);
+
+ AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "NULL returnted from the <xsl:value-of select="@type"/>_deserialize: "
+ "This should be due to an invalid XML");
+ return <xsl:value-of select="$method-prefix"/>_on_fault( svc_skeleton, env, NULL);
+ }
</xsl:when>
<xsl:otherwise>content_node;</xsl:otherwise>
</xsl:choose>
@@ -191,7 +198,7 @@
}
ret_node = <xsl:choose>
<xsl:when test="@ours">
- adb_<xsl:value-of select="$outputtype"/>_serialize(ret_val<xsl:value-of select="$position"/>, env, NULL, AXIS2_FALSE, AXIS2_TRUE);
+ adb_<xsl:value-of select="$outputtype"/>_serialize(ret_val<xsl:value-of select="$position"/>, env, NULL, AXIS2_TRUE);
adb_<xsl:value-of select="$outputtype"/>_free(ret_val<xsl:value-of select="$position"/>, env);
adb_<xsl:value-of select="@type"/>_free(input_val<xsl:value-of select="$position"/>_<xsl:value-of select="position()"/>, env);
</xsl:when>
Modified: webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/c/ServiceXMLTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/c/ServiceXMLTemplate.xsl?rev=590048&r1=590047&r2=590048&view=diff
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/c/ServiceXMLTemplate.xsl (original)
+++ webservices/axis2/branches/java/jaxws21/modules/codegen/src/org/apache/axis2/wsdl/template/c/ServiceXMLTemplate.xsl Tue Oct 30 05:10:34 2007
@@ -33,11 +33,20 @@
<parameter name="ServiceClass">
<xsl:value-of select="@servicename"/>
</parameter>
+ <description>
+ <xsl:value-of select="@servicename"/> Service
+ </description>
<xsl:for-each select="method">
<operation>
<xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute>
+ <xsl:if test="@soapaction">
+ <parameter>
+ <xsl:attribute name="name"><xsl:text>wsamapping</xsl:text></xsl:attribute>
+ <xsl:value-of select="@soapaction"/>
+ </parameter>
+ </xsl:if>
</operation>
</xsl:for-each>
</service>
</xsl:template>
-</xsl:stylesheet>
\ No newline at end of file
+</xsl:stylesheet>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org