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 ru...@apache.org on 2001/04/28 19:15:06 UTC
cvs commit: xml-axis/java/src/org/apache/axis/message RPCParam.java
rubys 01/04/28 10:15:06
Modified: java/samples/stock GetQuote.java
java/src/org/apache/axis/message RPCParam.java
Log:
Support getValue() on parameters without serializers
Revision Changes Path
1.13 +1 -1 xml-axis/java/samples/stock/GetQuote.java
Index: GetQuote.java
===================================================================
RCS file: /home/cvs/xml-axis/java/samples/stock/GetQuote.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- GetQuote.java 2001/04/27 01:10:19 1.12
+++ GetQuote.java 2001/04/28 17:15:05 1.13
@@ -90,7 +90,7 @@
if ( opts.isFlagSet('t') > 0 ) call.doLocal = true ;
call.setUserID( opts.getUser() );
call.setPassword( opts.getPassword() );
- String res = (String) call.invoke(
+ Object res = call.invoke(
"http://schemas.xmlsoap.org/soap/envelope/", "getQuote",
new Object[] {symbol} );
1.4 +19 -10 xml-axis/java/src/org/apache/axis/message/RPCParam.java
Index: RPCParam.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/RPCParam.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- RPCParam.java 2001/04/28 13:52:15 1.3
+++ RPCParam.java 2001/04/28 17:15:06 1.4
@@ -55,7 +55,7 @@
* <http://www.apache.org/>.
*/
-import java.io.IOException;
+import java.io.*;
import java.util.*;
import org.apache.axis.Constants;
import org.apache.axis.encoding.*;
@@ -163,7 +163,14 @@
if (value instanceof ElementRecorder) {
// !!! Lazy deserialization here... We have the SAX events,
// but haven't run them through a deserializer yet.
- return null;
+ StringWriter xml = new StringWriter();
+ try {
+ ((ElementRecorder)value).output(new SerializationContext(xml));
+ } catch (Exception e) {
+ if (DEBUG_LOG) e.printStackTrace();
+ return null;
+ }
+ return xml.getBuffer();
}
if (deserializer != null) {
@@ -177,10 +184,10 @@
public void output(SerializationContext context) throws IOException
{
AttributesImpl attrs = new AttributesImpl();
- Object val = getValue();
+ if (deserializer != null) getValue();
- if ((val != null) && (typeQName == null))
- typeQName = context.getQNameForClass(val.getClass());
+ if ((value != null) && (typeQName == null))
+ typeQName = context.getQNameForClass(value.getClass());
if (attributes != null) {
// Must be writing a message we parsed earlier, so just put out
@@ -203,17 +210,19 @@
}
}
- if (val == null)
+ if (value == null)
attrs.addAttribute(Constants.URI_SCHEMA_XSI, "null", "xsi:null",
"CDATA", "1");
}
context.startElement(new QName(getNamespaceURI(), getName()), attrs);
+
// Output the value...
- if (val != null)
- context.writeString(value.toString());
- else if (value instanceof ElementRecorder)
- ((ElementRecorder)value).output(context);
+ if (value != null)
+ if (value instanceof ElementRecorder)
+ ((ElementRecorder)value).output(context);
+ else
+ context.writeString(value.toString());
context.endElement();
}