Getting Rid of TempUri in WCF#

Everyone of has seen it; the default namespace TempUri reference in our otherwise neatly published WSDL, looks like an out of place not-so-thought-out part of your otherwise ironclad contract. Hence the question arises, how to get rid of it and put your company’s corresponding namespace in there.

In the asmx services, it was rather easy to do it; just modify your webservice attribute.

[WebService(Namespace = "http://tempuri.org/")]

However, in the new uncharted waters of WCF, things are wee bit more complex than this. Now you’d need to do it in multiple places. The point to remember is that an endpoint has an associated behavior with it.

The web.config file.

 Service Endpoint
<endpoint address=""                                                                                                                                           binding="basicHttpBinding"                                                                                                                                 contract="Acme.Services.WCFNamespaceSample.IService"                                                                                bindingNamespace ="http://acme.com/Acme/Services/WCFNamespaceSample/">

Behavior Endpoint
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" bindingNamespace="http://acme.com/Acme/Services/WCFNamespaceSample/"/>

Also, for the general namespace changes, you need to specify the attribute as follows.

namespace Acme.Services.WCFNamespaceSample
{
                [ServiceBehavior (Namespace = "Acme.Services.WCFNamespaceSample")]
                public class Service : IService

And

namespace Acme.Services.WCFNamespaceSample
{
                [ServiceContract(Namespace = "Acme.Services.WCFNamespaceSample")]
                public interface IService

This should do the magic. Following source code is a good place to start.

WCFNamespaceSample.zip (4.1 KB)






6/13/2008 11:18:28 AM (Pacific Standard Time, UTC-08:00) #    Comments [1]  |  Trackback

 

Social Network Analysis – Network Theory Problem.#

While reading up on outlier cohesion analysis in collaborative social networks, I came across this article which I found pretty interesting in the security niche; “Structural Analysis and Destabilizing Terrorist Networks” by  N. Memon et al. The article discusses key areas in network analysis such as

(i)                  cohesion analysis (such as cliques, ncliques, n-clans and k-plex) to determine familiarity, robustness and reachability.
(ii)                role analysis (such as position role index) to determine critical nodes and
(iii)               power analysis (such as degree centrality, Eigenvector centrality and dependence centrality)

This work has further been refined and published as IEEE conference on intelligence security and ADMA

Practical Algorithms for Destabilizing Terrorist Networks
N Memon, HL Larsen - Proceedings of IEEE Conference on Intelligence Security …, 2006 – Springer

And

Structural Analysis and Mathematical Methods for Destabilizing Terrorist Networks Using Investigative Data …
N Memon, HL Larsen - … Conference on Advanced Data Mining Applications (ADMA 2006), 2006 – Springer

From a generic covert network perspective, there has been previously a lot of work done for darkNet exploration, automated discovery for nodes with case studies in Allpeers, anoNet, Freenet, GNUnet, I2P , Tor, Turtle F2F and WASTE.

A good overview can be found here.

 Destabilizing dynamic covert networks
KM Carley, M Dombroski, M Tsvetovat, J Reminga, N … - Proceedings of the 8th International Command and Control …, 2003 - casos.cs.cmu.edu

The problem of network outliers is not only crucial in intrusion detection but also an interesting network theory problem where a leaf node posses attributes out of the ordinary. As discussed by N. Memon et al for the social aspect of network; “The analysis of the interaction structures that is involved in social network analysis is an important element in the analysis of the micro-macro link, the way in which individual behavior and social phenomena are connected with one another. In this perspective, social networks are both the cause of and the result of individual behavior.”

References from the paper and further readings

1. Scott, J.: Social Network Analysis: A Handbook, 2 edn. Sage Publications, London 2000.

2. Wasserman, S., Faust, K.: Social Network Analysis. Cambridge University Press.1994.

3. Sageman, M.: Understanding Terrorist Networks. University of Pennsylvania Press, 2004.

4. Berry, N., Ko, T., Moy, T., Smrcka, J., Turnley, J., Wu, B.: Emergent clique formation in terrorist recruitment. The AAAI- 04 Workshop on Agent Organizations: Theory and Practice, July 25, 2004, San Jose, California, 2004. http://www.cs.uu.nl/virginia/aotp/papers.htm

5. McAndrew, D.: The structural analysis of criminal networks. In: D. Canter, L. Alison (eds.) The Social Psychology of Crime: Groups, Teams, and Networks, Offender Profiling Series, III.Aldershot, Dartmouth ,1999.

6. Davis, R.H.: Social network analysis: An aid in conspiracy investigations. FBI Law Enforcement Bulletin pp. 11–19, 1981.

7. Chen, H., Chung, W., Xu, J.J., Wang, G., Qin, Y., Chau, M.: Crime data mining: A general framework and some examples. Computer 37(4), 50–56, 2004.

8. Krebs, V.: Mapping networks of terrorist cells. Connections 24, 45–52, 2002.

9. Bonacich, P., Power and Centrality. American Journal of Sociology 92: 1170-1184, 1987.

10. Burt, R. S., Structural Holes, Cambridge, MA: Harvard University Press, 1992.

11. Hanneman, R. E., Introduction to Social Network Methods.Online Textbook Supporting Sociology 175. Riverside, CA: University of California, 200.

12. Burt, R. S., Structure, A General Purpose Network Analysis Program. Reference Manual, Newyork: Columbia University, 1990.

13. Luce, R., Perry, A.: A method of matrix analysis of group structure. Psychometrika 14, 95–116, 1949.

14. Seidman, S.B., Foster, B.L.: A graph theoretic generalization of the clique concept. Journal of Mathematical Sociology 6, 139–154, 1978.

15. Freeman, L.C.: The sociological concept of “group”: An empirical test of two models. American Journal of Sociology98, 152–166 ,1992.

16. Luce, R.: Connectivity and generalized cliques in sociometric group structure. Psychometrika 15, 169–190, 1950.

17. Mokken, R.: Cliques, clubs and clans. Quality and Quantity 13, 161–173, 1979.

18. Balasundaram, B., Butenko, S., Trukhanov, S.: Novel approaches for analyzing biological networks. Journal of Combinatorial Optimization 10, 23–39, 2005.

19. Latora, V., Massimo Marchiori How Science of Complex Networks can help in developing Strategy against Terrorism, Chaos, Solitons and Fractals 20, 69-75, 2004.

20. Memon, N. Henrik Legind Larsen, Practical Algorithms for Destabilizing Terrorist Networks, In Proceedings of IEEE Intelligence Security Conference (ISI 2006), San Diego, California, USA (to appear), 2006.

