Hot to read messages from a CAdxResultXml object - web-services

I tried to import a WSDL file of SAGE X3 in Visual Studio to read and modify articles in SAGE.
I use "modify" and "read" functions of CAdxResultXml object; it works fine if the process success.
If the process fails (es an article is blocked from another user) the CAdxResultXml object is null and I can't read any message about it.
How can I retrieve error messages?
Thanks in advance for your advice

Related

Logging events with C++ in Event Viewer with TEventLogger

I want to make a log with errors during the execution of my app. I'm trying to write an event to the windows Event Viewer with a VCL form application with C++ Builder XE5.
I'm using Vcl.SvcMgr.TEventLogger class.
The code in the header file is :
TEventLogger *Event;
The code in the cpp file is :
Event=new TEventLogger("MySource");
Event->LogMessage("MyMessage");
But beside my message, in the error description in the Event Viewer there is a message : "The description for Event ID 0 from source MySource cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted." . How can I remove that description and write only the message that I want? Should I be using other C++ class? I couldn't find any documentation about this class. The idea of using Event Viewer is that when the application is running on an user with restricted rights he won't be able to write to files, meaning I can't just type into a ".txt" file. If anyone else has a different idea how to make a log with errors, please share! :)
Thanks in advance,
Zdravko
This message normally shows up if there is no message files set up within your application. In contrast to Unix syslog and similar logging packages, the Windows event log normally combines messages from the message file and the text you want to log and if there is no message file set up and registered, the event view complains about it.

System stop responding and throws yami i/o error

I need suggestion about YAMI library . I have a system which receives Json string from external interface and parse that received string and send that message to internal ip address for the required action.
The exchange of messages within the internal ip address has been taken care by Yami library. everything works fine but occasionally it displays yam i/o error and system doesn't response unless it is restarted.
The whole software is written in C++ and C and development os is fedora 11.
I have tried to investigate the problem but I am bit clueless as I have not found much help on internet and my testing method doesn't work.
its strange that system works for few hours and then crash . For example If I leave system idle for half an hour and then try to send message via external interface it crashes producing yami i/o error or even while sending continuos command it crashes.
Any help or suggestion will be of great help.
Thanks and regards,
Sam
It looks like this exception is from a core::io_error result which is translated to a runtime exception by details::translate_result_to_exception(). Most of this error originates from the source code in yami/posix in your case.
What you have to do now is figure out where the error originates and ultimately the source of the issue. You should be able to get a rough idea from what happens in your code when the error occurs (are you creating a new connection, sending data, receiving data, etc...).
If that doesn't yield any obvious results I would probably create a test project using the yami source code instead of the library file so I would be able to trace into the yami code to where the error originates from.

How to open source file in specific instance of Visual Studio (2008)

I have several instances of Visual Studio 2008 opened and I want to open a source file in a specific instance.
I plan to do this with Win32 API and something like ShellExecute(...), but I can't find solution yet.
Is there any way to do so? Any thoughts?
Unless the application opening the file (VS2008) has a message handler set up to initiate opening a file (not sure if it does or not; this would be the easiest method), you could probably simulate a drag-and-drop of the file to the application's client area (via message sending directly to the client window's message handler). You would need to get a handle to the client window of VS2008 for the instance you are sending the message to.
Don't know what the purpose would be, though. You can generally call up a new instance to open the file using ShellExecute(), but that wouldn't refer to a specific instance that is already running.
Another method you might consider is to hook VS2008's message handler for the main window, and log all messages sent relating to menu commands. You might be able to determine if there is a message event associated with opening a file. Figuring out the parameters sent to the WndProc() function would be another story. Hopefully it would be sent as a string pointer (for the filename) to lParam.
You could try using AutoHotKey. It's got a built-in scripting language and has various alternative ways of identifying which application to send its messages to.

Is a separate message file library for my native Win32 service necessary?

We've got an old legacy win32 service, developed with C++, and we've just recently noticed that when the service starts up and stops, there is an informational message in the event logs about our missing event descriptions. To be more precise, the message looks like this:
The description for Event ID 0 from source [application] cannot be
found. Either the component that raises this event is not installed on
your local computer or the installation is corrupted. You can install
or repair the component on the local computer.
So we understand what this means, basically we're missing a library which has a message table compiled into it. This way when the event ID for changing status (start/stop) arrives, it can look up the message and print it in the event logs.
The question is, for these universal messages (changing status etc) which pretty much every service is going to have, surely there are default message table that we can use, rather than having to go to the trouble of creating another project, just for this, adding registries and updating our installer.
Seems like a lot of hassle for something that should surely be a default somewhere? Like the standard win32 error messages?
I've created a number of managed services in the past, and I'm pretty sure we didn't need to do anything like this before!
So to wrap this up, I guess the answer is that the a new message table/file is always required, regardless (so no there are no default messages you can use), so I'll just have to chuck in a message table into my services resource file and add a registry entry to the installer.
Still find it baffling thought that every native service has it's own 'service has stopped/started' message...!
Thanks!

How do you configure the email settings in CrashRpt to send the crash dump?

After reading this discussion and this discussion about using CrashRpt to generate a crash dump and email it to the developers, I've been having a difficult time finding any instructions/tutorials for configuring the email settings used by the library to send the email.
When you call the install() function to initialize CrashRpt, you specify the email address you want the crash dump sent to, but how does the CrashPrt library know how to send the email to that address? Wouldn't the library have to know the email client settings for each individual user?
When a fatal crash occurs in my code, the CrashRpt dialog box pops up and when I enter my email address and click the send button, it takes me to a "Save File" dialog box where I can save the zipped package and the account specified in the Install() function never receives an email.
Thanks in advance for any and all help! I'm clearly missing something.
What CrashRpt does for emailing:
The email system simply uses MAPI to send your email. Which would try to use your default mail client if you have one, and if it supports MAPI. Take a look at MailMsg.cpp for details.
Personal experience:
In my company's usage of CrashRpt, we modified it a bit though to call a web service that we created which submits the crash report. So we gutted the emailing code completely from CrashRpt. And instead we have in our bug tracking system a section for crashes that were auto submitted when crashes happen.
To find your problem:
I would maybe try to debug the CrashRpt code to see why it's giving you a save dialog. It should instead just open your default mail client. Maybe you have an older version of the library, or maybe the dialog resources are a little messed. Debugging the code will tell you this though.
Most likely MailReport is being called but is failing.
Set a breakpoint in the original CrashRpt code's CrashHandler.cpp at just after the DoModal:
mainDlg.m_pUDFiles = &m_files;
if (IDOK == mainDlg.DoModal())
{
//Put breakpoint here <---------
if (m_sTo.IsEmpty() ||
!MailReport(rpt, sTempFileName, mainDlg.m_sEmail, mainDlg.m_sDescription))
{
SaveReport(rpt, sTempFileName);
}
}
Check to see why MailReport is not getting called. It's either the dialog resource, or your m_sTo is not filled or you can step through MailMsg.cpp and see where MAPI is failing.
Alternate solution:
An easy fix, if you find above that MailReport is being called, but not succeeding, is to instead just do a ShellExecute and specify a mailto:
You could even try to use the MAPI method, but if that fails to do a mailto:
You can find the CrashRpt documentation, FAQ and download a new CrashRpt v1.1 here http://code.google.com/p/crashrpt/