Your application can use the Microsoft System Center Configuration Manager 2007 management point interface messages to communicate with a Configuration Manager 2007 management point for:
- Registering clients.
- Sending data discovery records.
- Requesting policy assignments.
- Sending status messages.
This topic provides simple instructions for using the management point interface to send messages using .NET Framework.
Creating a .NET Framework Wrapper for the COM Binary
You can use the Type Library Importer tool (Tlbimp.exe) to import COM types into native .NET Framework types without having to make PInvoke calls in your application.
- To get the type libraries, install the Configuration Manager
2007 SDK.
- Open a command window and navigate to the folder where
Smsmsgapi.tlb is located, usually
<SDKFOLDER>\Samples\Management Point API.
- At the command prompt, run Tlbimp.exe using the following
command:
tlbimp smsmsgapi.tlb /out:SmsMsgApiNet.dll.
- Ensure that the file SmsMsgApiNet.dll is created in the folder
containing the Smsmsgapi.tlb file.
Correcting Type Library Importer Tool for Pointers
Currently, the Type Library Importer tool (Tlbimp.exe) converts pointers to arrays as single items by reference. To adjust for this situation, you must disassemble SmsMsgApiNet.dll and reassemble the binary with the correct data type.
- At the command prompt, run the following command to decompile
the binary:
ildasm SmsMsgApiNet.dll /out=SmsMsgApiNet.il
- Using Visual Studio or equivalent, open the SmsMsgApiNet.il
file and look for the following code:
Copy Code method public hidebysig newslot abstract virtual instance void SetClientCertificate( [in] valuetype SmsMsgApiNet.MPAPI_CERT_STORE_LOCATION StoreLocation, [in] string marshal( lpwstr) szStoreName, [in] uint8& pCertHashBlob) runtime managed internalcall
- The uint8& data type for the pCertHashBlob
parameter is incorrect for an array. Change the data type to
uint8*, and save and close the file.
Note The uint8& data type is used incorrectly in other places in the file, but these instructions focus on the critical instance for simplicity. For your application, it might be necessary to replace other instances of the data type. - At the command prompt, run the following command to recompile
the decompiled and modified binary into a DLL with the corrected
parameter(s):
ilasm SmsMsgApiNet.il /DLL /OUTPUT=SmsMsgApiNet.dll
Preparing the Project
To use the objects, you must create a Visual Studio project.
- Use Visual Studio to add the SmsMsgApiNet.dll binary as a
reference in the project.
- You now need to register the COM binary with Windows so that
the operating system can create the management point interface. To
do this, navigate to the folder containing SmsMsgApi.dll and run
the following command:
regsvr32 SmsMsgApi.dll
Creating the First Message
With the COM binary references using the custom wrapper in Visual Studio or equivalent, you can create a simple message to send to the management point. Because the SDK uses COM to handle memory, your application must use the ISmsMessaging::CreateMessage Method to create the message object so that it can pass over memory boundaries. The following is a code example:
Copy Code | |
---|---|
SmsMessagingClass messaging = new SmsMessagingClass(); ISmsMessage4 message, reply; smsMessaging.CreateMessage(out message); message.SetTargetEndpoint("MyDummyEndpoint"); message.SetPort(80); message.SetBodyFromString("MyMessageBody"); // Send the message using HTTP messaging.Invoke("http://myHostname", message, out reply); // Do something with the reply here... |
See Also
Reference
ISmsMessaging::CreateMessage MethodOther Resources
Configuration Manager Management Point Interface MessagesSend comments about this topic to Microsoft.