 Newman, M. E. J. The structure and function of complex networks, SIAM Review 45, 167- 256, 2003.

And on a humorous side, here is an interesting video about how NOT to do it.:)








6/12/2008 10:36:29 AM (Pacific Standard Time, UTC-08:00) #    Comments [0]  |  Trackback

 

Aspect Oriented Programming Goodies#

Aspect Oriented Programming: Radical Research in Modularity

 

Video: Aspect-Oriented Modeling - what it is and what it's good for

Video: Anurag Mendhekar: Aspect-Oriented Programming (Dan Friedman)

PointCut Doctor
IDE Support for Understanding and Diagnosing AspectJ Pointcuts   

Aspect.NET 2.1
An aspect-oriented programming tool for Microsoft.NET

Loom.NET
The LOOM .NET project aims to investigate and promote the usage of AOP in the context of the Microsoft .NET framework.

AOSD – Annual Conference

AOSD Community website

 





6/9/2008 5:07:02 PM (Pacific Standard Time, UTC-08:00) #    Comments [0]  |  Trackback

 

Speaking at IASA Conference - Architecture Connections Sessions#

I'll be speaking to IASA connections conference in San Francisco on Aspect Oriented Programming in Distributed Systems.

Following are further details.

Conference Page
October 6 - 8, 2008

San Francisco Marriott
San Francisco, CA

IASA02: Service Aspects—Aspect Orientated Designs in Distributed Enterprise Architecture
Adnan Masood
Aspect Oriented Programming and Aspect-Oriented software development (AOSD) support the software development paradigm which leverages separation of concerns, especially cross-cutting concerns as a next step to modularization. Separation of concerns can be defined as breaking down a program into distinct parts that overlap in functionality as little as possible. The similar concerns are factored and defined as aspects which are separated out from the main logic making the implementation more maintainable. In this session we approach the service orientation as an aspect of a distributed system. Using attribute oriented design for aspect implementation, this presentation focuses on merits of exposing service end points from business objects by using AOP practices. The attendees will: gather the understanding of AOP, a fast growing research and development area in modern software development; understand the state of affairs of AOP in the current IDE’s and programming languages especially with Spring, AspectJ and Aspect.NET; explore the rationale of aspect-based nature of services and deep dive into the open source ServiceAspect CodePlex project for a sample implementation. This session’s focus is the architecture and design practices that AOSD brings to the enterprise architecture. Best practices and design patterns followed in AOP will be discussed with a demo of Aspect.NET and ServiceAspect, which is used to publish business objects as WCF services using attributes.

List of  Speakers

List of Sessions






6/6/2008 2:51:22 PM (Pacific Standard Time, UTC-08:00) #    Comments [0]  |  Trackback

 

Microsoft Certified Trainer#
Thanks to Michele Bustamante and Helen (UCSD); I have recently received notifications that my application for MCT (Microsoft Certified Trainer) has been accepted. Here is My MCT Profile



With access to MOC cirriculum and Microsoft Knowledge Nexus, I hope it would help my development and teaching experiences to be richer and more effective.

Alright, so now who is up for getting trained :)




