Service Operations

This section describes the methods supported by the Topic Map Web Service.

Delete Associations

Removes one or more associations from the specified topic map. The associations to be deleted are identified by their unique object identifiers.

Method Name

DeleteAssociations

Parameters
topicmap

The name of the topic map to delete the associations from. This parameter is a single string.

oids

The unique object identifiers of the associations to be deleted. This parameter is an array of strings.

Returns

This method returns an XML document conforming to the Web Service Results schema with a root element of type res:results which contains one res:result element for each association OID specified in the request. The key attribute of each res:result element specifies the OID of the association that was deleted.

Note

This structure is returned as long as the topicmap parameter is valid. Any error that occurs on the deletion of an individual association will be reported in the res:result element for that association.

Each res:result element that reports an error may contain a res:error element that uses one of the following codes:

Error CodeCondition
INVALID_OIDThe object identifier provided for the association is not valid or is not an OID of an association contained in the topic map identified by the topicmap parameter.
DELETE_ASSOCIATION_FAILEDOne of the associations specified for deletion could not be removed from the topic map. The error key will specify the OID of the association which could not be deleted. The message and nested action elements will help you identify the cause of the failure.
Errors
Error CodeCondition
INVALID_TOPICMAPThe name provided in the topicmap parameter does not match the name of any topic map known to the server. The client should retry, specifying the correct topic map name.
Examples

Example 9. HTTP Interface Request XML for DeleteAssociations Operation

The following example shows an XML request that can be sent using an HTTP POST to the DeleteAssociations.aspx operation page.

<request>
  <param name="topicmap">mytopicmap</param>
  <param name="oids">1234</param>
  <param name="oids">5678</param>
</request>

Example 10. C# Code Using the Web Services Client Library to Invoke the DeleteAssociations Operation

The following example shows how to delete associations using the Web Services Client library.

TMSClient client = new TMSClient("http://topicmap.mycorp.com/tmws/TMService.asmx");
XmlNode results = client.DeleteAssociations("mytopicmap", new string[] {"1234", "5678"});

Delete Topics

Removes one or more topics from the specified topic map. The topics to be deleted are identified by their unique object identifiers.

Method Name

DeleteTopics

Parameters
topicmap

The name of the topic map to delete topics from.

oidsc

The unique object identifiers of the topics to be deleted. This parameter is an array of strings.

Returns

Returns an XML document conforming to the Web Service Results schema with a root element of type res:results which contains one res:result element for each topic OID specified in the request. The key attribute of each res:result element specifies the OID of the topic to be deleted.

Note

This structure is returned as long as the topicmap parameter is valid. Any error that occurs on the deletion of an individual topic will be reported in the res:result element for that topic.

Each res:result element that reports an error may contain a res:error element that uses one of the following codes:

Error CodeCondition
INVALID_OIDThe object identifier provided for the topic is not valid or is not an OID of a topic contained in the topic map identified by the topicmap parameter.
DELETE_TOPIC_FAILEDOne of the topics specified for deletion could not be removed from the topic map. The error key will specify the OID of the topic which could not be deleted. The message and nested action elements will help you identify the cause of the failure.
TOPIC_IN_USEThe topic could not be deleted because it is referenced from elsewhere in the topic map as a type, a scoping topic or plays a role in one or more associations. The error key specifies the OID of the topic that could not be deleted.
Errors
Error CodeCondition
INVALID_TOPICMAPThe name provided in the topicmap parameter does not match the name of any topic map known to the server. The client should retry, specifying the correct topic map name.
Examples

Example 11. HTTP Interface Request XML for DeleteTopics Operation

The following request XML can be POSTed to the DeleteTopics.aspx page to request the deletion of two topics from the topic map.

<request>
  <param name="topicmap">mytopicmap</param>
  <param name="oids">1234</param>
  <param name="oids">5678</param>
</request>

Example 12. C# Code Using the Web Services Client to Invoke the DeleteTopics Operation

The following code snippet shows how to delete two topics from a topic map using the Web Services Client library:

TMSClient client = new TMSClient("http://topicmap.mycorp.com/tmws/TMService.asmx");
XmlNode results = client.DeleteTopics("mytopicmap", new string[] {"1234", "5678"});

