Wednesday, September 9, 2009

Issue exposing an orchestration as a wcf service

You built your orchestration, deployed it and tested it with a file port everything works fine.... cool

now you want to expose the orch as a wcf/asmx service, we launch the wcf publishing wizard and after specfying the name space you find that there are no public ports, ok, we go modify the the preceive port to Public and then launch the WCF Publishing wizard again, we still get the same error message,,,,,,

I wonder why??

Resolution:
un gac the orchestration assembly and then we try again, still the same error

I wonder why???

Restart visual studio and open the project and viola we can publish the orch as a service now,......

Tuesday, July 7, 2009

Assert.AreSame dosent compare the properties of the two instances

as you guessed it dosent compare the properties but the pointer, so even if the two instances are initialzed to the same properties it will always fail.

the solution (Reflection).
http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=442

Monday, April 27, 2009

gacutil path for VS 2008

c:\Program Files\Microsoft SDKs\Windows\v6.0A\bin

Sunday, March 29, 2009

BizTalk and Dublin.

My take on it.

BizTalk will be used for integrating LOB applications EDI, Rosettanet and HIPPA, which it has proven over and over....

Dublin: use it for hosting traditional WCF and WF services, using BizTalk is way a big overhead and moreover Dublin is going to be free

But down the line, someday BizTalk will be replaced.......

Tuesday, March 24, 2009

Testing events in VSTS

Create a anonymous delegate and a variable to set
ManualResetEvent statsUpdatedEvent = new ManualResetEvent(false);
bool serviceFaulted = false;

Classevent += delegate
{
System.Diagnostics.Debug.WriteLine("Runtime faulted");
serviceFaulted = true;
statsUpdatedEvent.Set();

};

do some operation to trigger the event.
.......
Wait for the event to trigger
statsUpdatedEvent.WaitOne(5000, false);

then

Assert.IsFalse(serviceFaulted);


This is taken from the following link

http://www.philosophicalgeek.com/2007/12/27/easily-unit-testing-event-handlers/

Thursday, March 19, 2009

wshttpbinding - httpsys - netsh - certificates

http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2005/11/17/5628.aspx

step 1
"makecert -r -pe -n "CN=localhost" -b 01/01/2000 -e 01/01/2036 -eku 1.3.6.1.5.5.7.3.1 -ss my -sr localMachine -sky exchange -sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12"

step2
httpcfg.exe set ssl -i 0.0.0.0:9091 -c "MY" -h XXXXXXXX

for vista and 2008

appid int he netsh http add sslcert is nothing but a new guid(Create one).


http://www.inventec.ch/chdh/notes/14.htm
-------------------------------------------------------------
server 2008 and vista

http://msdn.microsoft.com/en-us/library/ms733791.aspx

appid int he netsh http add sslcert is nothing but a new guid(Create one).

Wednesday, March 18, 2009

Testing email in .NET

Testing email in .NET require us a smtp server for send a pop3 to download, smtpserver is not a problem but POP3 is there are lot of products that are out there which are not free(may be a evaluation period), you can use a Exchange server(this according to me is a pain becasue of setting up AD and all) another solution might be using your inbox,but that dosent qualify as a unit test.

the simple solution is use nDumbster

http://ndumbster.sourceforge.net/default.html

Serialize and deserialize a workflow ruleset

Serailze

private void SerializeRuleSet(RuleSet ruleSet)
{
StringBuilder ruleDefinition = new StringBuilder();
WorkflowMarkupSerializer serializer = new WorkflowMarkupSerializer();

if (ruleSet != null)
{
try
{
StringWriter stringWriter = new StringWriter(ruleDefinition, CultureInfo.InvariantCulture);
XmlTextWriter writer = new XmlTextWriter(stringWriter);
serializer.Serialize(writer, ruleSet);
writer.Flush();
writer.Close();
stringWriter.Flush();
stringWriter.Close();
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
}
else
{

}

XmlDocument rule = new XmlDocument();
rule.LoadXml(ruleDefinition.ToString());
rule.Save("c:\\message.xml");
}

Deserialize


public static RuleSet GetSampleRule(string type)
{

ruleSetXmlDefinition = GetEmbeddedTextFileContent("EsbMsgSampleRule.xml");


WorkflowMarkupSerializer serializer = new WorkflowMarkupSerializer();

StringReader stringReader = new StringReader(ruleSetXmlDefinition);
XmlTextReader reader = new XmlTextReader(stringReader);
return serializer.Deserialize(reader) as RuleSet;
}

Tuesday, March 17, 2009

Saturday, March 7, 2009

Type Converters to the rescue.

Issue:
We had a a requirement to make our property grid Read only,the out of the box propertygrid provided by the .net framework even disable the ellipses button for a collection property of my class(array...etc) so there is no other way of looking into all the collection elements.

Solution:
Create a TypeConverter class and overwrite the CanConvertTo and ConverTo methods, what i did was i Converted the array into a delimited sting and decoreated my class property with this coverter class and now in the propertyGrid is see a delimited string instead of a collection object.

the example is as follows.....

Tuesday, January 6, 2009

Testing in biztalk 2009i

Well one of the drawback that i found is we cannot test the out of the box built in pipelines.....

well why do you want to do it???, because i want to test a transform, i want to see if my flat file is getting disassembled properly....etc, you can over come this by creating your own pipelines(a copy of the default ones with the same components)......

Tomas's testing library handles this very nicely...

Sunday, June 22, 2008

XmlSerialization Reference Types vs Value Types.

Why are Specified properties generated for few DataTypes when using XSD.EXE or WSDL.EXE

Answer:
They are generated only for valuetypes that have there minOccurs property set to zero, becuase valutypes cannot be set as null.

Monday, March 24, 2008

VS 2008 and WCF Adapter SDK.

As far as i am familiar, microsoft has not yet released a WCF Adapter Template for VS 2008.
I went a head and installed VS2008 on a machine which already had the following
1)VS2005
2)WCF Adapter SDK.
After installing VS2008 when i tried to use the add adapter reference in a project an error was thrown "No Adapters were installed on the machine", i realized that VS 2008 overwrites the machine.config's Service Model Section,
So the fix is to add all the client, binding element extension and bindingelements in servicemodel section again.

