[Laszlo-checkins] r11363 - in openlaszlo/trunk: WEB-INF/lps/lfc/data WEB-INF/lps/server/src/org/openlaszlo/remote/json/soap WEB-INF/lps/server/src/org/openlaszlo/remote/json/soap/encoding WEB-INF/lps/server/src/org/openlaszlo/servlets/responders lps/components/rpc lps/components/rpc/library test/rpc/soap
hqm@openlaszlo.org
hqm at openlaszlo.org
Mon Oct 6 14:05:21 PDT 2008
Author: hqm
Date: 2008-10-06 14:05:13 -0700 (Mon, 06 Oct 2008)
New Revision: 11363
Modified:
openlaszlo/trunk/WEB-INF/lps/lfc/data/LzHTTPDataProvider.lzs
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/remote/json/soap/ClientSOAPService.java
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/remote/json/soap/encoding/JSONObjectDeserializer.java
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/remote/json/soap/encoding/SOAPDataEncoder.java
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/servlets/responders/TemplateResponder.java
openlaszlo/trunk/lps/components/rpc/library/namespace.js
openlaszlo/trunk/lps/components/rpc/library/qname.js
openlaszlo/trunk/lps/components/rpc/library/rpc.js
openlaszlo/trunk/lps/components/rpc/library/soap.js
openlaszlo/trunk/lps/components/rpc/rpc.lzx
openlaszlo/trunk/lps/components/rpc/soap.lzx
openlaszlo/trunk/test/rpc/soap/dotnet-math.lzx
openlaszlo/trunk/test/rpc/soap/temperature.lzx
Log:
Change 20081006-hqm-Y by hqm at badtzmaru.home on 2008-10-06 16:58:50 EDT
in /Users/hqm/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: make SOAP work again
New Features:
Bugs Fixed: LPP-5172
Technical Reviewer: pbr
QA Reviewer: mamye
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details:
+ initial cut at getting soap to work again
+ SOAP encoding stuff on server sends back JSON or XML
+ lps/components/rpc/library/soap.js uses the new LzHTTPDataProvider API
Tests:
+ test/rpc/soap/dotnet-math.lzx works in swf8,swf9,dhtml
+ it appears the server for the temperature.lzx test no longer answers requests
+ The other tests in the test/rpc/soap/ diretory, google.lzx, and geography.lzx do not yet work, although they seem to work
still in lps3.3
+ the amazon.lzx test doesn't work, and no longer seems to work in lps3.3 either
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/data/LzHTTPDataProvider.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/data/LzHTTPDataProvider.lzs 2008-10-06 21:04:07 UTC (rev 11362)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/data/LzHTTPDataProvider.lzs 2008-10-06 21:05:13 UTC (rev 11363)
@@ -228,9 +228,11 @@
/**
* callback function for LzHTTPLoader
+ * @param loader The loader which received the data
+ * @param data can be an LzDataElement or String
* @access private
*/
- function loadSuccess (loader:LzHTTPLoader, data:LzDataElement) :void {
+ function loadSuccess (loader:LzHTTPLoader, data:*) :void {
var dreq:LzHTTPDataRequest = loader.dataRequest;
dreq.status = LzDataRequest.SUCCESS;
loader.owner.loadResponse( dreq, data );
@@ -238,9 +240,11 @@
/**
* callback function for LzHTTPLoader
+ * @param loader The loader which received the data
+ * @param data can be an LzDataElement or String
* @access private
*/
- function loadError (loader:LzHTTPLoader, data:LzDataElement) :void {
+ function loadError (loader:LzHTTPLoader, data:*) :void {
var dreq:LzHTTPDataRequest = loader.dataRequest;
dreq.status = LzDataRequest.ERROR;
loader.owner.loadResponse( dreq, data );
@@ -248,9 +252,11 @@
/**
* callback function for LzHTTPLoader
+ * @param loader The loader which received the data
+ * @param data can be an LzDataElement or String
* @access private
*/
- function loadTimeout (loader:LzHTTPLoader, data:LzDataElement) :void {
+ function loadTimeout (loader:LzHTTPLoader, data:*) :void {
var dreq:LzHTTPDataRequest = loader.dataRequest;
dreq.loadtime = (new Date()).getTime() - dreq.loadstarttime;
dreq.status = LzDataRequest.TIMEOUT;
@@ -270,7 +276,7 @@
* @param LzHTTPDataRequest dreq:
* @param LzDataElement data:
*/
- function loadResponse (dreq:LzHTTPDataRequest, data:LzDataElement) :void {
+ function loadResponse (dreq:LzHTTPDataRequest, data:*) :void {
dreq.loadtime = (new Date()).getTime() - dreq.loadstarttime;
if (data == null) {
Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/remote/json/soap/ClientSOAPService.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/remote/json/soap/ClientSOAPService.java 2008-10-06 21:04:07 UTC (rev 11362)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/remote/json/soap/ClientSOAPService.java 2008-10-06 21:05:13 UTC (rev 11363)
@@ -3,7 +3,7 @@
* ****************************************************************************/
/* J_LZ_COPYRIGHT_BEGIN *******************************************************
-* Copyright 2001-2007 Laszlo Systems, Inc. All Rights Reserved. *
+* Copyright 2001-2008 Laszlo Systems, Inc. All Rights Reserved. *
* Use is subject to license terms. *
* J_LZ_COPYRIGHT_END *********************************************************/
@@ -31,165 +31,123 @@
// Tells client data returned is an object
// this.__LZstubload = true
body.append("{");
- body.append("__LZstubload: true,");
+ body.append("\"__LZstubload\": true,");
// SOAP specific information
// object.stubinfo
- body.append("stubinfo: ");
+ body.append("\"stubinfo\": ");
{
body.append("{");
//------------------------------------------------------------
// this.service = service.getServiceName()
- body.append("service:" + ScriptCompiler.quote(service.getServiceName()) + ", ");
+ body.append("\"service\":" + ScriptCompiler.quote(service.getServiceName()) + ", ");
//------------------------------------------------------------
// this.port = service.getPort()
- body.append("port: "+ ScriptCompiler.quote(service.getPort()) +",");
+ body.append("\"port\": "+ ScriptCompiler.quote(service.getPort()) +",");
//------------------------------------------------------------
// this.wsdl = service.getWSDL()
- body.append("wsdl: "+ ScriptCompiler.quote(service.getWSDL()) + ",");
+ body.append("\"wsdl\": "+ ScriptCompiler.quote(service.getWSDL()) + ",");
//------------------------------------------------------------
// this.ctypes = <complexTypeInfoObject>
- body.append("__LZctypes: ");
+ body.append("\"__LZctypes\": ");
pushComplexTypeInfo(service.getSchemaComplexTypes());
body.append(", ");
//------------------------------------------------------------
// this._namespace = namespace /* target namespace */
- body.append("__LZnamespace: " +
+ body.append("\"__LZnamespace\": " +
ScriptCompiler.quote(service.getTargetNS()));
body.append("},");
}
// object.stub
- body.append("stub: ");
- {
- body.append("{");
+ body.append("\"stub\": ");
+ body.append("{");
- int count = 0;
- //------------------------------------------------------------
- // Create client-side service operations. Assuming that
- // operations won't be null.
- //------------------------------------------------------------
- Map operations = service.getOperations();
- Iterator iter = operations.keySet().iterator();
- while (iter.hasNext()) {
+ int count = 0;
+ //------------------------------------------------------------
+ // Create client-side service operations. Assuming that
+ // operations won't be null.
+ //------------------------------------------------------------
+ Map operations = service.getOperations();
+ Iterator iter = operations.keySet().iterator();
+ while (iter.hasNext()) {
- String opName = (String)iter.next();
- LZSOAPOperation op = (LZSOAPOperation)operations.get(opName);
+ String opName = (String)iter.next();
+ LZSOAPOperation op = (LZSOAPOperation)operations.get(opName);
- if (mLogger.isDebugEnabled()) {
- mLogger.debug(
- /* (non-Javadoc)
- * @i18n.test
- * @org-mes="adding operation: " + p[0]
- */
- org.openlaszlo.i18n.LaszloMessages.getMessage(
- ClientSOAPService.class.getName(),"051018-99", new Object[] {opName})
- );
- }
+ if (mLogger.isDebugEnabled()) {
+ mLogger.debug(
+ /* (non-Javadoc)
+ * @i18n.test
+ * @org-mes="adding operation: " + p[0]
+ */
+ org.openlaszlo.i18n.LaszloMessages.getMessage(
+ ClientSOAPService.class.getName(),"051018-99", new Object[] {opName})
+ );
+ }
- //------------------------------------------------------------
- //
- if (count++ > 0) { body.append(","); }
+ //------------------------------------------------------------
+ //
+ if (count++ > 0) { body.append(","); }
- body.append(opName+": function () {");
- {
- // arguments.callee.args gets set in the client and includes
- // secure and secureport information.
- //
- // var args = arguments.callee.args;
- body.append("var args = arguments.callee.args;\n");
+ body.append("\""+opName+"\": ");
- body.append("return LzSOAPService.invoke(");
-
- // _root.LzSOAP.invoke(
- // delegate,
- // args
- // header
- // opts, /* wsdl, service, port, operation, parts */
- // this.secure,
- // this.secureport,
- // );
-
-
- // 1. arguments[1] (should be delegate)
- body.append("arguments[1]");
- body.append(",");
-
-
- // 2. arguments[0] (should be array of arguments)
- body.append("arguments[0]");
- body.append(",");
-
-
- // 3. requestheaders
- body.append("args.superclass.requestheaders");
- body.append(",");
-
-
-
- // 4. opts
- {
- body.append("{");
-
- // 6. argument array of parameter type tuples like:
- // [
- // [ name1, element1, type1(qname) ],
- // [ name2, element2, type2(qname) ]
- body.append("parts: ");
- // ]
+ //"Multiply": function ()
+ // {var args = arguments.callee.args;
+ //return LzSOAPService.invoke(arguments[1],
+ //arguments[0],
+ //args.superclass.requestheaders,
+ //{"parts": [["tns:Multiply",
+ // null]],
+ // "opstyle": "document",
+ // "operation": "Multiply",
+ // "port": "MathServiceSoap",
+ // "service": "MathService",
+ // "wsdl":
+ // "http://www.dotnetjunkies.com/quickstart..../cs/mathservice.asmx?WSDL"},
+ // args.superclass.secure,
+ //args.superclass.secureport);}
+ body.append("{");
+ // 6. argument array of parameter type tuples like:
+ // [
+ // [ name1, element1, type1(qname) ],
+ // [ name2, element2, type2(qname) ]
+ body.append("\"parts\": ");
+ // ]
+ pushParts(op.getInputMessage(), op.getStyle());
+ body.append(",");
+ // 5. operation type
+ body.append("\"opstyle\": ");
+ body.append(ScriptCompiler.quote(op.getStyle()));
+ body.append(",");
- pushParts(op.getInputMessage(), op.getStyle());
- body.append(",");
+ // 4. operation name
+ body.append("\"operation\": ");
+ body.append(ScriptCompiler.quote(opName));
+ body.append(",");
- // 5. operation type
- body.append("opstyle: ");
- body.append(ScriptCompiler.quote(op.getStyle()));
+ // 3. SOAP port
+ body.append("\"port\": ");
+ body.append(ScriptCompiler.quote(service.getPort()));
+ body.append(",");
- body.append(",");
+ // 2. SOAP service
+ body.append("\"service\": ");
+ body.append(ScriptCompiler.quote(service.getServiceName()));
+ body.append(",");
- // 4. operation name
- body.append("operation: ");
- body.append(ScriptCompiler.quote(opName));
- body.append(",");
-
- // 3. SOAP port
- body.append("port: ");
- body.append(ScriptCompiler.quote(service.getPort()));
- body.append(",");
-
- // 2. SOAP service
- body.append("service: ");
- body.append(ScriptCompiler.quote(service.getServiceName()));
- body.append(",");
-
- // 1. SOAP wsdl
- body.append("wsdl: ");
- body.append(ScriptCompiler.quote(service.getWSDL()));
- body.append("}");
- }
- body.append(",");
-
-
- // 5. secure
- body.append("args.superclass.secure");
- body.append(",");
-
-
- // 6. secureport
- body.append("args.superclass.secureport");
-
- body.append(");");
- body.append("}");
- }
- }
+ // 1. SOAP wsdl
+ body.append("\"wsdl\": ");
+ body.append(ScriptCompiler.quote(service.getWSDL()));
body.append("}");
}
body.append("}");
+ body.append("}");
return body.toString();
}
@@ -261,7 +219,7 @@
if (count > 0) {
body.append(", ");
}
- if (null != (ct.getName().getLocalPart()) ||
+ if ((ct.getName().getLocalPart()) != null &&
!((ct.getName().getLocalPart()).equals(""))) {
mLogger.debug("pushComplexTypeInfo ct: "+ct.getName().getLocalPart()+" ,"
@@ -271,12 +229,12 @@
body.append(ScriptCompiler.quote(ct.getName().getLocalPart())+": ");
body.append("{");
// namespace
- body.append("ns: ");
+ body.append("\"ns\": ");
body.append(ScriptCompiler.quote(ct.getName().getNamespaceURI()));
body.append(",");
// type is one of simple, complex, array
- body.append("type: ");
+ body.append("\"type\": ");
body.append(ScriptCompiler.quote(ct.getTypeString()));
body.append(",");
Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/remote/json/soap/encoding/JSONObjectDeserializer.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/remote/json/soap/encoding/JSONObjectDeserializer.java 2008-10-06 21:04:07 UTC (rev 11362)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/remote/json/soap/encoding/JSONObjectDeserializer.java 2008-10-06 21:05:13 UTC (rev 11363)
@@ -3,7 +3,7 @@
* ****************************************************************************/
/* J_LZ_COPYRIGHT_BEGIN *******************************************************
-* Copyright 2001-2007 Laszlo Systems, Inc. All Rights Reserved. *
+* Copyright 2001-2008 Laszlo Systems, Inc. All Rights Reserved. *
* Use is subject to license terms. *
* J_LZ_COPYRIGHT_END *********************************************************/
@@ -218,10 +218,10 @@
}
body.append(",");
- body.append("__LZclassnamespace: ");
+ body.append("\"__LZclassnamespace\": ");
body.append(ScriptCompiler.quote(mClassNameSpace));
body.append(",");
- body.append("__LZclassname: ");
+ body.append("\"__LZclassname\": ");
body.append(ScriptCompiler.quote(mClassName));
body.append("})");
Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/remote/json/soap/encoding/SOAPDataEncoder.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/remote/json/soap/encoding/SOAPDataEncoder.java 2008-10-06 21:04:07 UTC (rev 11362)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/remote/json/soap/encoding/SOAPDataEncoder.java 2008-10-06 21:05:13 UTC (rev 11363)
@@ -5,7 +5,7 @@
* ****************************************************************************/
/* J_LZ_COPYRIGHT_BEGIN *******************************************************
-* Copyright 2001-2007 Laszlo Systems, Inc. All Rights Reserved. *
+* Copyright 2001-2008 Laszlo Systems, Inc. All Rights Reserved. *
* Use is subject to license terms. *
* J_LZ_COPYRIGHT_END *********************************************************/
@@ -268,9 +268,8 @@
SOAPElement elem = ((SOAPElement)v.get(0));
String str = serializeSOAPElt(elem);
- body.append("LzDataNode.stringToLzData("+ScriptCompiler.quote(str)+")");
+ body.append(str);
-
endDocument();
} catch (IOException e) {
throw new RuntimeException(e.getMessage());
Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/servlets/responders/TemplateResponder.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/servlets/responders/TemplateResponder.java 2008-10-06 21:04:07 UTC (rev 11362)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/servlets/responders/TemplateResponder.java 2008-10-06 21:05:13 UTC (rev 11363)
@@ -3,7 +3,7 @@
* ****************************************************************************/
/* J_LZ_COPYRIGHT_BEGIN *******************************************************
-* Copyright 2001-2006 Laszlo Systems, Inc. All Rights Reserved. *
+* Copyright 2001-2006, 2008 Laszlo Systems, Inc. All Rights Reserved. *
* Use is subject to license terms. *
* J_LZ_COPYRIGHT_END *********************************************************/
@@ -87,9 +87,6 @@
// Get the canvas first, so that if this fails and we
// write the compilation error, nothing has been written
// to out yet.
- if (fileName.endsWith(".lzo")) {
- fileName = fileName.substring(0, fileName.length() - 1) + "x";
- }
Canvas canvas = getCanvas(fileName, req);
writeCanvas(out, req, canvas, fileName);
} catch (CompilationError e) {
Modified: openlaszlo/trunk/lps/components/rpc/library/namespace.js
===================================================================
--- openlaszlo/trunk/lps/components/rpc/library/namespace.js 2008-10-06 21:04:07 UTC (rev 11362)
+++ openlaszlo/trunk/lps/components/rpc/library/namespace.js 2008-10-06 21:05:13 UTC (rev 11363)
@@ -70,6 +70,8 @@
class LzNamespace {
+var namespace:String;
+
function LzNamespace (namespace) {
this.namespace = namespace;
}
@@ -90,49 +92,51 @@
return ns ? ns[ctqn.getLocalPart()] : null;
}
-static var ns = {};
+public static var ns = {};
//------------------------------------------------------------------------------
// Statics from org.apache.axis.Constants.
//------------------------------------------------------------------------------
// SOAP encoding namespace URIs
-static var URI_SOAP11_ENC = "http://schemas.xmlsoap.org/soap/encoding/";
-static var URI_SOAP12_ENC = "http://www.w3.org/2002/12/soap-encoding";
-static var URI_SOAP12_NOENC =
+public static var URI_SOAP11_ENC = "http://schemas.xmlsoap.org/soap/encoding/";
+public static var URI_SOAP12_ENC = "http://www.w3.org/2002/12/soap-encoding";
+public static var URI_SOAP12_NOENC =
"http://www.w3.org/2002/12/soap-envelope/encoding/none";
-static var URI_DEFAULT_SOAP_ENC = LzNamespace.URI_SOAP11_ENC
+public static var URI_DEFAULT_SOAP_ENC = "http://schemas.xmlsoap.org/soap/encoding/";
// SOAP envelope namespace URIs
-static var URI_SOAP11_ENV = "http://schemas.xmlsoap.org/soap/envelope/" ;
-static var URI_SOAP12_ENV = "http://www.w3.org/2002/12/soap-envelope";
-static var URI_DEFAULT_SOAP_ENV = LzNamespace.URI_SOAP11_ENV;
+public static var URI_SOAP11_ENV = "http://schemas.xmlsoap.org/soap/envelope/" ;
+public static var URI_SOAP12_ENV = "http://www.w3.org/2002/12/soap-envelope";
+public static var URI_DEFAULT_SOAP_ENV = "http://schemas.xmlsoap.org/soap/envelope/" ;
// Schema definition namespace URIs
-static var URI_1999_SCHEMA_XSD = "http://www.w3.org/1999/XMLSchema";
-static var URI_2000_SCHEMA_XSD = "http://www.w3.org/2000/10/XMLSchema";
-static var URI_2001_SCHEMA_XSD = "http://www.w3.org/2001/XMLSchema";
-static var URI_DEFAULT_SCHEMA_XSD = LzNamespace.URI_2001_SCHEMA_XSD;
+public static var URI_1999_SCHEMA_XSD = "http://www.w3.org/1999/XMLSchema";
+public static var URI_2000_SCHEMA_XSD = "http://www.w3.org/2000/10/XMLSchema";
+public static var URI_2001_SCHEMA_XSD = "http://www.w3.org/2001/XMLSchema";
+public static var URI_DEFAULT_SCHEMA_XSD = "http://www.w3.org/2001/XMLSchema";
-static var URIS_SCHEMA_XSD =
- [ LzNamespace.URI_2001_SCHEMA_XSD,
- LzNamespace.URI_2000_SCHEMA_XSD,
- LzNamespace.URI_1999_SCHEMA_XSD ];
+public static var URIS_SCHEMA_XSD =
+ [ "http://www.w3.org/2001/XMLSchema",
+ "http://www.w3.org/2000/XMLSchema",
+ "http://www.w3.org/1999/XMLSchema"];
+
// Schema instance namespace URIs
-static var URI_1999_SCHEMA_XSI = "http://www.w3.org/1999/XMLSchema-instance";
-static var URI_2000_SCHEMA_XSI =
+public static var URI_1999_SCHEMA_XSI = "http://www.w3.org/1999/XMLSchema-instance";
+public static var URI_2000_SCHEMA_XSI =
"http://www.w3.org/2000/10/XMLSchema-instance";
-static var URI_2001_SCHEMA_XSI = "http://www.w3.org/2001/XMLSchema-instance";
-static var URI_DEFAULT_SCHEMA_XSI = LzNamespace.URI_2001_SCHEMA_XSI;
+public static var URI_2001_SCHEMA_XSI = "http://www.w3.org/2001/XMLSchema-instance";
+public static var URI_DEFAULT_SCHEMA_XSI = "http://www.w3.org/2001/XMLSchema-instance";
-static var URIS_SCHEMA_XSI =
- [ LzNamespace.URI_1999_SCHEMA_XSI,
- LzNamespace.URI_2000_SCHEMA_XSI,
- LzNamespace.URI_2001_SCHEMA_XSI ];
+public static var URIS_SCHEMA_XSI =
+ [ "http://www.w3.org/1999/XMLSchema-instance",
+ "http://www.w3.org/2000/10/XMLSchema-instance",
+ "http://www.w3.org/2001/10/XMLSchema-instance"];
}
+
]]>
</script>
</library>
Modified: openlaszlo/trunk/lps/components/rpc/library/qname.js
===================================================================
--- openlaszlo/trunk/lps/components/rpc/library/qname.js 2008-10-06 21:04:07 UTC (rev 11362)
+++ openlaszlo/trunk/lps/components/rpc/library/qname.js 2008-10-06 21:05:13 UTC (rev 11363)
@@ -67,191 +67,257 @@
*/
//=============================================================================
-// DEFINE OBJECT: QName
+// DEFINE OBJECT: LzQName
//
// Create a qualified name object.
//
-// @param local: local part of the QName.
-// @param namespaceURI: namespace URI for the QName.
+// @param local: local part of the LzQName.
+// @param namespaceURI: namespace URI for the LzQName.
//==============================================================================
-class QName {
+public class LzQName {
var __LZns;
var __LZlocal;
-function QName(local, namespaceURI)
+function LzQName(local, namespaceURI)
{
this.__LZlocal = local;
this.__LZns = namespaceURI;
- QName.SUPPORTED_TYPES[this.toString()] = true;
+ if (LzQName.SUPPORTED_TYPES == null) {
+ LzQName.SUPPORTED_TYPES = {};
+ }
+ LzQName.SUPPORTED_TYPES[this.toString()] = true;
}
-static var SUPPORTED_TYPES = {};
+static var SUPPORTED_TYPES = null;
//-----------------------------------------------------------------------------
-// String representation of this QName.
+// String representation of this LzQName.
//-----------------------------------------------------------------------------
function toString () {
- return "QName {" + this.__LZns + "}" + this.__LZlocal;
+ return "LzQName {" + this.__LZns + "}" + this.__LZlocal;
}
//-----------------------------------------------------------------------------
-// QName simple XSD type constants
+// LzQName simple XSD type constants
//-----------------------------------------------------------------------------
-static var XSD_STRING =
- new QName("string", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
-static var XSD_BOOLEAN =
- new QName("boolean", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
-static var XSD_DOUBLE =
- new QName("double", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
-static var XSD_FLOAT =
- new QName("float", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
-static var XSD_INT =
- new QName("int", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
-static var XSD_INTEGER =
- new QName("integer", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
-static var XSD_LONG =
- new QName("long", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
-static var XSD_SHORT =
- new QName("short", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
-static var XSD_BYTE =
- new QName("byte", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
-static var XSD_DECIMAL =
- new QName("decimal", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
-static var XSD_BASE64 =
- new QName("base64Binary", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
-static var XSD_HEXBIN =
- new QName("hexBinary", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
-static var XSD_ANYTYPE =
- new QName("anyType", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
-static var XSD_ANY =
- new QName("any", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
-static var XSD_QNAME =
- new QName("QName", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
-static var XSD_DATETIME =
- new QName("dateTime", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
-static var XSD_DATE =
- new QName("date", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
-static var XSD_TIME =
- new QName("time", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
-static var XSD_TIMEINSTANT1999 =
- new QName("timeInstant", LzNamespace.URI_1999_SCHEMA_XSD);
-static var XSD_TIMEINSTANT2000 =
- new QName("timeInstant", LzNamespace.URI_2000_SCHEMA_XSD);
+ static var XSD_STRING;
+ XSD_STRING =
+ new LzQName("string", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
+ static var XSD_BOOLEAN;
+ XSD_BOOLEAN =
+ new LzQName("boolean", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
+ static var XSD_DOUBLE;
+ XSD_DOUBLE =
+ new LzQName("double", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
+ static var XSD_FLOAT;
+ XSD_FLOAT =
+ new LzQName("float", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
+ static var XSD_INT;
+ XSD_INT =
+ new LzQName("int", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
+ static var XSD_INTEGER;
+ XSD_INTEGER =
+ new LzQName("integer", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
+ static var XSD_LONG;
+ XSD_LONG =
+ new LzQName("long", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
+ static var XSD_SHORT;
+ XSD_SHORT =
+ new LzQName("short", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
+ static var XSD_BYTE;
+ XSD_BYTE =
+ new LzQName("byte", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
+ static var XSD_DECIMAL;
+ XSD_DECIMAL =
+ new LzQName("decimal", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
+ static var XSD_BASE64;
+ XSD_BASE64 =
+ new LzQName("base64Binary", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
+ static var XSD_HEXBIN;
+ XSD_HEXBIN =
+ new LzQName("hexBinary", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
+ static var XSD_ANYTYPE;
+ XSD_ANYTYPE =
+ new LzQName("anyType", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
+ static var XSD_ANY;
+ XSD_ANY =
+ new LzQName("any", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
+ static var XSD_QNAME;
+ XSD_QNAME =
+ new LzQName("LzQName", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
+ static var XSD_DATETIME;
+ XSD_DATETIME =
+ new LzQName("dateTime", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
+ static var XSD_DATE;
+ XSD_DATE =
+ new LzQName("date", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
+ static var XSD_TIME;
+ XSD_TIME =
+ new LzQName("time", LzNamespace.URI_DEFAULT_SCHEMA_XSD);
+ static var XSD_TIMEINSTANT1999;
+ XSD_TIMEINSTANT1999 =
+ new LzQName("timeInstant", LzNamespace.URI_1999_SCHEMA_XSD);
+ static var XSD_TIMEINSTANT2000;
+ XSD_TIMEINSTANT2000 =
+ new LzQName("timeInstant", LzNamespace.URI_2000_SCHEMA_XSD);
-static var XSD_NORMALIZEDSTRING =
- new QName("normalizedString", LzNamespace.URI_2001_SCHEMA_XSD);
-static var XSD_TOKEN =
- new QName("token", LzNamespace.URI_2001_SCHEMA_XSD);
+ static var XSD_NORMALIZEDSTRING;
+ XSD_NORMALIZEDSTRING =
+ new LzQName("normalizedString", LzNamespace.URI_2001_SCHEMA_XSD);
+ static var XSD_TOKEN;
+ XSD_TOKEN =
+ new LzQName("token", LzNamespace.URI_2001_SCHEMA_XSD);
-static var XSD_UNSIGNEDLONG =
- new QName("unsignedLong", LzNamespace.URI_2001_SCHEMA_XSD);
-static var XSD_UNSIGNEDINT =
- new QName("unsignedInt", LzNamespace.URI_2001_SCHEMA_XSD);
-static var XSD_UNSIGNEDSHORT =
- new QName("unsignedShort", LzNamespace.URI_2001_SCHEMA_XSD);
-static var XSD_UNSIGNEDBYTE =
- new QName("unsignedByte", LzNamespace.URI_2001_SCHEMA_XSD);
-static var XSD_POSITIVEINTEGER =
- new QName("positiveInteger", LzNamespace.URI_2001_SCHEMA_XSD);
-static var XSD_NEGATIVEINTEGER =
- new QName("negativeInteger", LzNamespace.URI_2001_SCHEMA_XSD);
-static var XSD_NONNEGATIVEINTEGER =
- new QName("nonNegativeInteger", LzNamespace.URI_2001_SCHEMA_XSD);
-static var XSD_NONPOSITIVEINTEGER =
- new QName("nonPositiveInteger", LzNamespace.URI_2001_SCHEMA_XSD);
+ static var XSD_UNSIGNEDLONG;
+ XSD_UNSIGNEDLONG =
+ new LzQName("unsignedLong", LzNamespace.URI_2001_SCHEMA_XSD);
+ static var XSD_UNSIGNEDINT;
+ XSD_UNSIGNEDINT =
+ new LzQName("unsignedInt", LzNamespace.URI_2001_SCHEMA_XSD);
+ static var XSD_UNSIGNEDSHORT;
+ XSD_UNSIGNEDSHORT =
+ new LzQName("unsignedShort", LzNamespace.URI_2001_SCHEMA_XSD);
+ static var XSD_UNSIGNEDBYTE;
+ XSD_UNSIGNEDBYTE =
+ new LzQName("unsignedByte", LzNamespace.URI_2001_SCHEMA_XSD);
+ static var XSD_POSITIVEINTEGER;
+ XSD_POSITIVEINTEGER =
+ new LzQName("positiveInteger", LzNamespace.URI_2001_SCHEMA_XSD);
+ static var XSD_NEGATIVEINTEGER;
+ XSD_NEGATIVEINTEGER =
+ new LzQName("negativeInteger", LzNamespace.URI_2001_SCHEMA_XSD);
+ static var XSD_NONNEGATIVEINTEGER;
+ XSD_NONNEGATIVEINTEGER =
+ new LzQName("nonNegativeInteger", LzNamespace.URI_2001_SCHEMA_XSD);
+ static var XSD_NONPOSITIVEINTEGER;
+ XSD_NONPOSITIVEINTEGER =
+ new LzQName("nonPositiveInteger", LzNamespace.URI_2001_SCHEMA_XSD);
-static var XSD_YEARMONTH =
- new QName("gYearMonth", LzNamespace.URI_2001_SCHEMA_XSD);
-static var XSD_MONTHDAY =
- new QName("gMonthDay", LzNamespace.URI_2001_SCHEMA_XSD);
-static var XSD_YEAR =
- new QName("gYear", LzNamespace.URI_2001_SCHEMA_XSD);
-static var XSD_MONTH =
- new QName("gMonth", LzNamespace.URI_2001_SCHEMA_XSD);
-static var XSD_DAY =
- new QName("gDay", LzNamespace.URI_2001_SCHEMA_XSD);
-static var XSD_DURATION =
- new QName("duration", LzNamespace.URI_2001_SCHEMA_XSD);
+ static var XSD_YEARMONTH;
+ XSD_YEARMONTH =
+ new LzQName("gYearMonth", LzNamespace.URI_2001_SCHEMA_XSD);
+ static var XSD_MONTHDAY;
+ XSD_MONTHDAY =
+ new LzQName("gMonthDay", LzNamespace.URI_2001_SCHEMA_XSD);
+ static var XSD_YEAR;
+ XSD_YEAR =
+ new LzQName("gYear", LzNamespace.URI_2001_SCHEMA_XSD);
+ static var XSD_MONTH;
+ XSD_MONTH =
+ new LzQName("gMonth", LzNamespace.URI_2001_SCHEMA_XSD);
+ static var XSD_DAY;
+ XSD_DAY =
+ new LzQName("gDay", LzNamespace.URI_2001_SCHEMA_XSD);
+ static var XSD_DURATION;
+ XSD_DURATION =
+ new LzQName("duration", LzNamespace.URI_2001_SCHEMA_XSD);
-static var XSD_NAME =
- new QName("Name", LzNamespace.URI_2001_SCHEMA_XSD);
-static var XSD_NCNAME =
- new QName("NCName", LzNamespace.URI_2001_SCHEMA_XSD);
-static var XSD_NMTOKEN =
- new QName("NMTOKEN", LzNamespace.URI_2001_SCHEMA_XSD);
-static var XSD_NMTOKENS =
- new QName("NMTOKENS", LzNamespace.URI_2001_SCHEMA_XSD);
-static var XSD_NOTATION =
- new QName("NOTATION", LzNamespace.URI_2001_SCHEMA_XSD);
-static var XSD_ENTITY =
- new QName("ENTITY", LzNamespace.URI_2001_SCHEMA_XSD);
-static var XSD_ENTITIES =
- new QName("ENTITIES", LzNamespace.URI_2001_SCHEMA_XSD);
-static var XSD_IDREF =
- new QName("IDREF", LzNamespace.URI_2001_SCHEMA_XSD);
-static var XSD_IDREFS =
- new QName("IDREFS", LzNamespace.URI_2001_SCHEMA_XSD);
-static var XSD_ANYURI =
- new QName("anyURI", LzNamespace.URI_2001_SCHEMA_XSD);
-static var XSD_LANGUAGE =
- new QName("language", LzNamespace.URI_2001_SCHEMA_XSD);
-static var XSD_ID =
- new QName("ID", LzNamespace.URI_2001_SCHEMA_XSD);
-static var XSD_SCHEMA =
- new QName("schema", LzNamespace.URI_2001_SCHEMA_XSD);
+ static var XSD_NAME;
+ XSD_NAME =
+ new LzQName("Name", LzNamespace.URI_2001_SCHEMA_XSD);
+ static var XSD_NCNAME;
+ XSD_NCNAME =
+ new LzQName("NCName", LzNamespace.URI_2001_SCHEMA_XSD);
+ static var XSD_NMTOKEN;
+ XSD_NMTOKEN =
+ new LzQName("NMTOKEN", LzNamespace.URI_2001_SCHEMA_XSD);
+ static var XSD_NMTOKENS;
+ XSD_NMTOKENS =
+ new LzQName("NMTOKENS", LzNamespace.URI_2001_SCHEMA_XSD);
+ static var XSD_NOTATION;
+ XSD_NOTATION =
+ new LzQName("NOTATION", LzNamespace.URI_2001_SCHEMA_XSD);
+ static var XSD_ENTITY;
+ XSD_ENTITY =
+ new LzQName("ENTITY", LzNamespace.URI_2001_SCHEMA_XSD);
+ static var XSD_ENTITIES;
+ XSD_ENTITIES =
+ new LzQName("ENTITIES", LzNamespace.URI_2001_SCHEMA_XSD);
+ static var XSD_IDREF;
+ XSD_IDREF =
+ new LzQName("IDREF", LzNamespace.URI_2001_SCHEMA_XSD);
+ static var XSD_IDREFS;
+ XSD_IDREFS =
+ new LzQName("IDREFS", LzNamespace.URI_2001_SCHEMA_XSD);
+ static var XSD_ANYURI;
+ XSD_ANYURI =
+ new LzQName("anyURI", LzNamespace.URI_2001_SCHEMA_XSD);
+ static var XSD_LANGUAGE;
+ XSD_LANGUAGE =
+ new LzQName("language", LzNamespace.URI_2001_SCHEMA_XSD);
+ static var XSD_ID;
+ XSD_ID =
+ new LzQName("ID", LzNamespace.URI_2001_SCHEMA_XSD);
+ static var XSD_SCHEMA;
+ XSD_SCHEMA =
+ new LzQName("schema", LzNamespace.URI_2001_SCHEMA_XSD);
//-----------------------------------------------------------------------------
-// QName SOAP encoding constants
+// LzQName SOAP encoding constants
//-----------------------------------------------------------------------------
-static var SOAP_BASE64 =
- new QName("base64", LzNamespace.URI_DEFAULT_SOAP_ENC);
-static var SOAP_BASE64BINARY =
- new QName("base64Binary", LzNamespace.URI_DEFAULT_SOAP_ENC);
-static var SOAP_STRING =
- new QName("string", LzNamespace.URI_DEFAULT_SOAP_ENC);
-static var SOAP_BOOLEAN =
- new QName("boolean", LzNamespace.URI_DEFAULT_SOAP_ENC);
-static var SOAP_DOUBLE =
- new QName("double", LzNamespace.URI_DEFAULT_SOAP_ENC);
-static var SOAP_FLOAT =
- new QName("float", LzNamespace.URI_DEFAULT_SOAP_ENC);
-static var SOAP_INT =
- new QName("int", LzNamespace.URI_DEFAULT_SOAP_ENC);
-static var SOAP_LONG =
- new QName("long", LzNamespace.URI_DEFAULT_SOAP_ENC);
-static var SOAP_SHORT =
- new QName("short", LzNamespace.URI_DEFAULT_SOAP_ENC);
-static var SOAP_BYTE =
- new QName("byte", LzNamespace.URI_DEFAULT_SOAP_ENC);
-static var SOAP_INTEGER =
- new QName("integer", LzNamespace.URI_DEFAULT_SOAP_ENC);
-static var SOAP_DECIMAL =
- new QName("decimal", LzNamespace.URI_DEFAULT_SOAP_ENC);
-static var SOAP_ARRAY =
- new QName("Array", LzNamespace.URI_DEFAULT_SOAP_ENC);
-static var SOAP_ARRAY12 =
- new QName("Array", LzNamespace.URI_SOAP12_ENC);
+ static var SOAP_BASE64;
+ SOAP_BASE64 =
+ new LzQName("base64", LzNamespace.URI_DEFAULT_SOAP_ENC);
+ static var SOAP_BASE64BINARY;
+ SOAP_BASE64BINARY =
+ new LzQName("base64Binary", LzNamespace.URI_DEFAULT_SOAP_ENC);
+ static var SOAP_STRING;
+ SOAP_STRING =
+ new LzQName("string", LzNamespace.URI_DEFAULT_SOAP_ENC);
+ static var SOAP_BOOLEAN;
+ SOAP_BOOLEAN =
+ new LzQName("boolean", LzNamespace.URI_DEFAULT_SOAP_ENC);
+ static var SOAP_DOUBLE;
+ SOAP_DOUBLE =
+ new LzQName("double", LzNamespace.URI_DEFAULT_SOAP_ENC);
+ static var SOAP_FLOAT;
+ SOAP_FLOAT =
+ new LzQName("float", LzNamespace.URI_DEFAULT_SOAP_ENC);
+ static var SOAP_INT;
+ SOAP_INT =
+ new LzQName("int", LzNamespace.URI_DEFAULT_SOAP_ENC);
+ static var SOAP_LONG;
+ SOAP_LONG =
+ new LzQName("long", LzNamespace.URI_DEFAULT_SOAP_ENC);
+ static var SOAP_SHORT;
+ SOAP_SHORT =
+ new LzQName("short", LzNamespace.URI_DEFAULT_SOAP_ENC);
+ static var SOAP_BYTE;
+ SOAP_BYTE =
+ new LzQName("byte", LzNamespace.URI_DEFAULT_SOAP_ENC);
+ static var SOAP_INTEGER;
+ SOAP_INTEGER =
+ new LzQName("integer", LzNamespace.URI_DEFAULT_SOAP_ENC);
+ static var SOAP_DECIMAL;
+ SOAP_DECIMAL =
+ new LzQName("decimal", LzNamespace.URI_DEFAULT_SOAP_ENC);
+ static var SOAP_ARRAY;
+ SOAP_ARRAY =
+ new LzQName("Array", LzNamespace.URI_DEFAULT_SOAP_ENC);
+ static var SOAP_ARRAY12;
+ SOAP_ARRAY12 =
+ new LzQName("Array", LzNamespace.URI_SOAP12_ENC);
//------------------------------------------------------------------------------
-// Get the local part of this QName.
+// Get the local part of this LzQName.
//------------------------------------------------------------------------------
function getLocalPart () {
return this.__LZlocal;
}
//------------------------------------------------------------------------------
-// Get the namespace for this QName.
+// Get the namespace for this LzQName.
//------------------------------------------------------------------------------
function getNamespaceURI () {
return this.__LZns;
}
//------------------------------------------------------------------------------
-// Compare this QName with another QName object.
-// @param qname: QName to compare against.
+// Compare this LzQName with another LzQName object.
+// @param qname: LzQName to compare against.
// @return true if qame's local part and namespace URI are the same as this
-// QName's.
+// LzQName's.
//------------------------------------------------------------------------------
function equals (qname) {
return this.__LZlocal == qname.__LZlocal &&
@@ -259,13 +325,13 @@
}
//------------------------------------------------------------------------------
-// Lifted from Apache AXIS org.apache.axis.Constants.equals(QName, QName).
+// Lifted from Apache AXIS org.apache.axis.Constants.equals(LzQName, LzQName).
//
-// The first QName is the current version of the name. The second QName is
+// The first LzQName is the current version of the name. The second LzQName is
// compared with the first considering all namespace uri versions.
//
-// @param first: currently supported QName
-// @param second: any QName
+// @param first: currently supported LzQName
+// @param second: any LzQName
//------------------------------------------------------------------------------
static function equals2 (first, second) {
if (first == second) {
@@ -284,9 +350,9 @@
var namespaceURI = first.getNamespaceURI();
var search = null;
if (namespaceURI == LzNamespace.URI_DEFAULT_SOAP_ENC) {
- search = LzNamespace.URIS_SOAP_ENC;
+ search = LzNamespace.URI_DEFAULT_SOAP_ENC;
} else if (namespaceURI == LzNamespace.URI_DEFAULT_SOAP_ENV) {
- search = LzNamespace.URIS_SOAP_ENV;
+ search = LzNamespace.URI_DEFAULT_SOAP_ENV;
} else if (namespaceURI == LzNamespace.URI_DEFAULT_SCHEMA_XSD) {
search = LzNamespace.URIS_SCHEMA_XSD;
} else if (namespaceURI == LzNamespace.URI_DEFAULT_SCHEMA_XSI) {
@@ -307,13 +373,14 @@
//------------------------------------------------------------------------------
// Check to see if qname is a supported primitive type.
//
-// @param QName qn: qname to check to see if it's a supported primitive type.
+// @param LzQName qn: qname to check to see if it's a supported primitive type.
// @return true if supported, else false.
//------------------------------------------------------------------------------
-static function isSupported (qn) {
- return (!!QName.SUPPORTED_TYPES[qn.toString()]);
+static function isSupported (qn:LzQName) {
+ return (!!LzQName.SUPPORTED_TYPES[qn.toString()]);
}
+}
]]>
</script>
</library>
Modified: openlaszlo/trunk/lps/components/rpc/library/rpc.js
===================================================================
--- openlaszlo/trunk/lps/components/rpc/library/rpc.js 2008-10-06 21:04:07 UTC (rev 11362)
+++ openlaszlo/trunk/lps/components/rpc/library/rpc.js 2008-10-06 21:05:13 UTC (rev 11363)
@@ -88,8 +88,6 @@
this.handleXMLRPCresponse(dreq);
} else if (dreq.protocol == LzRPC.JAVARPC_PROTOCOL) {
this.handleJSONRPCresponse(dreq);
- } else if (dreq.protocol == LzRPC.SOAP_PROTOCOL) {
- this.handleJSONRPCresponse(dreq);
} else {
Debug.error('LzRPC.handleResponse unknown protocol ', dreq.protocol);
}
@@ -132,7 +130,6 @@
seqnum: seqnum } );
} else if (data && (data instanceof LzDataElement) && data.childNodes[0].nodeName == 'error') {
-
var error = data.childNodes[0].attributes['msg'];
// check if whitelist/blacklist is in effect
@@ -149,7 +146,6 @@
seqnum: seqnum });
} else if (typeof(data) == 'object' && data['faultCode'] != null) {
-
// JavaRPC or XMLRPC error style
// TODO: come up with a single way of returning RPC errors from server
if (data.faultCode == 0 && data.faultString == 'void') {
@@ -169,7 +165,6 @@
}
} else if (typeof(data) == 'object' && data['errortype'] != null) {
-
// SOAP error style
// TODO: come up with a single way of returning RPC errors from server
delegate.execute({ status: 'error', errortype: data.errortype,
@@ -178,13 +173,11 @@
seqnum: seqnum });
} else if (typeof(data) == "undefined") {
-
delegate.execute({ status: 'error', errortype: 'timeout',
message: 'timed out', opinfo: opinfo,
seqnum: seqnum });
} else {
-
if (delegate['dataobject'] != null) {
if ( delegate.dataobject instanceof LzDataset ) {
var element = LzDataElement.valueToElement(data);
Modified: openlaszlo/trunk/lps/components/rpc/library/soap.js
===================================================================
--- openlaszlo/trunk/lps/components/rpc/library/soap.js 2008-10-06 21:04:07 UTC (rev 11362)
+++ openlaszlo/trunk/lps/components/rpc/library/soap.js 2008-10-06 21:05:13 UTC (rev 11363)
@@ -48,18 +48,31 @@
// ------------------------------------------------------------------------------
function loadObject (delegate, opts, secure, secureport){
- var o = this.__LZgetBasicLoadParams('GET');
+ var dreq = new LzSOAPDataRequest(this);
+
+ var service = opts['service']
+ var port = opts['port']
- o['request'] = 'load';
- o['wsdl'] = opts['wsdl'];
- o['url'] = 'soap://soap';
+ // We want treat response as JSON, not XML
+ dreq.parsexml = false;
+ dreq.method = "GET";
+ var params:* = {};
+ // Add in LPS Server proxy javarpc-protocol-specific query args
+ dreq.serverproxyargs = params;
+ params.request = 'load';
+ params.wsdl = opts['wsdl'];
+ params.url = 'soap://soap';
+
var service = opts['service']
var port = opts['port']
- if (service != null && service != "") o['service'] = service;
- if (port != null && port != "") o['port'] = port;
+ if (service != null && service != "") params['service'] = service;
+ if (port != null && port != "") params['port'] = port;
- return this.request( o, delegate, secure, secureport );
+ dreq.proxied = true;
+ dreq.src = 'soap://soap';
+ dreq.opinfo = {optype: 'LOADOBJECT'};
+ return this.request( dreq, delegate, secure, secureport );
}
@@ -73,7 +86,7 @@
// String service: name of SOAP service to use.
// String port: name of SOAP port.
// String operation: name of operation to invoke.
-// Array parts: array of QName representing type of each arg.
+// Array parts: array of LzQName representing type of each arg.
// @param Boolean secure: if true, call between client and LPS will be secure.
// @param Number secureport: secure port to use for invocation, if secure is
// true.
@@ -82,28 +95,36 @@
function invoke (delegate, args, header, opts, secure, secureport) {
if ( ! (delegate instanceof LzDelegate) ) {
- _root.Debug.write("ERROR: LzDelegate is required, got:", delegate);
+ Debug.write("ERROR: LzDelegate is required, got:", delegate);
return;
}
var parts = opts['parts'];
if (args.length != parts.length) {
- _root.Debug.write("wrong number of parameters; need " +
+ Debug.write("wrong number of parameters; need " +
parts.length + ", passed in " + args.length);
return;
}
- var o = this.__LZgetBasicLoadParams('POST');
- o['url'] = 'soap://soap';
- o['request'] = 'invoke';
- o['wsdl'] = opts['wsdl'];
- o['service'] = opts['service'];
- o['port'] = opts['port'];
- o['operation'] = opts['operation'];
- o['opstyle'] = opts['opstyle'];
+ var dreq:LzSOAPDataRequest = new LzSOAPDataRequest(this);
+ // Response will be JSON, not XML
+ dreq.parsexml = false;
+ dreq.method = "POST";
+ dreq.proxied = true;
+ dreq.src = 'soap://soap';
+ var params:* = {}
+ dreq.serverproxyargs = params;
+ params.request = 'invoke';
+ params.wsdl = opts['wsdl'];
+ params.service = opts['service'];
+ params.port = opts['port'];
+ params.operation = opts['operation'];
+ params.opstyle = opts['opstyle'];
+
+
var body;
- if (o['opstyle'] == "rpc") {
+ if (opts['opstyle'] == "rpc") {
body = this.__LZencSerializeParams(args, parts);
} else {
body = this.__LZdocumentArgsToXML(args);
@@ -116,12 +137,12 @@
h = this.__LZserialize(header.childNodes)
}
- o['lzpostbody'] = '<e><h>' + h + '</h><b>' + body + '</b></e>';
+ dreq.postbody = '<e><h>' + h + '</h><b>' + body + '</b></e>';
// this information will be passed back up ondata
- o['opinfo'] = { operation: o['operation'], opstyle: o['opstyle'] }
+ dreq.opinfo = { operation: opts['operation'], opstyle: opts['opstyle'] }
- return this.request( o, delegate, secure, secureport );
+ return this.request( dreq, delegate, secure, secureport );
}
//------------------------------------------------------------------------------
@@ -144,8 +165,8 @@
// FIXME [2005-05-15 pkang]: server should return default namespaces for xsi
// and soapenc. can't assume these defaults will hold true for all services.
- var xsiNS = _root.LzNamespace.URI_DEFAULT_SCHEMA_XSI;
- var soapencNS = _root.LzNamespace.URI_DEFAULT_SOAP_ENC;
+ var xsiNS = LzNamespace.URI_DEFAULT_SCHEMA_XSI;
+ var soapencNS = LzNamespace.URI_DEFAULT_SOAP_ENC;
// counter reference to use for namespaces
var cr = [ 0 ];
@@ -156,7 +177,6 @@
xml += this.__LZencSerialize(args[i], parts[i][0], parts[i][1], cr);
}
xml += "</params>\n";
-// _root.Debug.write("---- xml ----\n" + xml);
return xml;
}
@@ -166,20 +186,20 @@
//
// @param value: simple type value.
// @param element: element name.
-// @param typeQ: QName for type of value.
+// @param typeQ: LzQName for type of value.
// @param cr: counter reference for namespaces.
// @keywords private
//------------------------------------------------------------------------------
-function __LZencSerialize (value, element, typeQ, cr) {
+ function __LZencSerialize (value, element, typeQ:LzQName, cr:Array) {
var ct = LzNamespace.getType(typeQ);
-// _root.Debug.write('xxx', ct, typeQ, _root.QName.isSupported(typeQ));
+ // _root.Debug.write('xxx', ct, typeQ, _root.LzQName.isSupported(typeQ));
// if not an array or object
if ( ! ct['arraytype'] && ! ct['members'] ) {
// see if simple type is supported
- if (QName.isSupported(typeQ)) {
+ if (LzQName.isSupported(typeQ)) {
return this.__LZencSerializeSimple(value, element, typeQ, cr);
}
}
@@ -204,16 +224,16 @@
//
// @param simplevalue: simple type value.
// @param element: element name.
-// @param typeQ: QName for type of value.
+// @param typeQ: LzQName for type of value.
// @param cr: counter reference for namespaces.
// @keywords private
//------------------------------------------------------------------------------
-function __LZencSerializeSimple (simplevalue, element, typeQ, cr) {
+ function __LZencSerializeSimple (simplevalue, element:String, typeQ:LzQName, cr:Array) {
var ns = "ns" + (cr[0]++);
var xml = "<" + element + " " + ns + ":type=\""
+ ns + ":" + typeQ.getLocalPart() + "\""
+ " xmlns:" + ns + "=\"" + typeQ.getNamespaceURI() + "\">"
- + _root.lz.Browser.xmlEscape(simplevalue) + "</" + element + ">\n";
+ + lz.Browser.xmlEscape(simplevalue) + "</" + element + ">\n";
return xml;
}
@@ -223,7 +243,7 @@
//
// @param obj: object value.
// @param element: element name.
-// @param typeQ: QName for type of value.
+// @param typeQ: LzQName for type of value.
// @param cr: counter reference for namespaces.
// @keywords private
//------------------------------------------------------------------------------
@@ -251,7 +271,7 @@
//
// @param arr: array value.
// @param element: element name.
-// @param typeQ: QName for type of value.
+// @param typeQ: LzQName for type of value.
// @param cr: counter reference for namespaces.
// @keywords private
//------------------------------------------------------------------------------
@@ -296,7 +316,7 @@
//
// @keywords private
//------------------------------------------------------------------------------
-function __LZloadHook (stubinfo) {
+override function __LZloadHook (stubinfo) {
// service object has been received
// var proto = this.__LZcreatePrototypes(data);
@@ -313,10 +333,10 @@
// WSDLs can have multiple schemas with different namespaces
var nsURI = ti.ns;
- if ( _root.LzNamespace.ns[nsURI] == null ) {
- _root.LzNamespace.ns[nsURI] = new _root.LzNamespace(nsURI);
+ if ( LzNamespace.ns[nsURI] == null ) {
+ LzNamespace.ns[nsURI] = new LzNamespace(nsURI);
}
- var ns = _root.LzNamespace.ns[nsURI];
+ var ns = LzNamespace.ns[nsURI];
ns[ct] = function () {};
ns[ct].name = ct; // name to give the function
@@ -337,6 +357,79 @@
}
+override function handleResponse (dreq:LzRPCDataRequest) {
+ // The setup of the proxy object comes back as JSON
+ if (dreq.rpcinfo.opinfo && dreq.rpcinfo.opinfo.optype =='LOADOBJECT') {
+ this.handleJSONRPCresponse(dreq);
+ } else {
+ // the response to a SOAP operation comes back as XML
+ this.handleSOAPXMLresponse(dreq);
+ }
+}
+
+
+function handleSOAPXMLresponse (dreq:LzRPCDataRequest) {
+ var data:* = LzDataElement.stringToLzData(dreq.rawdata);
+ var delegate = null;
+ var opinfo = {};
+ var seqnum = -1;
+
+ var rpcinfo = dreq.rpcinfo;
+
+ if (rpcinfo) {
+ delegate = rpcinfo.delegate;
+ opinfo = (typeof rpcinfo['opinfo'] != "undefined" ) ? rpcinfo['opinfo'] : opinfo;
+ seqnum = rpcinfo.seqnum;
+ } else {
+ Debug.error('handleSOAPXMLresponse, no rpcinfo', dreq);
+ }
+
+ // TODO [hqm 2007-03-15] we need to pass these in if they in fact come from server
+ opinfo.responseheaders = null;
+
+ if (data && (data instanceof LzDataElement) && data.childNodes[0].nodeName == 'error') {
+ var error = data.childNodes[0].attributes['msg'];
+ // check if whitelist/blacklist is in effect
+ {
+ var check = 'Forbidden url: ';
+ var index = error.indexOf(check);
+ if (index != -1 && index == 0) {
+ error = 'Forbidden: ' + error.substring(check.length);
+ }
+ }
+
+ delegate.execute({ status: 'error', errortype: 'servererror',
+ message: error, opinfo: opinfo,
+ seqnum: seqnum });
+
+ } else if (typeof(data) == "undefined") {
+ delegate.execute({ status: 'error', errortype: 'timeout',
+ message: 'timed out', opinfo: opinfo,
+ seqnum: seqnum });
+
+ } else {
+ if (delegate['dataobject'] != null) {
+ if ( delegate.dataobject instanceof LzDataset ) {
+ var element = LzDataElement.valueToElement(data);
+ // the child nodes of element will be placed in datasets childNodes
+ delegate.dataobject.setData( element.childNodes );
+ } else if ( delegate.dataobject instanceof LzDataElement ) {
+ var element = LzDataElement.valueToElement(data);
+ // xpath: element/value
+ delegate.dataobject.appendChild( element );
+ } else {
+ Debug.warn('dataobject is not LzDataset or LzDataElement:',
+ delegate.dataobject);
+ }
+ }
+
+ delegate.execute({ status: 'ok', message: 'ok', data: data, opinfo: opinfo,
+ seqnum: seqnum });
+ }
+
+}
+
+
//------------------------------------------------------------------------------
// Prototype an object based on namespace and classname. If prototype doesn't
// exist, we leave the object alone. There's code in the server code under
@@ -355,7 +448,7 @@
}
*/
-// _root.Debug.write('xxx', obj.__proto__, ',', obj);
+// Debug.write('xxx', obj.__proto__, ',', obj);
return obj;
}
@@ -371,10 +464,24 @@
}
// global SOAP service
-LzSOAPService = new LzSOAP();
+var LzSOAPService:LzSOAP = new LzSOAP();
+/*
+ * DataRequest which encodes a SOAP request, to be passed to the DataProvider
+ */
+class LzSOAPDataRequest extends LzRPCDataRequest {
+ function LzSOAPDataRequest (requestor = null) {
+ super(requestor);
+ this.protocol = LzRPC.SOAP_PROTOCOL;
+ }
+ // soap fields
+ // TODO hqm 2008-10 do we need any soap-specific stuff here
+ // or is everything we need already in LzRPCDataRequest
+}
+
+
]]>
</script>
</library>
Modified: openlaszlo/trunk/lps/components/rpc/rpc.lzx
===================================================================
--- openlaszlo/trunk/lps/components/rpc/rpc.lzx 2008-10-06 21:04:07 UTC (rev 11362)
+++ openlaszlo/trunk/lps/components/rpc/rpc.lzx 2008-10-06 21:05:13 UTC (rev 11363)
@@ -94,7 +94,7 @@
<![CDATA[
if (o.status == "error") {
if (this.onerror != LzDeclaredEvent) {
- this.onerror.sendEvent(o.message, o['error']);
+ this.onerror.sendEvent(o.message + ' ' + o['error']);
} else {
Debug.error(this.name, "load error:", o.message);
}
Modified: openlaszlo/trunk/lps/components/rpc/soap.lzx
===================================================================
--- openlaszlo/trunk/lps/components/rpc/soap.lzx 2008-10-06 21:04:07 UTC (rev 11362)
+++ openlaszlo/trunk/lps/components/rpc/soap.lzx 2008-10-06 21:05:13 UTC (rev 11363)
@@ -80,6 +80,40 @@
}
return ok;
</method>
+
+
+
+ <method name="makeProxyStubFunction" args="fn">
+ <![CDATA[
+ var stubinfo = this.proxyinfo[fn];
+ //"Multiply": function ()
+ //{var args = arguments.callee.args;
+ // return LzSOAPService.invoke(arguments[1],
+ // arguments[0],
+ // args.superclass.requestheaders,
+ // {"parts": [["tns:Multiply",
+ // null]],
+ // "opstyle": "document",
+ // "operation": "Multiply",
+ // "port": "MathServiceSoap",
+ // "service": "MathService",
+ // "wsdl": "http://www.dotnetjunkies.com/quickstart/aspplus......./mathservice.asmx?WSDL"},
+ // args.superclass.secure,
+ var stubfunc = function (){
+ var args = arguments.callee.args;
+ return LzSOAPService.invoke(
+ arguments[1],
+ arguments[0],
+ args.superclass.requestheaders,
+ stubinfo, false, null);
+ }
+
+ return stubfunc;
+ ]]>
+ </method>
+
+
+
<doc>
<tag name="shortdesc"><text>SOAP (Simple Object Access Prototcol)</text></tag>
<text>
Modified: openlaszlo/trunk/test/rpc/soap/dotnet-math.lzx
===================================================================
--- openlaszlo/trunk/test/rpc/soap/dotnet-math.lzx 2008-10-06 21:04:07 UTC (rev 11362)
+++ openlaszlo/trunk/test/rpc/soap/dotnet-math.lzx 2008-10-06 21:05:13 UTC (rev 11363)
@@ -1,6 +1,6 @@
<canvas debug="true">
- <debug y="100" x="140" />
+ <debug y="100" x="140" oninit="Debug.printLength = 1000000" persist="true"/>
<text><b>Test .NET QuickStart MathService using LZX Web Services</b></text>
<checkbox id="usescriptapi">Use script API</checkbox>
Modified: openlaszlo/trunk/test/rpc/soap/temperature.lzx
===================================================================
--- openlaszlo/trunk/test/rpc/soap/temperature.lzx 2008-10-06 21:04:07 UTC (rev 11362)
+++ openlaszlo/trunk/test/rpc/soap/temperature.lzx 2008-10-06 21:05:13 UTC (rev 11363)
@@ -1,6 +1,6 @@
-<canvas debug="true" height="800" width="1200">
+<canvas debug="true" height="800" width="100%">
- <debug x="0" width="1200" height="370" y="80" fontsize="20"/>
+ <debug persist="true" x="0" width="1200" height="370" y="80" />
<soap name="temperature"
wsdl="http://developerdays.com/cgi-bin/tempconverter.exe/wsdl/ITempConverter">
More information about the Laszlo-checkins
mailing list