Get Hierarchy

Retrieves an XML document describing a single hierarchy present in the topic map. The hierarchy to be retrieved is identified by the unique object identifier of the topic that defines the hierarchy.

Method Name

GetHierarchy

Parameters
topicmap

The name of the topic map to retrieve the specified hierarchy from.

hierarchydefid

The object identifier of the topic that defines the hierarchy to be retrieved.

Returns

An XML document conforming to the Networked Planet Hierarchy XML Schema.

Errors
Error CodeCondition
INVALID_TOPICMAPThe name provided in the topicmap parameter does not match the name of any topic map known to the server. The client should retry, specifying the correct topic map name.
INVALID_OIDThe value of the hierarchydefid parameter was not a valid object identifier or was not the identifier of a topic contained in the topic map identified by the topicmap parameter.
NOT_A_HIERARCHYThe topic identified by hierarchydefid does not define a hierarchy in the topic map.
Examples

Example 13. HTTP POST Body to Invoke the GetHierarchy Operation

<request>
  <param name="topicmap">mytopicmap</param>
  <param name="hierarchydefid">1234</param>
</request>

Example 14. HTTP GET URL to Invoke the GetHierarchy Operation

http://topicmap.mycorp.com/tmws/GetHierarchy.aspx?topicmap=mytopicmap&hierarchydefid=1234

Example 15. C# Code to Invoke the GetHierarchy Operation using the Web Services Client Library

TMSClient client = new TMSClient("http://topicmap.mycorp.com/tmws/TMService.asmx");

XmlNode hierarchy = client.GetHierarchy("mytopicmap", "1234");

Get Hierarchy Roots

Returns an XML document describing all of the hierarchies present in the topic map. For each hierarchy, the returned document provides the unique object identifier of the topic that defines the hierarchy and the topic that is the root topic of the hierarchy.

Method Name

GetHierarchyRoots

Parameters
topicmap

The name of the topic map to retrieve the hierarchy information from.

Returns

An XML document describing each of the hierarchies contained in the specified topic map. The document conforms to the NetworkedPlanet Hierarchy XML Schema with the tmh:treelist element as its root element.

Errors
Error CodeCondition
INVALID_TOPICMAPThe name provided in the topicmap parameter does not match the name of any topic map known to the server. The client should retry, specifying the correct topic map name.
Examples

Example 16. HTTP POST Body to Invoke the GetHierarchyRoots Operation

<request>
  <param name="topicmap">mytopicmap</param>
</request>

Example 17. HTTP GET URL to Invoke the GetHierarchyRoots Operation

http://topicmap.mycorp.com/tmws/GetHierarchyRoots.aspx?topicmap=mytopicmap

Example 18. C# Code to Invoke the GetHierarchyRoots Operation using the Web Services Client Library

TMSClient client = new TMSClient("http://topicmap.mycorp.com/tmws/TMService.asmx");

XmlNode hierarchyRoots = client.GetHierarchyRoots("mytopicmap");

Get Object By Source Locator

Returns a topic map fragment that includes the topic map object with the specified source locator. If the object is a topic, occurrence, topic name, or variant name then the returned fragment will contain at least a topiclist element containing the topic that contains that object. If the object is an association or association role, then the returned fragment will contain at least an associationlist element that contains the object.

Method Name

GetObjectBySourceLocator

Parameters
topicmap

The name of the topic map to search.

sourcelocator

The source locator URI of the object to be returned.

Returns

An XML document conforming to the NetworkedPlanet Topic Map Fragment XML Schema. The object found by the query will be contained in the topic map fragment. If the object requested was a topic, it will be present as a frag:topic element inside the frag:topiclist element. If the object was an occurrence, topic name or variant name, the entire topic that contains that object will be present as a frag:topic element inside the frag:topiclist element. If the object was an association, it will be present as a frag:association element inside the frag:associationlist element. If the object was an association role, the entire association that contains the object will be present as a frag:association element inside the frag:associationlist element. If the result requires the generation of a frag:topic element, that topic will be fully serialized and any topics that it references will be serialized as stubs.