Thursday, February 7, 2008

Add Visual Studio Post-Build Events.

Update: a much better alternative.
http://www.elumenotion.com/Blog/Lists/Posts/Post.aspx?ID=23


One of the most under used features of Visual Studio is the post and pre build events.......

Example: Deploy the assembly to gac and copy the .pdb files in to the assemblies gac directory.
before this gac the assembly and navigate to its (gac) folder from "C:\WINDOWS\Assembly\GAC_MSIL\Assembly NameSpace

1) create a bat file with the following and save it in the bin\debug\postbuild.bat

"C:\Program files\Microsoft Visual Studio 8\SDK\v2.0\Bin\GacUtil.exe" /i Assembly Name.dll/f

xcopy Assembly Name.pdb C:\WINDOWS\Assembly\GAC_MSIL\Assembly name space\1.0.0.0__Assembly Public Key Token\

2) Right click the project select properties.

3) Navigate to Build Events

4) In the post build event text box enter the following

call "project path\bin\debug\postbuild.bat"

5) Rebuild the solution ...

Hope this helps





Monday, December 31, 2007

System.Configuration for a class libray.

i was writing a httphandler(class library project ofcourse), i needed to log a value into the db, so i needed a connection string from the web.config, i imported the namespce(System.Configuration) in to the class and all i could do was only access the AppSetting part of the config file.

In order to access the connection strings add a reference to the System.Configuration.dll to the project.

Strange......

Monday, December 17, 2007

Funny Word Web Message


I use Word Web for( you know what), it throwed the following message when i used it for 30 days
Funny........................

Saturday, December 1, 2007

Debugging WCF LOB Custom Adapters

1) Gac the assembly
Install the WCF LOB Adapter assembly in the GAC and click Run and paste the following %systemroot%\assembly\gac, navigate to the msil folder(the .net 2.0 assembly are installed here) find your assembly and copy the pdb files in to it
your assembly will be stored in the following structure

-- Name of the assembly
-- public key token
-- .dll file (copy the pdb files here)

in order to automate the process you might want to create a bat file or add a post build command in Visual studio.(Of course the above structure will appear only when you have gaced the assembly first and then create the bat file or the post build script).

So we are ready for debugging

2) Design Time
open up 2 instances of Visual studio
1st instance should contain the WCF LOB Adapter project
2nd should contain the client or biz talk project that you want to import the adapter proxy into

In the first instance attach the 2nd instance Visual studio process from the debug menu, and from the second VS instance perform Add Adapter reference for a .net client or a Add generated items for a Biz talk client.

Once done the debug point in the 1st instance of the Adapter code will be hit.


3) Run Time
Once you gaced WCF LOB Adapter assembly click F5 from your .net application
For biz talk you have to attach the Biz talk process.


and also throw in DebugView and add WCF tracing--- :)

Note: As you do the changes to the adapter code, you have to restart Visual studio again to load the latest dll, i believe VS caches the dlls.

Thursday, November 22, 2007

WCF LOB adapter Metadata changes don't reflect when you consume the adapter.

Problem:
I was working the with the WCF LOB adapter and did a small change to the adapter's operation (added another input parameter from 2 to 3), and gaced the adapter dll, then in the same VS instance i added another project and consumed thte adapter service, nothing has changed the operation still showed only 2 parameters!!!!!!!!!!!!!

Solution: Restart VS and consume the adapter again.

Tuesday, September 4, 2007

2006 BizTalk Adapter Dev

1. Got to codeplex and download the Adapter Template

Monday, July 9, 2007

ORM's

ORM: Object relationship mapping.
I have to use nHibernate in one of projects, from what i have googled it is used to store Objects in a database for future retrivals...etc, ok but dosen't serialization do this.......
here is the intresting part, how about performing Sql queries on the stored objects, ex: get me an address object whose addressline starts with "7 w",... well this is what i can make out as of now, i will update its functionality as soon i start implementing this wonderfull tool.

-