Thursday, May 12, 2011

Importance of Fault contact in web service.

I have gone through some articles about the importance of fault contract in SOA.
I got this perception that fault contract is not only necessary for the client but it also more describe your service.

Fault contract is a very good approach to describe the possible error so , client will know in advance and safe to face any surprise behavior. Client can handle this exception and write his logic because he is well aware about, what will happen after anything wrong.
Now the question come how we can implement fault contract.
There could two (2) ways implement it.
1) specify it in wsdl document.
2) make your own exception.

Lets discuss one by one.
1) specify it in the wsdl
One of the best approach to define you contract first before writing any code, there is debate on code first vs. contract first approaches. Everyone accepts contract first approach is very detail and less prone to error approach. As the matter of fault contract we can define in code or contract both will resolve at the end in wsdl.
Advantage of this approach is:
"SOAP faults are message types that are included in the metadata for a service operation and therefore create a fault contract that clients can use to make their operation more robust or interactive. In addition, because SOAP faults are expressed to clients in XML form, it is a highly interoperable type system that clients on any SOAP platform can use, increasing the reach of your WCF application. "
This is excerpt of msdn article.
This is not a new concept to define fault contract wsdl specification has this leverage to define your faults inside wsdl document. For more …
Fault contract implementation in wsdl by IBM

2) Make your own exception
This is also good approach and specially when previously established who uses custom exception Scheme. Its good for them this scheme to use it without disturbing the whole application. It comes with its own cost also because Exception will be serialized in to SOAP request. Because the behavior is not defined at designed time

Tuesday, February 15, 2011

Error Message

Error Message

Ora error: "ORA-01036: illegal variable name/number"

when it happens remove @ character in your parameters Like this

< parameter>
< parameterName value="P_ERRORTOKENID"/>
< dbType value="String"/>
< size value="100"/>
< layout type="log4net.Layout.PatternLayout" value="%property{ErrorTokenId}"/>
<\parameter>

Hosting service on IIS


The requested content appears to be script and will not be served by the static file handler.
I have solve this issue by helping this article.


Hosting service on IIS: "http://www.byteblocks.com/post/2010/03/25/HTTP-Error-40417-Not-Found.aspx"

Saturday, November 13, 2010

Hi,
I am working on integration project which mainly deals with two other system.
when this task comes to me I designed a question airs for other teams.In this development. I have learned some good points during integration analysis.
These points are under mentioned.
1) Always go through details analysis of front end application(which helps you to understand about system functionality)
2) System back office knowledge (It will help you to understand about the technical complexity which you will faced during integration,existing work-flow)
3) Existing system's deployment architecture so will be aware how you communicate with them.
I am also attaching my question air with this post,It will guide in you integration development.

































































Questions

Descriptions

System(Service Name)

GetApplicationStatus

Desciption

what is purpose of this webmethod

Nature of Interaction


Synch/Asynch

Response Time (Approx.)


response time of this service mthod

Transactional Integrity


How you ensure transactional integrity

Message Format


Xml string/DataObject....

Idempotent?

one dataset can entertain multiple time

Security Implementation


security mechnaism

Availability

Is it availabe 24/7

Change Management


what if you are releasing new version of Service then forward or back comptible

Proposed Scheduling


any downtime


Dependency

service is depened on any other service

Expected Messages Frequency


500 per day

Owner

responsible person of this service

Tuesday, August 24, 2010

how to get file from resources

Hi,
Today I was busy in two issues
First one was something refactoring I have to deal with some objects and their property name
and object property will be called by name Like I want obj.property(string name).setvalue("")
Any how I achieved this by reflection. lemme me share code with u


private static void LoadPropertiesValues(object dataObject )
{
if(dataObject != null)
{
PropertyInfo[] properties = dataObject.GetType().GetProperties();
foreach (PropertyInfo objInfo in properties)
{
XmlNode xmlMapNode =
_xmlMappingDoc.SelectSingleNode("/parentElement/ChildName[@fieldname='" +
objInfo.Name + "']");
if (xmlMapNode != null && xmlMapNode.Attributes[1] != null &&
xmlMapNode.Attributes[1].Value != string.Empty)
{
string mapGroupName = xmlMapNode.Attributes[1].InnerText;
Mapping mapping = _dataMapperDao.GetMappingByCodeAndResidencyValue(mapGroupName,
dataObject.GetType().GetProperty(objInfo.Name).GetValue(dataObject,null).ToString());
if (mapping != null)
{
dataObject.GetType().GetProperty(objInfo.Name).SetValue(dataObject,mapping.code,null);
}
}

}
}
}


Second issue was access file from resources
Actually I have to load some values from xml file and then I have to take care about its path because in production Envoirnment I cann't guarantee that path will be same neither I can enforce it. It will be changed so I want to get rid of this issue I put this file inside resources, then I put little effort on accessing this file.

Assembly objAssembly = Assembly.GetAssembly(typeof (ClassName));
if(objAssembly!=null)
{
Stream stream = objAssembly.
GetManifestResourceStream("ParentApp.ApplicationName.FileName.xml");
if (stream != null)
{
var xmlTextReader = new XmlTextReader(stream);

_xmlMappingDoc.Load(xmlTextReader);

}
}

So, this is all about today :)

Tuesday, August 17, 2010

breakpoints connot be set in method or class with the debuggerstep through attribute just my code is enable

Today I face this problem I was unable to debug my code and I spent several hours to solve it.
I got this exception when I put debug point and it displays this message on runtime.
Anyhow I found two solution
[assembly:System.Diagnostics.Debuggable(true,true)] attribute at assembly level.
I declare this attribute in assemblyinfo.cs

second solution is I change my webservice project from website to web application and everything is going smoothly :) Happy!!