If no object was found in the topic map with the specified source locator, this method will return an empty frag:topicmap element.

Errors
Error CodeCondition
INVALID_TOPICMAPThe name provided in the topicmap parameter does not match the name of any topic map known to the server. The client should retry, specifying the correct topic map name.
Examples

Example 19. HTTP POST Body to Invoke the GetObjectBySourceLocator Operation

The following example could be used in the body of an HTTP POST request to the GetObjectBySourceLocator.aspx request page.

<request>
  <param name="topicmap">mytopicmap</param>
  <param name="sourcelocator">http://www.example.com/topicmaps/foo.xtm#bar</param>
</request>

Example 20. HTTP GET URL to Invoke the GetObjectBySourceLocator Operation

The following example shows how to invoke the GetObjectBySourceLocator operation using an HTTP GET. Note that the source locator value should be properly escaped within the URL string.

http://topicmap.mycorp.com/tmws/GetObjectBySourceLocator.aspx?topicmap=mytopicmap&sourcelocator=http%3a%2f%2f...

Example 21. C# Code to Invoke the GetObjectBySourceLocator Operation using the Web Services Client Library

TMSClient client = new TMSClient("http://topicmap.mycorp.com/tmws/TMService.asmx");

XmlNode tmFragment = client.GetObjectBySourceLocator("mytopicmap", "http://www.example.com/topicmaps/foo.xtm#bar");

Get Topic

Returns a topic map fragment that includes the specified topic. The topic is identified by its unique object identifier.

Method Name

GetTopic

Parameters
topicmap

The name of the topic map to be searched for the requested topic.

topicid

The OID of the topic to be returned.

Returns

An XML document conforming to the NetworkedPlanet Topic Map Fragment XML Schema. The root element will be the frag:topicmap element. This fragment will contain a frag:topiclist which contains the requested topic fully serialized and any topics that it references serialized as stub topics. If no topic is found with the specified OID in the specified topic map, then this method will return an empty frag:topicmap element.

Errors
Error CodeCondition
INVALID_TOPICMAPThe name provided in the topicmap parameter does not match the name of any topic map known to the server. The client should retry, specifying the correct topic map name.
INVALID_OIDThe value of the topicid parameter could not be parsed as a valid topic object identifier.
Examples

Example 22. HTTP POST Body to Invoke the GetTopic Operation

The following example could be used in the body of an HTTP POST request to the GetTopic.aspx request page.

<request>
  <param name="topicmap">mytopicmap</param>
  <param name="topicid">1234</param>
</request>

Example 23. HTTP GET URL to Invoke the GetTopic Operation

The following example shows how to invoke the GetTopic operation using an HTTP GET.

http://topicmap.mycorp.com/tmws/GetTopic.aspx?topicmap=mytopicmap&topicid=1234

Example 24. C# Code to Invoke the GetObjectBySourceLocator Operation using the Web Services Client Library

TMSClient client = new TMSClient("http://topicmap.mycorp.com/tmws/TMService.asmx");

XmlNode tmFragment = client.GetTopic("mytopicmap", "1234");

Get Topic By Subject Identifier

Returns a topic map fragment that includes the topic with the specified subject identifier.

Method Name

GetTopicBySubjectIdentifier

Parameters
topicmap

The name of the topic map to be searched.

locator

The subject identifier of the topic to be returned.

Returns

An XML document conforming to the NetworkedPlanet Topic Map Fragment XML Schema. This fragment will contain a frag:topiclist which contains the requested topic fully serialized and any topics that it references serialized as stub topics. If no topics have the specified subject identifier, an empty frag:topicmap element will be returned.

Errors
Error CodeCondition
INVALID_TOPICMAPThe name provided in the topicmap parameter does not match the name of any topic map known to the server. The client should retry, specifying the correct topic map name.
Examples

Example 25. HTTP POST Body to Invoke the GetTopicBySubjectIdentifier Operation

The following example could be used in the body of an HTTP POST request to the GetTopicBySubjectIdentifier.aspx request page.

<request>
  <param name="topicmap">mytopicmap</param>
  <param name="locator">http://psi.example.com/companies/MSFT</param>
</request>

