Programming web service requests in a .NET environment

You can use the CMWebServiceClient.cs sample to help you learn how to create a web service request.

The CMWebServiceClient.cs sample relies on the First Steps data, so ensure that you installed the First Steps component.

You can do the following tasks to develop an application in a .NET environment:
Create a web service object
To instantiate a web service object, you can use the following example:
CMWebService webservice = null;
webservice = new CMWebService();
webservice.Timeout = 60000;
Authenticate the web services request
For security, you must create an authentication object in each request.
Create an instance of an item
The CMWebServiceClient.cs sample creates an instance of an XYZ_InsPolicy item.
Wrapping the XML request
The CMWebServiceClient.cs sample specifies direct XML requests through the WSDL generation utility, for example:
elementRequest request = new RetrieveItemRequest();
request.AuthenticationData = authData;
request.attribute = elementattribute.att_value;
elementReply reply=webservice.element(request);
Attach binary content (if applicable)
You can use one of three standard binary message formats to attach content parts to a request.

The following example wraps an XML request to retrieve the XYZ insurance policy (and a URL for its resource part) through its persistent identifier.

C# sample
public XYZ_ClaimForm retrieveClaimWithResourceURL(
  AuthenticationData authData,
  string pidURI)
{
 RetrieveItemRequest request = new RetrieveItemRequest();
 request.AuthenticationData = authData;
 request.retrieveOption =
    RetrieveItemRequestRetrieveOption.CONTENT_WITH_LINKS;
 request.contentOption = RetrieveItemRequestContentOption.URL;
 request.Item = new RetrieveItemRequestItem();
 request.Item.URI = pidURI;
 RetrieveItemReply reply = webservice.RetrieveItem(request);
 if (reply.RequestStatus.success == true) {
  return reply.Item.ItemXML.XYZ_ClaimForm;
}else {
  Console.WriteLine("Retrieve Policy failed.");
  displayErrorInfo(reply.RequestStatus.ErrorData);
  return null;
 }
}