Community
Vault Customization
Share your knowledge, ask questions, and explore popular Vault API, Data Standard, and VBA topics related to programming, creating add-ins, or working with the Vault API.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

job processor context.connection is invalid

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
jon-p
2725 Views, 3 Replies

job processor context.connection is invalid

Hello.  I'm trying to understand the nuances of custom jobs for the job processor and i've hit a snag.  Basically, when i try to reference the context.connection, I'm getting the following:

CreatePDF started...;Error=311;Type=System.Web.Services.Protocols.SoapException;Stack=   at Connectivity.JobHandlers.Services.Utils.JobHelper.LoginToVault(String username, String password, String vaultname, String server, Boolean winAuth)
   at Connectivity.JobHandlers.Services.Objects.ServiceJobProcessorServices.get_Connection()
   at Walmart.StoreLayout.VaultJobs.TestJobHandler.Execute(IJobProcessorServices context, IJob job) in d:\jpark18\Visual Studio 2012\Projects\wmtuscad\CadUtilities\VaultUploader\StoreLayoutTestJob\TestJob.cs:line 42

 

The code looks like this:

	public class TestJobHandler : ACJE.IJobHandler
	{
		public string WorkingFolder { getset; }
 
		public TestJobHandler()
		{
			WorkingFolder = "C:\\temp\\vault\\jobprocessor";
		}
 
		public bool CanProcess(string jobType)
		{
			if (jobType.ToLower() == "walmart.storelayout.createpdf")
				return true;
 
			return false;
		}
 
		public ACJE.JobOutcome Execute(ACJE.IJobProcessorServices context, ACJE.IJob job)
		{
			context.Log("CreatePDF started...", ACJE.MessageType.eInformation);
 
			try
			{
				long fileMasterId = Convert.ToInt64(job.Params["FileId"]);
 
				// Retrieve the file object from the server
				//
	Code fails here -->	Debug.WriteLine("connected={0};iswindows={1};user={2}", context.Connection.IsConnected,
					context.Connection.IsWindowsAuthenticatedConnection, context.Connection.UserName);
 
				ACW.File file = context.Connection.WebServiceManager.DocumentService.GetLatestFileByMasterId(fileMasterId);
				VDF.Vault.Currency.Entities.FileIteration fileIter =
					 context.Connection.FileManager.GetFilesByIterationIds(new long[] { file.Id }).First().Value;
 
				// Download and publish the file
				//
				Publish(fileIter, context.Connection);
 
				return ACJE.JobOutcome.Success;
			}
			catch (Exception e)
			{
				context.Log("Error={0}".FMe(e.Message), ACJE.MessageType.eError);
				context.Log("Type={0}".FMe(e.GetType().FullName), ACJE.MessageType.eError);
				context.Log("Stack={0}".FMe(e.StackTrace), ACJE.MessageType.eError);
				
				return ACJE.JobOutcome.Failure;
			}
		}

 

A fiddler trace shows:

HTTP/1.1 500 Internal Server Error
Cache-Control: private
Content-Length: 1839
Content-Type: multipart/related; type="application/xop+xml";start="<http://tempuri.org/0>";boundary="uuid:b6feab63-b9c1-4e08-a8fa-7d7ab552a3d6+id=46";start-info="text/x...
Server: Microsoft-IIS/7.5
MIME-Version: 1.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Mon, 09 Jun 2014 22:25:54 GMT


--uuid:b6feab63-b9c1-4e08-a8fa-7d7ab552a3d6+id=46
Content-ID: <http://tempuri.org/0>
Content-Transfer-Encoding: 8bit
Content-Type: application/xop+xml;charset=utf-8;type="text/xml"

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault><faultcode>s:Server</faultcode><faultstr... xml:lang="en-US">311</faultstring><detail><sl:sldetail xmlns:sl="http://streamline.autodesk.com/faultschema"><sl:errorcode>311</sl:errorcode><sl:mesg-id>635379315551... sl:pid="1">domain\userid</sl:param><sl:param sl:pid="2">ActiveDirectory</sl:param><sl:stack>   at Connectivity.Server.Proxies.ServiceAccessor`3.tryexecute(String remoteServer, Action`1 action, Int32 attemptCount)&#xD;
   at Connectivity.Server.Proxies.ServiceAccessor`3.Execute(String remoteServer, Action`1 action)&#xD;
   at Connectivity.Filestore.AuthenticationService.CreateSession(AuthCredentials creds, String dataServer, String knowledgeVault, Boolean isLicensed, Byte[] p)&#xD;
   at Connectivity.Web.Filestore.v18.AuthService.SignIn(String dataServer, String userName, String userPassword, String knowledgeVault)&#xD;
   at SyncInvokeSignIn(Object , Object[] , Object[] )&#xD;
   at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]&amp; outputs)&#xD;
   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc&amp; rpc)&#xD;
   at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</sl:stack></sl:sldetail></detail></s:Fault></s:Body></s:Envelope>
--uuid:b6feab63-b9c1-4e08-a8fa-7d7ab552a3d6+id=46--

 

Any thoughts or advice would be appreciated.  I've just been referring to the sample code and i don't see any reason for the reference to the connection to blow up.  The domain\userid has rights to log in and it starts up, pulls the job, but when it tries to execute it, it fails.

 

Please advise,

Jon

3 REPLIES 3
Message 2 of 4
n.hall
in reply to: jon-p

Jon

 

Are you running Job Processor as a Windows User ?

 

There were issues with this - as in it didn't work at all - but was fixed in a Service Pack

 

See this for a similar case - http://forums.autodesk.com/t5/Vault-Customization/JobServer-WindowAuthentication/m-p/4771969

 

The only version I am sure about is 2014, where you need to be running SP2 - http://knowledge.autodesk.com/support/vault-products/downloads/caas/downloads/content/autodesk-vault...

 

I'd have thought it would be fixed in 2015 RTM too, but have not tried it

 

Nick

 

 

Message 3 of 4
jon-p
in reply to: n.hall

Well, that looks like fun.  Thanks for the heads up.  I'll make sure i have that installed.  Props for including the download link.

Message 4 of 4
kbo
Advocate
in reply to: jon-p

I had the same issue, here is my code that worked for me.

It downloads a file when the status changes to relased. this is setup with the lifecycleEventEditor.

First of all from what i was reading in the sdk you don't need to login anymore when using the jobprocessor. Second you can't get the file master id passed from a job - but you can get the fileId. as fare as i know.

this code downloads a file without selecting it in the vault explorer.

Public Function Execute(context As ACJE.IJobProcessorServices, job As ACJE.IJob) As ACJE.JobOutcome Implements ACJE.IJobHandler.Execute 'Dim fileMasterId As Long = Convert.ToInt64(job.Params("FileMasterId")) Dim MyfileId As Long = Convert.ToInt64(job.Params("FileId")) Try Dim file As ACW.File = context.Connection.WebServiceManager.DocumentService.GetFileById(MyfileId) 'Dim file As ACW.File = context.Connection.WebServiceManager.DocumentService.GetLatestFileByMasterId(fileMasterId) Dim fileIter As VDF.Vault.Currency.Entities.FileIteration = context.Connection.FileManager.GetFilesByIterationIds(New Long() {file.Id}).First().Value Publish(fileIter, context.Connection) Return ACJE.JobOutcome.Success Catch Return ACJE.JobOutcome.Failure End Try End Function

regards kent boettger

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report