Example 26. HTTP GET URL to Invoke the GetTopicBySubjectIdentifier Operation

The following example shows how to invoke the GetTopicBySubjectIdentifier operation using an HTTP GET. Note that the subject identifier value should be properly escaped within the URL string.

http://topicmap.mycorp.com/tmws/GetTopicBySubjectIdentifier?topicmap=mytopicmap&locator=http%3a%2f%2f...

Example 27. C# Code to Invoke the GetTopicBySubjectIdentifier Operation using the Web Services Client Library

TMSClient client = new TMSClient("http://topicmap.mycorp.com/tmws/TMService.asmx");

XmlNode tmFragment = client.GetTopicBySubjectIdentifier("mytopicmap", "http://psi.example.com/companies/MSFT");

Get Topic Maps

Returns an XML document that describes all of the topic maps managed by the TMCore server.

Method Name

GetTopicMaps

Parameters

This method takes no parameters.

Returns

An XML document conforming to the NetworkedPlanet Topic Map Fragment XML Schema. The root element of this document will be the frag:topicmapsystem element.

Errors

There are no operation-specific errors for this operation.

Examples

Example 28. HTTP POST Body to Invoke the GetTopicMaps Operation

The following example could be used in the body of an HTTP POST request to the GetTopicMaps request page.

<request />

Example 29. HTTP GET URL to Invoke the GetTopicMaps Operation

The following example shows how to invoke the GetTopicMaps operation using an HTTP GET.

http://topicmap.mycorp.com/tmws/GetTopicMaps.aspx

Example 30. C# Code to Invoke the GetTopicMaps Operation using the Web Services Client Library

TMSClient client = new TMSClient("http://topicmap.mycorp.com/tmws/TMService.asmx");
XmlNode tmSystem = client.GetTopicMaps();

Get Topics By Name

Returns a topic map fragment that includes every topic with a specified name.

Method Name

GetTopicsByName

Parameters
topicmap

The name of the topic map to be searched.

name

The string to find.

Returns

An XML document conforming to the NetworkedPlanet Topic Map Fragment XML Schema. This fragment will contain a frag:topiclist which contains each of the topics that have at least one name that matches the name parameter. These topics will all be fully serialized. All of the topics referenced by the fully serialized topics which are not themselves full serialized will be included in the frag:topiclist returned as stub topics. If no topics are found with a name that matches the name parameter, then an empty frag:topicmap element will be returned.

Errors
Error CodeCondition
INVALID_TOPICMAPThe name provided in the topicmap parameter does not match the name of any topic map known to the server. The client should retry, specifying the correct topic map name.
Examples

Example 31. HTTP POST Body to Invoke the GetTopicsByName Operation

The following example could be used in the body of an HTTP POST request to the GetTopicsByName.aspx request page.

<request>
  <param name="topicmap">mytopicmap</param>
  <param name="name">NetworkedPlanet</param>
</request>

Example 32. HTTP GET URL to Invoke the GetObjectBySourceLocator Operation

The following example shows how to invoke the GetObjectBySourceLocator operation using an HTTP GET. Note that the name value should be properly escaped within the URL string if it contains reserved or non-ASCII characters.

http://topicmap.mycorp.com/tmws/GetTopicsByName?topicmap=mytopicmap&name=NetworkedPlanet

Example 33. C# Code to Invoke the GetObjectBySourceLocator Operation using the Web Services Client Library

TMSClient client = new TMSClient("http://topicmap.mycorp.com/tmws/TMService.asmx");
XmlNode tmFragment = client.GetTopicsByName("mytopicmap", "NetworkedPlanet");

Get Topics By Type

Returns a topic map fragment that includes all topics of a specified type. The topic type is identified by its unique object identifier.

Method Name

GetTopicsByType

Parameters
topicmap

The name of the topic map to search

typeid

The object identifier of the topic type to return all instances for.

Returns

An XML document conforming to the NetworkedPlanet Topic Map Fragment XML Schema. The root element of this document will be a frag:topicmap element and will contain a frag:topiclist element which in turn contains a frag:topic element for each topic that is typed by the topic identified by the typeid parameter. The instance topics will all be serialized as stub topics. If no topics are typed by the specified type, then the frag:topicmap element returned will be empty.