6/6/2008 2:37:28 PM (Pacific Standard Time, UTC-08:00) #    Comments [1]  |  Trackback

 

Note to Self - Generating HTTP 500 Internal Server Error Custom Response #

Returning HTTP 500 internal server error as your web service / asp.net REST responses in case of failures may  sound like an odd idea but it has its merits; with handlers and load balancing environments where you want your intelligent routing devices to redirect request to a different server based on an HTTP header response, this approach can come in handy.

In order to return an HTTP 500 server error custom response, there are two simple ways to achieve it.

By throwing an HTTP exception

throw new System.Web.HttpException(500, "Internal Server Error");

 

Or by modifying the headers.

       HttpContext.Current.Response.Status = "500 Internal Server Error";

       HttpContext.Current.Response.AddHeader("Status Code", "500");

       HttpContext.Current.Response.End();

Looking at the response from the HTTP headers, they are almost identical. The only difference is that due to termination of response stream in the later case, the content length is 0.

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Accept-Language: en-us,en;q=0.5

Accept-Encoding: gzip,deflate

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

Keep-Alive: 300

Connection: keep-alive

Referer: http://localhost:17109/HTTP500Test/Service.asmx?op=ThrowHTTPException

Content-Type: application/x-www-form-urlencoded

Content-Length: 0

 

HTTP/1.x 500 Internal Server Error

Server: ASP.NET Development Server/9.0.0.0

Date: Fri, 30 May 2008 15:58:24 GMT

X-AspNet-Version: 2.0.50727

Cache-Control: private

Content-Type: text/plain; charset=utf-8

Content-Length: 152

Connection: Close

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Accept-Language: en-us,en;q=0.5

Accept-Encoding: gzip,deflate

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

Keep-Alive: 300

Connection: keep-alive

Referer: http://localhost:17109/HTTP500Test/Service.asmx?op=ResponseHeader500Error

Content-Type: application/x-www-form-urlencoded

Content-Length: 0

 

HTTP/1.x 500 Internal Server Error

Server: ASP.NET Development Server/9.0.0.0

Date: Fri, 30 May 2008 15:57:10 GMT

X-AspNet-Version: 2.0.50727

Cache-Control: private, max-age=0

Content-Length: 0

Connection: Close

 

The similar result can be achieved by throwing an ApplicationException or custom exception as well because for the runtime, it still means an internal server error.

The source for the web service project can be downloaded from here. HTTP500Test-Src.zip (2.79 KB)





5/30/2008 8:04:48 AM (Pacific Standard Time, UTC-08:00) #    Comments [0]  |  Trackback

 

Review for UCertify M70-526 C# Exam. TS Microsoft.NET Framework 2.0 Windows based Client Development.#

With the rapidly changing horizon of upcoming tools and technologies, technical certification is an organized way of studying and keeping oneself up-to-date with the latest and greatest features which software frameworks have to offer.  Even though hands on experience is an absolute necessity, usually when using a particular framework in everyday job, a developer only gets exposed to a smaller set of features pertaining to the task at hand. On the contrary, certification study provides a breadth first approach to the general underlying framework, its mechanics and features. Since it covers a much broader area, studying for a certification exam becomes a daunting task; luckily not for those equipped with tools such as uCertify’s certification study products which allow you to focus your study in the key areas and provide you with instant feedback and help during the preparation process.

uCertify’s 70-526 – C# Exam. TS Microsoft.NET Framework 2.0 Windows based client preparation tool assists you to get ready for the test in a well organized and effective way. It consists of three practice tests with 35 well diversified questions, flash cards, adaptive tests, a detailed study notes section and final exam with 40 questions. This product lets you evaluate your readiness level, provides you a test history to ensure the progress and also allow you to create a custom test, based on the areas you find yourself not so strong. The product is customizable and allow you to create your own entries for test preparation but I believe the sections such as How To’s  could have been expanded and made more effective.  A test can be conducted in both “test” and “learning mode”; detailed explanation and references are provided in the later mode for follow up and understanding. The preparation engine is also equipped with features such as bookmarking, tagging and rating the questions.

Having taken the tests in the classical way, by using Microsoft courses, MSDN and books for prep, I find uCertify’s product quite relevant and helpful. Looking back if I’d have to prepare for the future exams, I’d use this tool in association with recommended text to help gauge the learning.

For details and trial downloads, please visit UCertify's website.





5/28/2008 5:42:47 AM (Pacific Standard Time, UTC-08:00) #    Comments [0]  |  Trackback

 

My Sessions @ Upcoming SoCal Code Camp in San Diego - 28, 29th. June#
Southern California Rock & Roll Code Camp is being held on June 28th and 29th at University California San Diego Extension. I'll be presenting following three sessions at the code camp.