Friday, November 30, 2012

Jquery - How to know any changes happen in the form

At first, I thought initially its a easier task, to find a change happen in a aspx form (Page) . And to my worst there are atleast 30 text box 6 combo and few more ajax grids. I cannot write page full of javascript, whether any changes happened in any of the control.

It took me another 2 days to get find the solution with Jquery. and amazing just 2 lines of code :)

        //To check if there is any changes happening in the form/page
        $(document).ready(function () {
            $('.bodyContainer').change(function () {
                // DO YOUR CODE HERE
                    }
                }

Few lines above has solved my problem.


Quick Setup of JBoss 7.1 with MySql Datasource

This post will help you to setup JBoss AS 7.1.x with MySql Datasource. 

As a precondition, we should have the following ready in our development environment
JDK 1.7
MySql
JBoss AS 7.x 


Run JBoss Server
Once downloaded and extracted JBoss AS 7.1, you can run the server by executing the <JBoss home>/bin/standalone batch (Windows) or shell(Linux) file, based on your OS. Make sure the server got started without any errors by checking the logs. You can also verify by visiting the url http://localhost:8080 in your browser, which shows you the JBoss home page.


Create User
We have to create users to access JBoss administration console. To add new users run add-<JBoss Home>/bin/add-user batch (Windows) or shell(Linux) file, based on your OS. This utility requires Realm, Username and Password. Releam is the name of the realm used to secure the management interfaces, by default it is 'ManagementRealm' so you can just press enter. Also enter Username and Password to complete the user creation. Now you can login using the created Username and Password, by clicking the Administration Console link from JBoss home page.


Setup Datasource
To setup MySql datasource we have to add MySql driver as a module and create the driver & datasource. Let us get into detail on how to do this. Download MySql Connector Java, jar file and place it in <JBoss Home>/modules/com/mysql/main directory. Create a xml file in the main directory named, module.xml and copy paste the following code in it,


<?xml version="1.0" encoding="UTF-8"?>

<module xmlns="urn:jboss:module:1.0" name="com.mysql">
    <resources>
        <resource-root path="mysql-connector-java-5.1.18.jar"/>
    </resources>
    <dependencies>
        <module name="javax.api"/>
    </dependencies>
</module>


Open <JBoss Home>/standalone/configuration/standalone.xml file to add the MySql driver and create datasource. Find the datasource subsystem(
<subsystem xmlns="urn:jboss:domain:datasources:1.0">) node in the xml file, and add the following code under drivers node.


<driver name="mysql" module="com.mysql"/>


To create datasource, add a new datasource node under datasources node with your MySql database configurations in 
datasource subsystem. The following is a sample one.


<datasource jta="true" jndi-name="java:/name-of-the-data-source" pool-name="name-of-the-pool" enabled="true" use-java-context="true" use-ccm="true">

         <connection-url>jdbc:mysql://localhost:3306/db-name</connection-url>
         <driver>mysql</driver>
         <security>
             <user-name>root</user-name>
             <password>root</password>
         </security>
         <statement>
              <prepared-statement-cache-size>100</prepared-statement-cache-size>
              <share-prepared-statements>true</share-prepared-statements>
         </statement>
</datasource> 


Once you are done with the above, restart the server, login to admin console, and click Datasources to view the created datasource. You can use this datasource in your J2EE application to connect to MySql database. 



Monday, November 26, 2012

BizTalk 2010: Why WCF Custom adapter is better than WCF-NetTcp, WCF-NetMSMQ ?

Why WCF custom (In process or isolated) adapter is better than the other WCF adapters. When I discussed with a BizTalk team working for leading apparel client, they have used the custom adapter extensively and they haven’t used any other WCF adapters. I got some answer like
“For example one of the requirements is to fetch a column from a table which is not a value but a XML message instead. In this case using WCF-custom developer can type poll to have better control on the table column that are fetched.”
 Yes the above statement is true. But it has more reason, after some exploration and I found the following list of usage
  • Implement and exploit extensibility points.
  • Have full access to properties exposed by bindings/behaviors.
  • Enable the use of the bamInterceptor endpoint behavior.
  • Export/Import the binding configuration.
  • Disable a receive location on failure.
  • Run an http-based Receivel Location within an in-process host.
  • Use bindings (e.g. wsDualHttpBinding) for which a WCF Adapter does not exist.
Not sure, Why we need other WCF adapters like WCF-NetTcp, WCF-NetMSMQ etc. Since WCF-Custom Adapter (Inprocess & Isolated) can do the job?
Only one use, I can think of , we can quickly configure other WCF adapters than the custom adapters and we don’t require to worry about any other behavior of the service. please comment if you know more reasons

Exposing BizTalk Service metadata using NetTCP in IIS

Usually the BizTalk WCF Service Publishing Wizard can expose the metadata using on HTTP Transport. Is it possible to expose in other transport mechanism? The question came to my mind, when I got an opportunity to solve a problem for one of the BizTalk Team facing for quite few days.
 
The requirement is to publish the BizTalk WCF Service metadata in IIS i.e. the actual Service should be hosted in the BizTalk and the Metadata (Address, Binding, and Contract) should be hosted in IIS. The Critical point is both have to be in the same TCP Transport protocol.
 
First, the below blog will give you step by step approach to publish the schema as service from the BizTalk application using “BizTalk WCF Service Publishing Wizard”
 
But now the problem is service and metadata endpoint are in different transport
Metadata endpoint: http://:/> (This service will be hosted by the IIS)
Service endpoint : net.tcp://:/ (This service will be hosted by the BizTalk)
After a day of analyzing various factor, I arrived the following steps to resolve the issue.
 
Step 01: Configure the receive location as mentioned in the blog
Step 02: Publish the metadata as usual BizTalk WCF Service Publishing Wizard
Step 03: In IIS (This is the changes what we have to do)
01.   Right click on the application -> Manage Application -> Advance Settings. Set the Enabled Protocol as “http,net.tcp” (Update by adding the net.tcp)
02.   Web.Config changes.
a.   Add the below configuration in the <system.serviceModel>. This will work only in .Net 4.0. Previous version does not have the capability to hold multiple binding
   <serviceHostingEnvironment >
        <baseAddressPrefixFilters>
              <addprefix="net.tcp://localhost:808"/> (check the port in the binding of the website. The port has to be same)
           </baseAddressPrefixFilters>
    </serviceHostingEnvironment>
b.      Add the new metadata endpoint as below
  <endpointname="mexTcpBinding"address="net.tcp://:/WcfServiceOneWay/Service1.svc"binding="mexTcpBinding"bindingConfiguration=""contract="IMetadataExchange" />
 
Address :  Provide the full path of the metadata service URI.alternative you can set the base address in the config
 
Now both the service and metadata endpoint are on the same transport
Service endpoint:  net.tcp:// :/(Hosted by BizTalk)
Metadata endpoint: net.tcp:// :/(Hosted by IIS)

BizTalk 2013 Beta is here ... BizTalk is not dead

Finally Microsoft have not killed the product and with strong note release the Microsoft BizTalk Server 2013 on 05-11-2012. Its an major release from Microsoft.

The question is Whether the customers are going upgrade to this 2013, Since most of the enhancement is around the cloud

Some of the key features are

  • Integration with Cloud Services – BizTalk Server 2013 Beta includes new out-of-the box adapters to send and receive messages from Windows Azure Service Bus. It also provides capabilities to transfer messages using different relay endpoints hosted on Azure.
  • RESTful services – BizTalk Server 2013 Beta provides adapters to invoke REST endpoints as well as expose BizTalk Server artifacts as a RESTful service.
  • Enhanced SharePoint adapter – Integrating with SharePoint using BizTalk Server 2013 Beta is now as simple as integrating with a file share. We have removed the need for dependency on SharePoint farms, while still providing backward compatibility.
  • SFTP adapter – BizTalk Server 2013 Beta enables sending and receiving messages from an SFTP server.
  • ESB Toolkit integration – With BizTalk Server 2013 Beta, ESB Toolkit is now fully integrated with BizTalk Server. Also, the ESB Toolkit configuration experience is vastly simplified to enable a quick setup.
  • Dependency tracking - The dependencies between artifacts can now be viewed and navigated in Admin console.
  • Improvements in dynamic send ports – BizTalk Server 2013 Beta provides the ability to set host handler per adapter, instead of always using the default send handler of the adapters



Note : The above information is taken from the download page (www.microsoft.com/en-us/download/details.aspx)