Errors
Error CodeCondition
INVALID_TOPICMAPThe name provided in the topicmap parameter does not match the name of any topic map known to the server. The client should retry, specifying the correct topic map name.
INVALID_OIDThe value of the typeid parameter could not be converted to a valid object identifier.
NO_SUCH_OBJECTThe value of the typeid parameter was converted to a valid object identifier, but that identifier does not refer to a topic contained in the topic map identified by the topicmap parameter.
Examples

Example 34. HTTP POST Body to Invoke the GetTopicsByType Operation

The following example could be used in the body of an HTTP POST request to the GetTopicsByType.aspx request page.

<request>
  <param name="topicmap">mytopicmap</param>
  <param name="typeid">1234</param>
</request>

Example 35. HTTP GET URL to Invoke the GetTopicsByType Operation

The following example shows how to invoke the GetTopicsByType operation using an HTTP GET.

http://topicmap.mycorp.com/tmws/GetTopicsByType.aspx?topicmap=mytopicmap&typeid=1234

Example 36. C# Code to Invoke the GetObjectBySourceLocator Operation using the Web Services Client Library

TMSClient client = new TMSClient("http://topicmap.mycorp.com/tmws/TMService.asmx");
XmlNode tmFragment = client.GetTopicsByType("mytopicmap", "1234");

Get Topic Types

Returns a topic map fragment that includes all topics which are used as the type of one or more other topics in the specified topic map.

Note

This operation returns a list of all topics which are currently used to type other topics in the topic map and is thus based on actual usage rather than on a pre-defined topic map schema. This list may therefore differ from the list of types returned by the NPCL Schema Web Service.

Method Name

GetTopicTypes

Parameters
topicmap

The name of the topic map to search.

Returns

An XML document conforming to the NetworkedPlanet Topic Map Fragment XML Schema. The root element of this document will be a frag:topicmap element and will contain a frag:topiclist element which in turn contains a frag:topic element for each topic that is used as the type of one or more topics in then topic map. All of these topics will be fully serialized. Any topics which are referred to by the type topics will also be included in the frag:topiclist element but will be serialized as stubs.

Errors
Error CodeCondition
INVALID_TOPICMAPThe name provided in the topicmap parameter does not match the name of any topic map known to the server. The client should retry, specifying the correct topic map name.
Examples

Example 37. HTTP POST Body to Invoke the GetTopicTypes Operation

The following example could be used in the body of an HTTP POST request to the GetTopicTypes.aspx request page.

<request>
  <param name="topicmap">mytopicmap</param>
</request>

Example 38. HTTP GET URL to Invoke the GetTopicTypes Operation

The following example shows how to invoke the GetObjectBySourceLocator operation using an HTTP GET.

http://topicmap.mycorp.com/tmws/GetTopicTypes.aspx?topicmap=mytopicmap

Example 39. C# Code to Invoke the GetObjectBySourceLocator Operation using the Web Services Client Library

TMSClient client = new TMSClient("http://topicmap.mycorp.com/tmws/TMService.asmx");
XmlNode tmFragment = client.GetTopicTypes("mytopicmap");

Query

Executes a named query, optionally with one or more parameters. The query string is configured on the server. The results are returned as an XML document describing a results table.

Method Name

Query

Parameters
topicmap

The name of the topic map to execute the query against.

queryid

The string identifier of the query to be executed.

args

The arguments to be passed in to the query before it is executed. Arguments are specified using the following XML structure:

<tmws:args>
  <tmws:string>
                ARG
</tmws:string>
</tmws:args>
tmws:args

The wrapper for the arguments to be passed in to the query.

tmws:args/tmws:string

Contains a single argument value to pass in to the query. Arguments are passed by position and are bound to the parameters in the named query configuration in the order that the parameters are declared, so the ordering of tmws:string elements is important. This element is OPTIONAL and REPEATABLE.

Returns

An XML representation of the data set returned by executing the query. This data set uses the normal XML syntax for ADO.NET data sets and the XML namespace http://www.networkedplanet.com/2005/01/topicmap/querydata/ .

