Naverisk GetClientsList
Get a list of clients.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ServiceModel;
namespace DemoNaveriskGetClientsList
{
class Program
{
/*
* Instructions
*
* 1. Disable Authentication and SSL.
* 2. Add a Service Reference to the Naverisk Service, name the reference NaveriskService.
* The uri will generally be http://localhost:11111/Naverisk.
* 3. With new release you may have to update the Service Reference.
*/
static void Main(string[] args)
{
NaveriskService.NaveriskClient client = new NaveriskService.NaveriskClient();
(client.ChannelFactory.Endpoint.Binding as BasicHttpBinding).MaxReceivedMessageSize = int.MaxValue;
(client.ChannelFactory.Endpoint.Binding as BasicHttpBinding).MaxBufferSize = int.MaxValue;
(client.ChannelFactory.Endpoint.Binding as BasicHttpBinding).ReceiveTimeout = new TimeSpan(0, 10, 0);
NaveriskService.GetClientsListResponse response = client.GetClientsList();
for (int i = 0; i < response.Keys.Count; i++)
Console.WriteLine($"Key: {response.Keys[i]}, Value: {response.Values[i]}");
Console.WriteLine("Press enter to continue.");
Console.ReadLine();
}
}
}
# Instructions
#
# 1. Disable Authentication and SSL
$Uri = 'http://localhost:11111/Naverisk'
$Xml = @'
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
{0}
</soap:Body>
</soap:Envelope>
'@
$Body = @'
<GetClientsList />
'@
$result = (Invoke-WebRequest -UseBasicParsing -Body ($Xml -f $Body) `
-method POST –contentType "text/xml" -Uri $Uri -Headers @{"SOAPAction"="urn:INaverisk/GetClientsList"})
$StringWriter = New-Object System.IO.StringWriter
$XmlWriter = New-Object System.XMl.XmlTextWriter $StringWriter
$xmlWriter.Formatting = "indented"
$xmlWriter.Indentation = 4
([xml]($result.content)).WriteContentTo($XmlWriter)
$XmlWriter.Flush()
$StringWriter.Flush()
Write-Output $StringWriter.ToString()