Common Proxy Server and Firewall Issues with SOAP

SYMPTOMS

images-11A SOAP web service is a HTTP-based Web service that is delivered over TCP/IP. The operation, connectivity, and performance of SOAP web services can be impacted by the proxy server and firewall environment. Client applications access the service through this environment.

The following errors are related to the proxy server and firewall issues. This article describes potential solutions for these errors. Continue reading “Common Proxy Server and Firewall Issues with SOAP”

Method to Copy Data Between Objects of Different Types

This article describes a method to automatically copy data from an object to another object with similar structures. This is similar to a deep_copy(source, destination) but with the possibility of returning a type that is different from the source.

I needed a way to apply/convert values from one object to another so I created a method to automatically drill down the source object graph and copy the properties from one object to another. There are many ways to do this, but I designed a method that is generic enough and also leaves place for customization/fine tuning/hacking. Continue reading “Method to Copy Data Between Objects of Different Types”

A template containing a class feature must end with a class feature

If you have had a play with the awesome Code generation tool that you can build yourself:

Walkthrough: Generating Code by using Text Templates

https://msdn.microsoft.com/en-us/library/dd820614.aspx

Then you might have had a small issue with the above error:

A template containing a class feature must end with a class feature

The error is caused by an invisible space after the last #>

It is also important to bear in mind, that invisible spaces may cause other hard-to-understand compile-errors.

If you want to see a bigger picture, just look at following links:

Now that you are aware how harmfull invisible spaces can be when dealing with Text Templates, my advice is: Make them visible. If you don’t know how to do it, see Jeef Widmer’s blog

ESCAPING SPECIAL CHARS IN LDAP SEARCH FILTERS

When programming against any LDAP backend, it’s good to sanitize any user input that may go into a search filter. A typical case is authentication (login or single sing-on) applications, where an input username or email must be used to resolve a user’s distinct name (DN) in the LDAP directory. Continue reading “ESCAPING SPECIAL CHARS IN LDAP SEARCH FILTERS”

Create an Active Directory Parser based on Organisational Units (OUs)

LDAP queries look like this:

("CN=Dev-UK,OU=Distribution Groups,DC=gp,DC=gl,DC=google,DC=com");

What it means:

  • CN = Common Name
  • OU = Organizational Unit
  • DC = Domain Component

These are all parts of the X.500 Directory Specification, which defines nodes in a LDAP directory.

Each = pair is a search criteria.

With the query

("CN=Dev-UK,OU=Distribution Groups,DC=gp,DC=gl,DC=google,DC=com");

In effect the query is:

From the com Domain Component, find the google Domain Component, and then inside it the glDomain Component and then inside it the gp Domain Component.

In the gp Domain Component, find the Organizational Unit called Distribution Groups and then find the the object that has a common name of Dev-UK.

In order to list all users in this OU, you can write the following function:

public ArrayList EnumerateOU(string domainController, string OuDn, string username, string password)
 {
 ArrayList alObjects = new ArrayList();
 try
 {
 DirectoryEntry directoryObject = new DirectoryEntry("LDAP://" + domainController + "/" + OuDn);
 directoryObject.Username = username;
 directoryObject.Password = password;
 directoryObject.AuthenticationType = AuthenticationTypes.Secure;
 
 foreach (DirectoryEntry child in directoryObject.Children)
 {
 string childPath = child.Path.ToString();
 alObjects.Add(childPath.Remove(0, 7));
 //remove the LDAP prefix from the path
child.Close();
 child.Dispose();
 }
 directoryObject.Close();
 directoryObject.Dispose();
 }
 catch (DirectoryServicesCOMException e)
 {
 Console.WriteLine("An Error Occurred: " + e.Message.ToString());
 }
 return alObjects;
 }