Errors
Error CodeCondition
INVALID_TOPICMAPThe name provided in the topicmap parameter does not match the name of any topic map known to the server. The client should retry, specifying the correct topic map name.
INVALID_QUERY_IDThere is no query on the server with the identifier specified in the queryid parameter.
MISSING_ARGUMENTSAt least one argument was required but missing from the args parameter.
SQL_ERRORAn error was encountered exceuting the SQL query. The error message will also contain the error reported by the database.
Examples

Example 40. HTTP POST Body to Invoke the Query Operation

The following example could be used in the body of an HTTP POST request to the Query.aspx request page.

<request>
  <param name="topicmap">mytopicmap</param>
  <param name="queryid">MyQuery</param>
  <param name="args">ARG1</param>
  <param name="args">ARG2</param>
</request>

Example 41. HTTP GET URL to Invoke the Query Operation

The following example shows how to invoke the Query operation using an HTTP GET. Note that this interface can be only used if the query takes one argument or no arguments.

http://topicmap.mycorp.com/tmws/Query.aspx?topicmap=mytopicmap&queryid=MyQuery&args=ARG1

Example 42. C# Code to Invoke the Query Operation using the Web Services Client Library

TMSClient client = new TMSClient("http://topicmap.mycorp.com/tmws/TMService.asmx");

XmlNode results = client.Query("mytopicmap", "MyQuery", new string[] { "ARG1", "ARG2" });

// The results can be deserialized as a DataSet which will always contain a single table:
DataSet dsResults = new DataSet();
dsResults.ReadXml(new XmlNodeReader(results));

// Now you can access the results table as:
DataTable dt = dsResults.Tables[0];

Save

Saves one or more topics and associations to the topic map. This method can be used to create new topics and associations, to modify existing topics and associations, and to delete objects from topics and associations (to delete entire topics or associations, use the Delete Topics or Delete Associations methods).

Method Name

Save

Parameters
topicmap

The topic map to be updated.

tmfragment

The updates to be made to the topic map expressed as an XML document conforming to the NetworkedPlanet Topic Map Fragment XML Schema and with the frag:topicmap element as the root element.

Returns

An XML document conforming to the NetworkedPlanet Web Service Results XML schema with a res:results element as the root element of the document. The res:resultrs element will contain one res:result element for each frag:topic and each frag:association element contained in the tmfragment parameter indicating the success status for the update of that object). The key attribute of the res:result element will contain the value of the oid attribute of the frag:topic or frag:association that was processed. The following error codes may appear inside res:result/res:error elements where an error occurs updating an individual object:

Error CodeCondition
INVALID_OIDThe value of the oid attribute of the object to be updated was not a valid object identifier. For existing objects, the value of the oid attribute must match the object identifier of at least one existing object. For newly created objects, the oid attribute must start with the prefix 'new:' followed by one or more ASCII letters or digits.
INVALID_VERSIONThe value of the version attribute of the object to be updated was not a valid version number. A valid version number must be an integer value greater than 0.
INVALID_TOPIC_REFERENCEA topic reference contained in the frag:topic or frag:association could not be properly resolved. To properly resolve, the reference must be either the object identifier of an existing topic in the topic map, or it must match the value of the oid attribute for a newly created topic defined in the current tmfragment parameter.
NO_SUCH_TOPIC

The fragment contains a reference to a topic that does not exist in the topic map or which does not exist in the context specified in the tmfragment parameter.

UPDATE_ERRORThe fragment was syntactically valid but one of the operations described caused an error. The res:cause element will contain details about the error.
Errors
Error CodeCondition
INVALID_TOPICMAPThe name provided in the topicmap parameter does not match the name of any topic map known to the server. The client should retry, specifying the correct topic map name.
Examples

Example 43. HTTP POST Body to Invoke the Save Operation

The following example could be used in the body of an HTTP POST request to the Save.aspx request page. The updated topic will have one name and one occurence after the operation completes.

