gdaniels 2002/07/01 12:37:53
Modified: java/src/org/apache/axis AxisEngine.java
java/src/org/apache/axis/deployment/wsdd WSDDService.java
java/src/org/apache/axis/encoding
SerializationContextImpl.java
java/src/org/apache/axis/utils JavaUtils.java
java/test/utils TestJavaUtils.java
java/test/wsdl/nested Nested2BindingImpl.java
Nested2ServiceTestCase.java
java/test/wsdl/types VerifyTestCase.java
Added: java/test/wsdl/wrapped City_BBBBindingImpl.java
City_BBBTestCase.java
Removed: java/test/wsdl/wrapped CityBBBBindingImpl.java
CityBBBTestCase.java
Log:
Fix xml -> Java mapping bug:
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10375
We no longer assume "_" is punctuation. Change various tests to match
the new world order (JAX-RPC final).
Revision Changes Path
1.84 +12 -7 xml-axis/java/src/org/apache/axis/AxisEngine.java
Index: AxisEngine.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/AxisEngine.java,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -r1.83 -r1.84
--- AxisEngine.java 1 Jul 2002 17:40:29 -0000 1.83
+++ AxisEngine.java 1 Jul 2002 19:37:52 -0000 1.84
@@ -350,27 +350,32 @@
* any ommitted boolean options to TRUE. Default the admin.
* password.
*/
- private void normaliseOptions() {
+ public static void normaliseOptions(Handler handler) {
// Convert boolean options to Booleans so we don't need to use
// string comparisons. Default is "true".
for (int i = 0; i < BOOLEAN_OPTIONS.length; i++) {
- Object val = getOption(BOOLEAN_OPTIONS[i]);
+ Object val = handler.getOption(BOOLEAN_OPTIONS[i]);
if (val != null) {
if (val instanceof Boolean)
continue;
if (JavaUtils.isFalse(val)) {
- setOption(BOOLEAN_OPTIONS[i], Boolean.FALSE);
+ handler.setOption(BOOLEAN_OPTIONS[i], Boolean.FALSE);
continue;
}
}
// If it was null or not "false"...
- setOption(BOOLEAN_OPTIONS[i], Boolean.TRUE);
+ handler.setOption(BOOLEAN_OPTIONS[i], Boolean.TRUE);
}
// Deal with admin password's default value.
- if (!setOptionDefault(PROP_PASSWORD, DEFAULT_ADMIN_PASSWORD)) {
- setAdminPassword((String)getOption(PROP_PASSWORD));
+ if (handler instanceof AxisEngine) {
+ AxisEngine engine = (AxisEngine)handler;
+ if (!engine.setOptionDefault(PROP_PASSWORD,
+ DEFAULT_ADMIN_PASSWORD)) {
+ engine.setAdminPassword(
+ (String)engine.getOption(PROP_PASSWORD));
+ }
}
}
@@ -382,7 +387,7 @@
if (globalOptions != null)
setOptions(globalOptions);
- normaliseOptions();
+ normaliseOptions(this);
}
/**
1.74 +2 -0
xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java
Index: WSDDService.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -r1.73 -r1.74
--- WSDDService.java 29 Jun 2002 19:46:26 -0000 1.73
+++ WSDDService.java 1 Jul 2002 19:37:52 -0000 1.74
@@ -394,6 +394,8 @@
service.setOption(AxisEngine.PROP_SEND_XSI, Boolean.FALSE);
}
+ AxisEngine.normaliseOptions(service);
+
initTMR();
service.setTypeMappingRegistry(tmr);
tmr.delegate(registry.getTypeMappingRegistry());
1.37 +12 -8
xml-axis/java/src/org/apache/axis/encoding/SerializationContextImpl.java
Index: SerializationContextImpl.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/SerializationContextImpl.java,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- SerializationContextImpl.java 1 Jul 2002 16:09:38 -0000 1.36
+++ SerializationContextImpl.java 1 Jul 2002 19:37:52 -0000 1.37
@@ -59,6 +59,7 @@
import org.apache.axis.Constants;
import org.apache.axis.Message;
import org.apache.axis.MessageContext;
+import org.apache.axis.Handler;
import org.apache.axis.schema.SchemaVersion;
import org.apache.axis.soap.SOAPConstants;
import org.apache.axis.wsdl.symbolTable.SymbolTable;
@@ -202,13 +203,16 @@
this.writer = writer;
this.msgContext = msgContext;
- AxisEngine engine = null ;
+ Handler optionSource = null ;
if ( msgContext != null ) {
+ // optionSource = msgContext.getService();
+ if (optionSource == null)
+ optionSource = msgContext.getAxisEngine();
+
// Use whatever schema is associated with this MC
schemaVersion = msgContext.getSchemaVersion();
- engine = msgContext.getAxisEngine();
- Boolean shouldSendDecl = (Boolean)engine.getOption(
+ Boolean shouldSendDecl = (Boolean)optionSource.getOption(
AxisEngine.PROP_XML_DECL);
if (shouldSendDecl != null)
sendXMLDecl = shouldSendDecl.booleanValue();
@@ -218,7 +222,7 @@
if (shouldSendMultiRefs == null)
shouldSendMultiRefs =
- (Boolean)engine.getOption(AxisEngine.PROP_DOMULTIREFS);
+
(Boolean)optionSource.getOption(AxisEngine.PROP_DOMULTIREFS);
if (shouldSendMultiRefs != null)
doMultiRefs = shouldSendMultiRefs.booleanValue();
@@ -229,7 +233,7 @@
if ( !msgContext.isPropertyTrue(Call.SEND_TYPE_ATTR, true ))
sendXSIType = false ;
- Boolean opt = (Boolean)engine.getOption(AxisEngine.PROP_SEND_XSI);
+ Boolean opt = (Boolean)optionSource.getOption(AxisEngine.PROP_SEND_XSI);
if ((opt != null) && (opt.equals(Boolean.FALSE))) {
sendXSIType = false ;
}
@@ -435,7 +439,7 @@
* - There is no default namespace
* - any attribute in a namespace must have a prefix
*
- * @param QName
+ * @param qName QName
* @return prefixed qname representation for serialization.
*/
public String attributeQName2String(QName qName) {
@@ -1051,7 +1055,7 @@
SerializerInfo info = null;
// If the javaType is abstract, try getting a
- // serializer that matches the value's class.
+ // serializer that matches the value's class.
if (javaType != null &&
!javaType.isPrimitive() &&
!javaType.isArray() &&
@@ -1061,7 +1065,7 @@
if (info != null) {
// Successfully found a serializer for the derived object.
// Must serializer the type.
- sendType = true;
+ sendType = true;
xmlType = null;
}
}
1.56 +0 -2 xml-axis/java/src/org/apache/axis/utils/JavaUtils.java
Index: JavaUtils.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/JavaUtils.java,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- JavaUtils.java 1 Jul 2002 17:40:38 -0000 1.55
+++ JavaUtils.java 1 Jul 2002 19:37:52 -0000 1.56
@@ -668,7 +668,6 @@
return '-' == c
|| '.' == c
|| ':' == c
- || '_' == c
|| '\u00B7' == c
|| '\u0387' == c
|| '\u06DD' == c
@@ -861,7 +860,6 @@
}
public static class HolderException extends Exception
{
- private HolderException () {}
public HolderException(String msg) { super(msg); }
};
1.9 +5 -7 xml-axis/java/test/utils/TestJavaUtils.java
Index: TestJavaUtils.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/utils/TestJavaUtils.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- TestJavaUtils.java 28 Jun 2002 06:17:55 -0000 1.8
+++ TestJavaUtils.java 1 Jul 2002 19:37:52 -0000 1.9
@@ -35,12 +35,12 @@
assertEquals("nameWithDashes",
JavaUtils.xmlNameToJava("name-with-dashes"));
assertEquals("otherPunctChars",
- JavaUtils.xmlNameToJava("other_punct\u00B7chars"));
+ JavaUtils.xmlNameToJava("other.punct\u00B7chars"));
assertEquals("answer42", JavaUtils.xmlNameToJava("Answer42"));
assertEquals("\u2160Foo", JavaUtils.xmlNameToJava("\u2160foo"));
assertEquals("foo", JavaUtils.xmlNameToJava("2foo"));
- assertEquals("foo", JavaUtils.xmlNameToJava("_foo_"));
+ assertEquals("_Foo_", JavaUtils.xmlNameToJava("_foo_"));
assertEquals("foobar", JavaUtils.xmlNameToJava("--foobar--"));
assertEquals("foo22Bar", JavaUtils.xmlNameToJava("foo22bar"));
@@ -56,17 +56,15 @@
assertEquals("fooBar", JavaUtils.xmlNameToJava("foo\u06DEbar"));
assertEquals("fooBar", JavaUtils.xmlNameToJava("FooBar"));
assertEquals("FOOBar", JavaUtils.xmlNameToJava("FOOBar"));
- assertEquals("FOOBar", JavaUtils.xmlNameToJava("__FOOBar"));
-
- assertEquals("a1BBB", JavaUtils.xmlNameToJava("A1_BBB"));
- assertEquals("ABBB", JavaUtils.xmlNameToJava("A_BBB"));
+
+ assertEquals("a1BBB", JavaUtils.xmlNameToJava("A1-BBB"));
+ assertEquals("ABBB", JavaUtils.xmlNameToJava("A-BBB"));
assertEquals("ACCC", JavaUtils.xmlNameToJava("ACCC"));
// the following cases are ambiguous in JSR-101
assertEquals("fooBar", JavaUtils.xmlNameToJava("foo bar"));
assertEquals("_1", JavaUtils.xmlNameToJava("-"));
- assertEquals("__", JavaUtils.xmlNameToJava("_"));
}
/**
1.4 +20 -20 xml-axis/java/test/wsdl/nested/Nested2BindingImpl.java
Index: Nested2BindingImpl.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/wsdl/nested/Nested2BindingImpl.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Nested2BindingImpl.java 14 Jun 2002 18:48:40 -0000 1.3
+++ Nested2BindingImpl.java 1 Jul 2002 19:37:52 -0000 1.4
@@ -6,48 +6,48 @@
*/
package test.wsdl.nested;
-import test.wsdl.nested.holders.PEADDRESSHolder;
import test.wsdl.nested.holders.RETURNHolder;
+import test.wsdl.nested.holders.PE_ADDRESSHolder;
public class Nested2BindingImpl implements test.wsdl.nested.Nested2PortType {
- public void nestedSvc2(java.lang.String cUSTOMERNO, java.lang.String
pIDISTRCHAN, java.lang.String pIDIVISION, java.lang.String pIPASSBUFFER,
java.lang.String pISALESORG, PEADDRESSHolder pEADDRESS, RETURNHolder rETURN) throws
java.rmi.RemoteException {
- PEADDRESS address = new PEADDRESS();
- address.setFORMOFAD("Company");
- address.setFIRSTNAME("");
+ public void nestedSvc2(java.lang.String cUSTOMERNO, java.lang.String
pIDISTRCHAN, java.lang.String pIDIVISION, java.lang.String pIPASSBUFFER,
java.lang.String pISALESORG, PE_ADDRESSHolder pE_ADDRESS, RETURNHolder rETURN) throws
java.rmi.RemoteException {
+ PE_ADDRESS address = new PE_ADDRESS();
+ address.setFORM_OF_AD("Company");
+ address.setFIRST_NAME("");
address.setNAME("Becker Berlin");
- address.setNAME3("");
- address.setNAME4("");
- address.setDATEBIRTH("0000-00-00");
+ address.setNAME_3("");
+ address.setNAME_4("");
+ address.setDATE_BIRTH("0000-00-00");
address.setSTREET("Calvinstr. 36");
- address.setPOSTLCODE("13467");
+ address.setPOSTL_CODE("13467");
address.setCITY("Berlin");
address.setREGION("");
address.setCOUNTRY("");
address.setCOUNTRNISO("");
address.setCOUNTRAISO("");
address.setINTERNET("");
- address.setFAXNUMBER("030-8853-999");
+ address.setFAX_NUMBER("030-8853-999");
address.setTELEPHONE("030-8853-0");
address.setTELEPHONE2("");
address.setLANGU("D");
- address.setLANGUISO("DE");
+ address.setLANGU_ISO("DE");
address.setCURRENCY("");
- address.setCURRENCYISO("");
+ address.setCURRENCY_ISO("");
address.setCOUNTRYISO("DE");
- address.setONLYCHANGECOMADDRESS("X");
+ address.setONLY_CHANGE_COMADDRESS("X");
RETURN ret = new RETURN();
ret.setTYPE("");
ret.setCODE("");
ret.setMESSAGE("");
- ret.setLOGNO("");
- ret.setLOGMSGNO("123456");
- ret.setMESSAGEV1("");
- ret.setMESSAGEV2("");
- ret.setMESSAGEV3("");
- ret.setMESSAGEV4("");
+ ret.setLOG_NO("");
+ ret.setLOG_MSG_NO("123456");
+ ret.setMESSAGE_V1("");
+ ret.setMESSAGE_V2("");
+ ret.setMESSAGE_V3("");
+ ret.setMESSAGE_V4("");
- pEADDRESS.value = address;
+ pE_ADDRESS.value = address;
rETURN.value = ret;
}
1.4 +6 -6 xml-axis/java/test/wsdl/nested/Nested2ServiceTestCase.java
Index: Nested2ServiceTestCase.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/wsdl/nested/Nested2ServiceTestCase.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Nested2ServiceTestCase.java 14 Jun 2002 18:48:40 -0000 1.3
+++ Nested2ServiceTestCase.java 1 Jul 2002 19:37:52 -0000 1.4
@@ -6,7 +6,7 @@
*/
package test.wsdl.nested;
-import test.wsdl.nested.holders.PEADDRESSHolder;
+import test.wsdl.nested.holders.PE_ADDRESSHolder;
import test.wsdl.nested.holders.RETURNHolder;
public class Nested2ServiceTestCase extends junit.framework.TestCase {
@@ -24,21 +24,21 @@
assertTrue("binding is null", binding != null);
try {
- PEADDRESSHolder pEADDRESS = new PEADDRESSHolder();
+ PE_ADDRESSHolder pE_ADDRESS = new PE_ADDRESSHolder();
RETURNHolder rETURN = new RETURNHolder();
binding.nestedSvc2(new java.lang.String("0000001000"),
new java.lang.String("01"),
new java.lang.String("00"),
new java.lang.String(""),
new java.lang.String("1000"),
- pEADDRESS,
+ pE_ADDRESS,
rETURN);
- PEADDRESS address = pEADDRESS.value;
+ PE_ADDRESS address = pE_ADDRESS.value;
RETURN ret = rETURN.value;
System.out.println("NAME:" + address.getNAME());
assertTrue("NAME is wrong", address.getNAME().equals("Becker Berlin"));
- System.out.println("LOGMSGNO:" + ret.getLOGMSGNO());
- assertTrue("LOGMSGNO is wrong", ret.getLOGMSGNO().equals("123456"));
+ System.out.println("LOGMSGNO:" + ret.getLOG_MSG_NO());
+ assertTrue("LOGMSGNO is wrong", ret.getLOG_MSG_NO().equals("123456"));
}
catch (java.rmi.RemoteException re) {
throw new junit.framework.AssertionFailedError("Remote Exception
caught: " + re);
1.27 +3 -4 xml-axis/java/test/wsdl/types/VerifyTestCase.java
Index: VerifyTestCase.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/wsdl/types/VerifyTestCase.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- VerifyTestCase.java 14 Jun 2002 18:48:40 -0000 1.26
+++ VerifyTestCase.java 1 Jul 2002 19:37:53 -0000 1.27
@@ -52,7 +52,6 @@
import test.wsdl.types.comprehensive_types.holders.ElemWComplexHolder;
import test.wsdl.types.comprehensive_types.EmptyComplexType;
import test.wsdl.types.comprehensive_types.holders.EmptyComplexTypeHolder;
-import test.wsdl.types.comprehensive_types.EmptyFault;
import test.wsdl.types.comprehensive_types.Enum;
import test.wsdl.types.comprehensive_types.holders.EnumHolder;
import test.wsdl.types.comprehensive_types.EnumByte;
@@ -62,7 +61,7 @@
import test.wsdl.types.comprehensive_types.EnumLong;
import test.wsdl.types.comprehensive_types.EnumShort;
import test.wsdl.types.comprehensive_types.EnumString;
-import test.wsdl.types.comprehensive_types.StockQuote;
+import test.wsdl.types.comprehensive_types.Stock_Quote;
import test.wsdl.types.comprehensive_types.Simple;
import test.wsdl.types.comprehensive_types.SimpleFwd;
import test.wsdl.types.comprehensive_types.Time;
@@ -334,7 +333,7 @@
} catch (java.rmi.RemoteException re) {
throw new junit.framework.AssertionFailedError("Remote Exception
caught: " + re );
}
- StockQuote stockQuote = new StockQuote();
+ Stock_Quote stockQuote = new Stock_Quote();
Time time = new Time();
time.setDST(false);
stockQuote.setTime(time);
@@ -345,7 +344,7 @@
stockQuote.setSymbol("AXS");
stockQuote.setLast("5");
ComplexWComplex complexWComplex = new ComplexWComplex();
- complexWComplex.setStockQuote(stockQuote);
+ complexWComplex.setStock_Quote(stockQuote);
complexWComplex.setOutside(22);
try {
binding.complexWComplexIn(complexWComplex);
1.1 xml-axis/java/test/wsdl/wrapped/City_BBBBindingImpl.java
Index: City_BBBBindingImpl.java
===================================================================
/**
* CityBBBBindingImpl.java
*
* This file was auto-generated from WSDL
* by the Apache Axis Wsdl2java emitter.
*/
package test.wsdl.wrapped;
import test.wsdl.wrapped.City_BBBBinding;
import test.wsdl.wrapped.Attraction;
public class City_BBBBindingImpl implements City_BBBBinding {
public static final String OID_STRING = "Attraction@cityCF::1028:1028";
public Attraction getAttraction(String attname) throws java.rmi.RemoteException {
Attraction attraction = new Attraction();
attraction.set_OID(OID_STRING);
attraction.setFacts("New Orleans at Christmastime is a city with the best
food in the world, the best music" +
" in the world, international shopping, the French
Quarter -- America's most " +
" romantic neighborhood, and the friendliest, most
big-hearted people you'd ever " +
" want to share a rousing celebration with. New Orleans
is a natural place for Christmas " +
" merry making, and if it is not, then, to quote a New
Orleans R&B classic, " +
" 'grits ain't groceries, eggs ain't
poultry, and Mona Lisa was a " +
" man.' Indeed, Christmas is an especially great
time to come because New Orleans " +
" hotels have attractive Papa Noel rates. Throughout
the month of December, New Orleans " +
" will be decorated like never before, which is saying a
lot for a town that loves " +
" exhibitionism. From the quaint, light-entwined cast
iron lamp posts to the historic " +
" houses and museums bright in their period holiday
garb, the French Quarter will sparkle "+
" like an antique toy store. The twinkling lights and
the cheery voices of carolers will " +
" have you dancing and prancing through Jackson Square,
in the jingle bell air. Riverwalk "+
" shopping center is a leader in the celebrations,
launching brass band parades twice " +
" daily that include the grand ol' rogue, Papa
Noel, and putting on a light show " +
" every evening in Spanish Plaza. Woldenberg Park, on
the riverfront, will decorate the " +
" night with commissioned light sculptures by local
artists. First National Bank of " +
" Commerce is sponsoring free nightly concerts of
soul-stirring gospel music in the " +
" stately St. Louis Cathedral. And New Orleans
restaurants have revived the tradition of "+
" 'Reveillon' dinners, a name that comes from
the French word for " +
" 'awakening' because it was a meal that was
eaten in the early morning " +
" immediately after Christmas Midnight Mass, in
celebration of the good news, of course, " +
" but, just as happily, in celebration of the end of the
Advent fast. You, however, do " +
" not have to wait til midnight, nor do you have to
observe the Advent fast. All you have"+
" to do is walk into a New Orleans restaurant and order
food so sublime, it is in itself" +
" a proof for the existence of heaven. And as every New
Orleanian knows, Heaven is " +
" presided over by a French-Italian-Creole chef with a
gumbo-pot belly and a laugh " +
" that fills that human heart with gladness. Merry
Christmas to ya, New Orleans style.");
return attraction;
}
}
1.1 xml-axis/java/test/wsdl/wrapped/City_BBBTestCase.java
Index: City_BBBTestCase.java
===================================================================
/**
* CityBBBTestCase.java
*
* This file was auto-generated from WSDL
* by the Apache Axis Wsdl2java emitter.
*/
package test.wsdl.wrapped;
public class City_BBBTestCase extends junit.framework.TestCase {
public City_BBBTestCase(String name) {
super(name);
}
public void test1CityBBBPortGetAttraction() {
City_BBBBinding binding;
try {
binding = new City_BBBLocator().getCity_BBBPort();
}
catch (javax.xml.rpc.ServiceException jre) {
throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException
caught: " + jre);
}
assertTrue("binding is null", binding != null);
try {
Attraction value = binding.getAttraction("Christmas");
assertEquals("OID value was wrong", value.get_OID(),
City_BBBBindingImpl.OID_STRING);
}
catch (java.rmi.RemoteException re) {
throw new junit.framework.AssertionFailedError("Remote Exception caught:
" + re);
}
}
}