How can I convert MQ API exception text to more descriptive text in my java app?
sample exception message >"MQJE001: Completion Code '2', Reason '2038'"
To > "An MQINQ call was issued to inquire object attributes, but the object had not been opened for inquire."
I have access to completion and reason code but not description.
Thanks
Go have a look at my open source projects: MQRC2 and MQRC2-GUI. http://www.capitalware.biz/mqrc2_overview.html
MQRC2 is a command-line program and MQRC2-GUI is a Java/Swing program.
Related
Iam using Websphere MQ V8.
I need to get the filename from the header in incoming message file. Is there any properties or default methods available to get it.
Sample File:
The file ame you show in the non-hex dump of your message was put there by the sending application. You should ask the sending application how it was put in there, so that you can know how to pull it out.
Alternatively, show the hex version of your message as well and we might be able to help you further. All the important stuff is not visible to us in your screen shot.
That looks like an RFH version 1 header (not RFH2) but as Morag said, we need to see a hex dump of the message. There are lots of tools to see the hex dump of the message. i.e. amqsbcg, MO71, MQ Visual Edit, etc...
From the manual:
The RFH header guidelines only allow for a single header to exist in a message. The fixed binary set of properties is followed by a variable set of name/value pairs.
strucid
version
struclength
encoding
codedcharsetid
format
flags
namevaluestring
The filename is in the "namevaluestring" section and as Morag said, you need to have a discussion with the sending application to understand the format they used.
Finally, if this is a new sending application being developed then tell the developer to NOT use RFH version 1 but rather message properties.
I've written a custom workflow activity against CRM 2013. You don't need to understand what it does. The problem I have is that despite instantiating the ITracingService, any tracing content that I generate using the Trace(...) method is obfuscated at runtime for real-time workflows only. In other words, if I run my workflow asynchronously and (deliberately) throw an Exception, I get to see the trace log in the corresponding system job record. If I simply switch the workflow to be "real-time" (synchronous) then I still get an exception and I still get any custom exception text, but of course there is no corresponding systemjob generated for realtime workflows so, like a plug-in, I am seeking my Trace output in the downloadable log file that is presented when an exception occurs. In this case, my Traces are not visible but I get what appears to be Microsoft's trace log from (perhaps) the parent context that hosts the workflow - you can see that it is referencing the steps in my workflow process definition:
[Microsoft.Crm.ObjectModel: Microsoft.Crm.Extensibility.InternalOperationPlugin]
[46f6cf4c-14ae-4f1e-98a1-eae99a37e95c: ExecuteWorkflow]
Starting sync workflow 'MyTestWorkflow', Id: ca8782b1-7ca4-e311-a055-6c3be5be5f78
Entering CreateStep1_step:
Entering CustomActivityStep2_step:
Sync workflow '__Test' terminated with error 'Unexpected exception from plug-in (Execute): My.Test.WF.DoSomething: System.NullReferenceException: Object reference not set to an instance of an object.'
In my assembly My.Test.WF.DoSomething I access the Tracing Service at invocation and immediately start writing via the Trace() method, e.g.
_trace.Trace("Starting Greg's custom code...");
This is only an example, but the point is, my tracing works when asynchronous but is "lost" when synchronous.
Any ideas?
The process sessions section on the corresponding workflow designer form contains the full exception message.
The problem is that the full exception message does not contains the trace created through the ITracingService Trace method, just contains the exception that's been thrown by the platform, no user traces are included in the comments tab of the process section.
I think the best approach for development purpose is to use a StringBuilder instead of ITracingService and throw the exception using StringBuider.toString() as the message.
As for production release, perhaps the best approach is to use a custom entity to trace the errors in runtime, or not use custom workflows activities on synchronous workflows at all.
Cheers.
I'm writing an application where I have to send an email with an attachment using the default mail application.
Before the email is sent, I want the user to be able to edit the text, i.e. the application should just open the mail client with pre-filled recipient and attachment and give the user the opportunity to send it.
At very minimum I need the same effect I'd got if I selected "SendTo/Mail Recipient" from the context menu of the file.
Solutions based on the "mailto:" trick won't work as there are mail clients that do not support the "attachment=" part.
The most complete solution I've found is this one:
http://www.codeproject.com/Articles/3839/SendTo-mail-recipient
but it seems a lot of code for something so simple! (and also crashes when compiled with VS2008)
Is there any other option? It would be ok even if it was an external tool or script (e.g. a .vbs script to be launched with cscript).
I would advise you to use MAPI (Messaging Application Program Interface).
If dotNet can be part of the solution, here's a ready-to-use class in C# : Class for creating MAPI Mail Messages. It would give you something like this:
MapiMailMessage message = new MapiMailMessage("Test Message", "Test Body");
message.Recipients.Add("Test#Test.com");
message.Files.Add(#"C:\del.txt");
message.ShowDialog();
Otherwise, you can always do it in C++ if you feel confortable with it, like this answer suggest.
Then, you will be able to ShellExecute the binary executable and pass it some parameters.
Hope this helps :-)
What is the best way to convert the developer-oriented validation error list you receive from calling validate() on a Grails domain object into user-oriented error messages?
Example:
Property [email] of class [class testproj.AuthUser] with value [x] is not a valid e-mail address
would rather have it read:
Email given is not a valid e-mail address
Is there anything built-in that already does this?
the messages.properties files in grails-app/i18n
check out this documentation
http://grails.org/doc/latest/guide/7.%20Validation.html
To get all the error codes, look here http://grails.org/doc/latest/ref/Constraints/email.html. Enable the quick nav on the right. At the bottom of every constraint is the properties key that you use to change the error message.
There is also a nice plugin called:
grails install-plugin i18n-templates
which can be found here http://www.grails.org/plugin/i18n-templates
e.g. you have a Domain class in 'org.example.User' and you want to specify the localization messages. Use the following command:
grails generate-i18n-messages org.example.User
This will generate a list of possible messages for you in the console.
Copy and paste this output into your messages.properties for the English language and in every other message.properties for the language you want to have localizations.
Then you just have to edit these property-files in order to have your page localized.
Eclipse/STS has a nice GUI, which makes localization of these property-files even faster.
Greetings,
Jan
How can I programatically open a new message window in the default email client (such as Outlook) using Windows API calls? I will need to include an attachment and would prefer to specify the default message body in 'rich text' (ie. not plain) format.
The ShellExecute solution is good for simple messages without attachments, but if you want more control over the process, you may try the MAPI; in particular, see the MAPISendMail function and the MapiMessage structure.
For even more complex needs, there's the extended MAPI, but I didn't find any documentation about it on the MSDN. However this seems to be a good wrapper around the extended MAPI.
I think you can do this using the ShellExecute. An attachment should be used as parameter: something like this but I don't remember for sure: "mailto:email#something?subject=subject&body=body&attachment=..."