Bodo,

I assume you are submitting a SEND MESSAGE request to the STAX service to 
do this?  Note that it is easier to submit STAF requests using C++ instead 
of C (if that's an option for you). 

Here's a C++ example that shows how you can create a STAF handle and then 
use it to submit STAF service requests like a STAX SEND MESSAGE request 
(without using the STAFHandle::formatString() method).

    STAFHandlePtr handle;
    unsigned int rc  = STAFHandle::create("MyApplication", handle);
 
    if (rc != 0)
    {
        cout << "Error registering with STAF, RC: " << rc << endl;
        return 1;
    }

    STAFString message = "Here is my message";
    unsigned int jobID = 1;  // Set to whatever your STAX job id is

    STAFString request = STAFString("SEND JOB ") + jobID +
        STAFString(" MESSAGE ") + STAFUtil::wrapData(message);
 
    STAFResultPtr result = handle->submit("local", "STAX", request);
 
    cout << "STAF local STAX " << request
         << ", RC: " << result->rc
         << ", Result: " << result->result << endl;


Or, if you prefer to use the STAFHandle::formatString() method, here's a 
C++ example that shows how you can do the same thing using it to create a 
STAX SEND MESSAGE request:

    STAFHandlePtr handle;
    unsigned int rc  = STAFHandle::create("MyApplication", handle);
 
    if (rc != 0)
    {
        cout << "Error registering with STAF, RC: " << rc << endl;
        return 1;
    }

    STAFString message = "Here is my message";
    unsigned int jobID = 1;  // Set to whatever your STAX job id is

    STAFString sendRequest("SEND JOB %d MESSAGE %C);

    STAFString request = STAFHandle::formatString(
        sendRequest.getImpl(), jobID, message.getImpl());

    STAFResultPtr result = handle->submit("local", "STAX", request);
 
    cout << "STAF local STAX " << request
         << ", RC: " << result->rc
         << ", Result: " << result->result << endl;


Note that if you download the STAF source code (how to do this is talked 
about in the STAF Developer's Guide that I gave you a link to previously), 
you can search for examples of how STAF calls the various APIs. 

--------------------------------------------------------------
Sharon Lucas
IBM Austin,   luc...@us.ibm.com
(512) 286-7313 or Tieline 363-7313




Strösser, Bodo <bodo.stroes...@ts.fujitsu.com> 
07/09/2009 10:43 AM

To
"'staf-users@lists.sourceforge.net'" <staf-users@lists.sourceforge.net>
cc

Subject
[staf-users] Sending a message to STAXMon from C-Code






Hi,
 
I'm using STAFSubmit() to send messages from a process written in C to 
STAXMon.
As the messages to send may contain any characters, I am searching for a 
method
to prepare the request string so that any characters in the message are 
acceptable.
I guess, I should use STAFUtilFormatString, but unfortunately I do not 
understand the
API well. Is there any example available?
 
Thankx in advance
Bodo
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge 
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full 
prize 
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to