IWMSPublishingPoints::ImportXML
Previous | Next |
IWMSPublishingPoints::ImportXML
The ImportXML method creates a new publishing point using the configuration data specified in an XML file.
Syntax
HRESULT ImportXML( BSTR bstrNewPubPtName, BSTR bstrXMLFileName, IWMSPublishingPoint** ppNewPubPt );
Parameters
bstrNewPubPtName
[in] BSTR containing the name of the publishing point to be created. The maximum length is 250 characters.
bstrXMLFileName
[in] BSTR containing the name of the object to write the XML data to. This can be a file, console, communication resource, or a named pipe.
ppNewPubPt
[out] Pointer to a pointer to the new publishing point object created.
Return Values
If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code.
Return code | Number | Description |
E_POINTER | 0x80004003 | Indicates that ppNewPubPt is a NULL pointer argument. |
NS_E_DUPLICATE_NAME | 0xC00D0036L | Indicates that bstrNewPubPtName is already being used by another publishing point. |
NS_E_INVALID_PUBLISHING_POINT_NAME | 0xC00D1455L | Indicates that bstrNewPubPtName contains an invalid character. Invalid characters are: & " ' < > \ and the ANSI characters 0-31 and 127. |
NS_E_NAMESPACE_NAME_TOO_LONG | 0xC00D1392L | Indicates that bstrNewPubPtName is longer than the maximum length allowed. |
Remarks
The ExportXML method, contained in the IWMSOnDemandPublishingPoint and IWMSBroadcastPublishingPoint interfaces, is used to create this file for both an on-demand publishing point and a broadcast publishing point.
The name of the publishing point must be unique. You can indicate the home publishing point by specifying only the forward slash character (/). There can be only one home publishing point, and it can be either a broadcast or on-demand publishing point. A home publishing point is not mandatory, but it enables clients to connect using the shorter URL formats such as protocol://server_name
and protocol://server_name/file_name
.
Any other publishing point names must not contain a leading or trailing /, but a / character is permitted in the middle of a name. The following characters are not permitted:
< > \ ? % & ' # { } | ^ [ ] ` *
White spaces are permitted in the name, but the server will strip leading and trailing white spaces.
This method calls AddRef internally. To avoid memory leaks, you must call Release when you are finished using the interface.
Because the ImportXML method uses the Windows CreateFile function, all restrictions that apply when setting the name for that function apply to the ImportXML method.
- Note When a file name without a path is specified for the bstrXMLFileName ** parameter, the server will try to access the file located in the %systemroot%\system32 directory.
Example Code
#include <windows.h> #include <atlbase.h> // Includes CComBSTR. #include "wmsserver.h" // Declare variables and interfaces. IWMSServer *pServer; IWMSPublishingPoints *pPubPoints; IWMSPublishingPoint *pNewPubPoint; HRESULT hr; CComBSTR bstrName; CComBSTR bstrPath; // Initialize the COM library and retrieve a pointer // to an IWMSServer interface. hr = CoInitialize(NULL); hr = CoCreateInstance(CLSID_WMSServer, NULL, CLSCTX_ALL, IID_IWMSServer, (void **)&pServer); if (FAILED(hr)) goto EXIT; // Retrieve a pointer to the IWMSPublishingPoints interface. hr = pServer->get_PublishingPoints(&pPubPoints); if (FAILED(hr)) goto EXIT; // Create a new publishing point from an // exported XML file. bstrName = "New Pub Point Name"; bstrPath = "c:\\wmpub\\wmroot\\pubpoint.xml"; hr = pPubPoints->ImportXML(bstrName, bstrPath, &pNewPubPoint); if (FAILED(hr)) goto EXIT; EXIT: // TODO: Release temporary COM objects and uninitialize COM.
Requirements
Header: wmsserver.h.
Library: WMSServerTypeLib.dll.
Platform: Windows Server 2003 family, Windows Server 2008 family.
See Also
Previous | Next |