<request>
  <param name="topicmap">mytopicmap</param>
  <param name="tmfragment">
    <tmf:topicmap xmlns:tmf="http://www.networkedplanet.com/2005/01/topicmap/data/">
      <tmf:topiclist>
        <tmf:topic oid="1234">
          <tmf:names>
            <tmf:name>
              <tmf:namestring>Mega Corp Limited</tmf:namestring>
            </tmf:name>
          </tmf:names>
          <tmf:occurrences>
            <tmf:occurrence>
              <tmf:type psi="http://psi.example.com/organizations/stock-ticker"/>
              <tmf:resourcedata>MGCP</tmf:resourcedata>
            </tmf:occurrence>
          </tmf:occurrences>
        </tmf:topic>
      </tmf:topiclist>
    </tmf:topicmap>
  </param>
</request>

Example 44. C# Code to Invoke the Save Operation using the Web Services Client Library

TMSClient client = new TMSClient("http://topicmap.mycorp.com/tmws/TMService.asmx");
// NOTE: This example shows building the request using CreateElement calls.
// You could also use XmlDocument.Load() to read from an external source
// or an internal string.
string tmfNS = "http://www.networkedplanet.com/2005/01/topicmap/data/";
XmlDocument requestDoc = new XmlDocument();
XmlElement topicmap = requestDoc.CreateElement("topicmap", tmfNS);
XmlElement topiclist = requestDoc.CreateElement("topiclist", tmfNS);
XmlElement topic = requestDoc.CreateElement("topic", tmfNS);
topic.SetAttribute("oid", "1234");
XmlElement names = requestDoc.CreateElement("names", tmfNS);
XmlElement name= requestDoc.CreateElement("name", tmfNS);
XmlElement namestring = requestDoc.CreateElement("namestring", tmfNS);
namestring.InnerText="Mega Corp Limited";
name.AppendChild(namestring);
names.AppendChild(name);
topic.AppendChild(names);
topiclist.AppendChild(topic);
topicmap.AppendChild(topiclist);
requestDoc.AppendChild(topicmap);

client.Save("mytopicmap", requestDoc);

ProcessTransaction

Processes a Topic Map Transaction to update a named topic map. Whereas the Save method updates a single topic or association and completely overwrites all existing information for that topic or association, this method provides the ability to update or create several topics or associations in a single batch and also to add or update parts of a topic without modifying the rest of it. For example, you can add a new occurrence to a topic without having to also specify all of the other names and occurrences that you don't want to be changed.

The description of the Topic Map Transaction Schema contained in the appendix of this document provides more detail about all of the different operations that can be specified in a single request.

Method Name

ProcessTransaction

Parameters
topicmap

The name of the topic map to update.

tmfragment

A XML representation of the transaction to perform. The transaction must adhere to the Topic Map Transaction XML Schema.

Returns

A document conforming to the Results XML Schema that lists the results of each individual operation in the transaction.

Errors
Error CodeCondition
INVALID_TOPICMAPThe name provided in the topicmap parameter does not match the name of any topic map known to the server. The client should retry, specifying the correct topic map name.
UPDATE_EXCEPTIONThere was an error processing the transaction provided. Detailed information is provided as part of the error report.
Examples

This section only shows examples of the wrapper XML required to pass a transaction in to the ProcessTransaction method. For a detailed description of the transaction document and its processing, please refer to the Topic Map Transaction XML Schema description in the Appendix.

Example 45. Invoking the ProcessTransaction Method using an HTTP POST

<request>
  <param name="topicmap">mytopicmap</param>
  <param name="transaction">
    <txn:TopicMapTransaction xmlns:txn="http://www.networkedplanet.com/schema/transaction">
     <!-- Operation descriptions go here -->
    </txn:TopicMapTransaction>
  </param>
</request>

Example 46. Invoking The ProcessTransaction Method using C# and the Web Services Client Library

The method interface for the ProcessTransaction proxy simply takes an XmlNode as the transaction parameter value and so can be invoked as follows:

TMSClient client = new TMSClient("http://topicmap.mycorp.com/tmws/TMService.asmx");
XmlDocument txnDoc = new XmlDocument();
// Code to populate the txnDoc goes here
client.ProcessTransaction("mytopicmap", txnDoc);

The transaction XML can be constructed in a number of ways. It can be read from a local file or from an internal string using the XmlDocument.Load() method, or you can construct the document element by element using the XmlDocument.CreateElement() and other related methods.