using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
namespace reportFraudConsoleApp
{
class Program
{
static void Main(string[] args)
{
reportfrauddataref.reportfraudVS ws = new reportfrauddataref.reportfraudVS();
reportfrauddataref.getCaseAttachmentFilesInputDoc wsinput = new reportfrauddataref.getCaseAttachmentFilesInputDoc();
wsinput.caseNr = "5555";
//auth with CredentialCache class
System.Net.CredentialCache myCred = new System.Net.CredentialCache();
NetworkCredential networkCred = new NetworkCredential("Administrator", "wm123");
myCred.Add(new Uri(ws.Url),"Basic",networkCred);
ws.Credentials = myCred;
reportfrauddataref.attachmentsData[] resultArray = ws.getCaseAttachmentFiles(wsinput);
List fileNames=new List();
List fileContents=new List();
for (int i = 0; i < resultArray.Length;i++ )
{
// Manipulate the output from the web service by looping over the results from the ws call
fileNames.Add(resultArray[i].fileName);
fileContents.Add(resultArray[i].fileContent);
}
Console.WriteLine(fileNames.ToArray().ToString());
Console.ReadLine();
}
}
}
Wednesday, February 27, 2013
consume a basic auth web service in C# and manipulate the output
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment