Monday, November 08, 2010 at 12:02 AM.

system.verbs.builtins.Frontier.protocols.soap

on soap (rpcServer, procedureName, paramRecord) {
	<<Changes
		<<2/6/02; 4:48:41 PM by JES
			<<Created.
	local (urlList = string.urlSplit (rpcServer));
	local (server = urlList [2], port = 80, path = urlList [3]);
	local (username = "", password = "");
	local (methodNamespace = nil, methodNamespaceUri = nil);
	if server contains "@" { //parse out username and password
		local (userAndPass = string.nthField (server, "@", 1));
		server = string.nthField (server, "@", 2);
		if userAndPass contains ":" {
			username = string.nthField (userAndPass, ":", 1);
			password = string.nthField (userAndPass, ":", 2)}
		else {
			username = userAndPass}};
	if server contains ":" { //get the port
		port = string.nthField (server, ':', string.countFields (server, ':'));
		server = string.popSuffix (server, ':')};
	if path contains "?" { //get the method namespace URI from the path-args
		local (t); new (tableType, @t);
		local (args = string.nthField (path, "?", 2));
		path = string.nthField (path, "?", 1);
		webserver.parseArgs (args, @t);
		if defined (t.ns) {
			methodNamespace = "m";
			methodNamespaceUri = t.ns}};
	
	local (soapAction = string.popSuffix (procedureName, "."));
	procedureName = string.delete (procedureName, 1, sizeOf (soapAction) + 1);
	if sizeOf (procedureName) == 0 { //SOAPAction is the empty string, and method is after the first dot
		procedureName = soapAction;
		soapAction = ""};
	if not (soapAction contains ":") { //no protocol specified -- convert dots to slashes
		soapAction = string.replaceAll (soapAction, ".", "/")};
	
	return (soap.rpc.client (path, procedureName, @paramRecord, server, port, username, password, soapAction:soapAction, methodNamespace:methodNamespace, methodNamespaceUri:methodNamespaceUri))} //, fldebug:true))



This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.