Hi Travis,

It looks like you put your code in the filesystem, but your XDBC server
config is pointing towards the database "Documents".  I would first try
changing the XDBC Server setting for modules to point to "file system"
and then run your sample again.  

-Danny

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Travis
Spencer
Sent: Friday, May 30, 2008 10:00 AM
To: General Mark Logic Developer Discussion
Subject: [MarkLogic Dev General] ModuleInvoke and URI of XQuery files

Good Morning All,

I am trying to use the .NET XCC interface to invoke an XQuery module
in MLS.  To this end, I have created an XDBC server in the admin UI.
On the settings page for this server, I've entered the following
information:

xdbc server name: XDBCServer
library: XDBCLib
port 8085
modules: Documents
database: Documents
etc.

Then, I created a directory called XDBCLib under C:\Program
Files\MarkLogic.  In this location, I created a script called foo.xqy
which contains the following code:

define variable $message as xs:string external
data($message)

In my .NET application, I have the following code:

static string InvokeTest(StringBuilder xmlBuffer)
{
   var contentSource =
ContentSourceFactory.NewContentSource("192.168.1.43", 8085, "foo",
"bar");
   var session = contentSource.NewSession();
   var moduleUri = "foo.xqy"; // I've also tried "/XDBCLib/foo.xqy"
which didn't work either.
   var queryRequest = session.NewModuleInvoke(moduleUri);

   queryRequest.SetNewStringVariable("message", xmlBuffer.ToString());

   var results = session.SubmitRequest(queryRequest);

   session.Close();

   return results.AsString();
}

However, this code throws the following error when SubmitRequest is
called:

Marklogic.Xcc.Exceptions.XQueryException was unhandled
 Message="Server unable to build program from non-text document"
 Source="MarklogicXcc"
 Code="XDMP-TEXTNODE"
 FormatString="XDMP-TEXTNODE: XDBCLib/XDBCLib/foo.xqy -- Server
unable to build program from non-text document"
 Retryable=false
 StackTrace:
      at Marklogic.Xcc.Impl.SessionImpl.SubmitRequest(Request request)
      at Program.InvokeTest(StringBuilder xmlBuffer) in
C:\MLSTest\Program.cs:line 45
      at Program.Main(String[] args) in C:\MLSTest\Program.cs:line 20
      at System.AppDomain._nExecuteAssembly(Assembly assembly, String[]
args)
      at System.AppDomain.ExecuteAssembly(String assemblyFile,
Evidence assemblySecurity, String[] args)
      at
Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
      at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
      at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
      at System.Threading.ThreadHelper.ThreadStart()
 InnerException:

If anyone has any ideas on why this might be, I would appreciate the
help.

--

Regards,

Travis Spencer
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to