Friday, June 28, 2013

No valid adapters installed on the machine.

Now I am working on a project which needs to use WCF-SQL adapter so that the BizTalk Server 2010 application can  communicate with SQL 2008 .

So the first thing was to create required tables and stored procedures, adding relationship – done with no problem.

Now it was time to use “Add Adapter Metadata” and this is where I got error                                                                                   “No valid adapters installed on the machine.


Whoa!!!! Now what? I checked the machine , all was configured properly .

Had both of them installed:
1.       WCF LOB Adapter SDK
2.       WCF-SQL adapter

So what’s the problem? The problem lies in the “machine.config” file , which can be located at :
         “C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config"

If you go through the config file , you won’t find entries for SQL :

<bindingElementExtensions>
<add name="webMessageEncoding" type="System.ServiceModel.Configuration.WebMessageEncodingElement, System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="context" type="System.ServiceModel.Configuration.ContextBindingElementExtensionElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<add name="byteStreamMessageEncoding" type="System.ServiceModel.Configuration.ByteStreamMessageEncodingElement, System.ServiceModel.Channels, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="discoveryClient" type="System.ServiceModel.Discovery.Configuration.DiscoveryClientElement, System.ServiceModel.Discovery, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</bindingElementExtensions>
<bindingExtensions>
<add name="wsHttpContextBinding" type="System.ServiceModel.Configuration.WSHttpContextBindingCollectionElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<add name="netTcpContextBinding" type="System.ServiceModel.Configuration.NetTcpContextBindingCollectionElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<add name="webHttpBinding" type="System.ServiceModel.Configuration.WebHttpBindingCollectionElement, System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="basicHttpContextBinding" type="System.ServiceModel.Configuration.BasicHttpContextBindingCollectionElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
</bindingExtensions>
</extensions>
<client>
<metadata>
<policyImporters>
<extension type="System.ServiceModel.Channels.ContextBindingElementImporter, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"/>
</policyImporters>
<wsdlImporters>
<extension type="System.ServiceModel.Channels.ContextBindingElementImporter, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"/>
</wsdlImporters>
</metadata>
</client> 


So there was no entry made in it, I went ahead and added entries for SQL(marked in red):

<behaviorExtensions>
<add name="persistenceProvider" type="System.ServiceModel.Configuration.PersistenceProviderElement, System.WorkflowServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
.
                                .
                                .
<add name="sqlAdapterInboundTransactionBehavior" type="Microsoft.Adapters.Sql.SqlAdapterInboundTransactionBehavior, Microsoft.Adapters.Sql, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</behaviorExtensions>
<bindingElementExtensions>
<add name="webMessageEncoding" type="System.ServiceModel.Configuration.WebMessageEncodingElement, System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="sqlAdapter" type="Microsoft.Adapters.Sql.SqlAdapterBindingElementExtensionElement, Microsoft.Adapters.Sql, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</bindingElementExtensions>
<bindingExtensions>
<add name="wsHttpContextBinding" type="System.ServiceModel.Configuration.WSHttpContextBindingCollectionElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<add name="sqlBinding" type="Microsoft.Adapters.Sql.SqlAdapterBindingCollectionElement, Microsoft.Adapters.Sql, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</bindingExtensions>
</extensions>
<client>
   <endpoint binding="sqlBinding" contract="IMetadataExchange" name="mssql" />
<metadata>
<policyImporters>
<extension type="System.ServiceModel.Channels.ContextBindingElementImporter, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"/>
</policyImporters>
<wsdlImporters>
<extension type="System.ServiceModel.Channels.ContextBindingElementImporter, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"/>
</wsdlImporters>
</metadata>
</client>

Now the question is where did I found this ? It was here (below):

C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config

Will keep on posting as an when I find something to share!!!!!!!!!!!!


Can We Have Custom Data Type


Well I got this question when I had to have data in some specific pattern.

A very common field is email address where we want it in particular and valid pattern, e.g., “myemail@mydomain.com”

So here is the pattern I used :   \w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*

In my case along with the email field  it was the field called “fileExtension”, and the only extension which was valid as per requirement where  .txt , .pdf , .xsl ,.xslx,.doc and .docx  etc.

So here is the pattern I used : ^.*\.(txt|TXT|xsl|XSL|xslx|XSLX|doc|DOC|docx|DOCX|pdf|PDF)$

Note: 

You can add other extensions too if you need it, in my case above mentioned ones were the only required.

Steps to make it happen (Here I am using email as example):

1.      Open the schema in BizTalk Schema Editor
2.      Select the element on  which you want to set the desired data pattern
3.      Go to properties window.
4.      Set the Base Data type as xs:string
5.      Set the ‘Derived By’ property to ‘Restriction’.
6.      Select ‘Pattern’ property and click the ellipsis
7.      Type the regular expression(s) in the ‘Pattern’ property








8.      I had element under other records in same schema which will have email as value, thus I wanted to have same pattern included for those also.

9.      Did following:

i. I added text “emailType” on the property filed “ Data_type” and this creates  new simple type.

ii. I used on all the other elements on which you want same validation or want it to have data in same      form then select its base data type as "emailType"

10.      In below figure , I am using “emailType” as Data Type. (AddLine2 is used for holding secondary email)





11.      All done but does it really work? I tested with passing a instance having incorrect email id:
       
As expected , it erred out:

error BEC2004: The 'Email' element is invalid - The value 'myemailgmail.com' is invalid according to its datatype 'http://Process_Schemas.CommonAddress:emailType' - The Pattern constraint failed.
error BEC2004: Validate Instance failed for schema CommonAddress.xsd, file:

12.      When tried with correct email, it was success:

Invoking component...
Validate Instance succeeded for schema CommonAddress.xsd, file:       <file:///D:\Biztalk\MyProjects\Process\addressSampleInstance.xml>.
Component invocation succeeded.



So this is how I was able to create custom data type “emailType” and did follow same for the other custom data type “extensionType”.

Monday, June 24, 2013

There are no orchestrations with public receive ports in this BizTalk assembly


Error while making orchestration as web service


This happens when you try to publish your Orchestration as a web service and none of the ports used in the Orchestration are set as Public. i.e. none of the ports are available which can be exposed as service.

Friday, June 21, 2013

Creating project "BizTalk project name"






Couple of years ago from now when I started working with BizTalk 2009. I was very excited and wanted to dig in more and more .
So I started with creating a BizTalk project in Visual Studio 2008, going through the Tutorials and following the instructions.

I successfully completed the tutorials(It is a big Achievement for a starter... :) ). Now it was time to try something on my own.

But that day I got error "Creating project ‘BizTalk project name’… project creation failed." --- Now this was a big issue for me!!!!

After some looking here and there(Google) I found the reason. The culprit was updates which had successfully done the other night.

Below is the link which acted as Saviour then  :)

http://msdn.microsoft.com/en-us/library/ee449462(v=bts.10).aspx