Monday 5 June 2017

Read XPath value from XML file

Reading xpath value from XML file 

As stated above  its easy way to read the xpath query using XMLreader and XPATHDocument;
Below is the sample code 


using System.Xml;
using System.Xml.XPath;

private string ReadXpath(string xmlFilePath , string xPath)
        {
            string xpathValue="";

            XmlReader reader = XmlReader.Create(xmlFilePath);

               if (reader.Read())
                {
                    XPathDocument xPathDoc = new XPathDocument(reader);
                    XPathNavigator xNavigator = xPathDoc.CreateNavigator();
                    XPathNodeIterator xNodes = xNavigator.Select(xPath);

                    if (xNodes.Count != 0 && xNodes.MoveNext())
                    {
                        xpathValue = xNodes.Current.Value;
                    }
                }

            return xpathValue;
        }

Wednesday 22 March 2017

BizTalk RuleEnginer Unable to deploy - Associated with the deployment driver does not match the database

BizTalk Rule Composer does not allow me to deploy a Policy and throwing an error  "Associated with the deployment driver does not match the database".

I am sure I have used the correct database Alias name while Configuring the BizTalk. Unfortunately some unknown reason BizTalk configuration did not store the Rule Engine Server details and Database name at Management Database. 
This would be a potential issue while you are deploying the Policy using Rule Composer and would throw below error.


Solution : Open Admin_Group table from Management database and Update the RuleEnginerDatbaseName and RuleEnginerDBName buy running Update Query script.



Drop a comment if this article helps you. you can reach me @ raj.webjunky@yahoo.com

Wednesday 11 May 2016

BizTalk PortBindingMaster file - Password as Configurable key

BizTalk  PortBinding Master file - Password  as  Configurable key.

I knew its old technique but I just want to blog it for quick reference.






Drop a comment if this article helps you. you can reach me @ raj.webjunky@yahoo.com

Monday 11 January 2016

Site Visitors


I am delighted to say my Blog visitors head count has been dramatically increased from 10K+  to 30K+.

Thanks all readers who likes to view my Blog.

Raj.webjunky

BizTalk XSD- Import multiple schema's with same TargetNamespace


BizTalk  XSD Schema does not allow you to Import more then one schema which has same TargetNameSpace.

There are some situation you might need to reuse the existing schema's without re-creating the same structure with another set of Target namespace.
Wonder if you ever tried to add same targetnamespace schema using VisualStudio BizTalk Project.

Here is the error message you would get it

The namespace of the schema you are trying to add clashes with one of the namespaces already declared. Please choose another Schema.





Here is the alternate way of adding multiple schema's with one unique Target Namespace.

1. Select Schema which you would like to import and find "Fully Qualified Name"
    in my Solution I have a Project called "PublishSchemaTest.Common" which has common Schemas.
   And my Fully Qualified Name is "PublishSchemaTest.Common.CommonTypes"

2. Find Schema Target NameSpace in my case it is "http://www.rajwebjunky.com/Common//Types".

3. Add your Common schema project reference
4. Now Open the Schema which you prefer to import the CommonTypes

My OrderMaster XML Edit mode looks like below.





4. Add Import Schema manually 




5. Save the File and open in BizTalk Editor Mode . Now you would be able refer the schema at "Data Structure Type"



Drop a comment if this article helps you. you can reach me @ raj.webjunky@yahoo.com



Thursday 31 December 2015

BizTalk Published Service SingleWSDL -schemaLocation is missing , Cannot import wsdl:portType

Error: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error: The required attribute 'schemaLocation' is missing.

I have been publishing number WCF services using BizTalk Schema's  and I never encountered any issues when end client generating a proxy class using  direct service url  or singlewsdl url.

Recently one  of my client had an issue with service which I recently published. I was really skeptical about the issue and I was keep asking him to try different ways, in fact I requested to use new .net SDK to use it.


after course of attempts I realized that service was throwing an unknown error as below


Attempting to download metadata from 'http://ccrsd027.stl.int/PublishSchemaTestService/PublishTest.svc?singleWsdl' using WS-Metadata Exchange or DISCO.
Error: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error: The required attribute 'schemaLocation' is missing.XPath to Error Source: //wsdl:definitions[@targetNamespace='http://PublishSchema.Test/']/wsdl:portType[@name='PublishTest']


Error: Cannot import wsdl:binding
Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on.
XPath to wsdl:portType: //wsdl:definitions[@targetNamespace='http://PublishSchema.Test/']/wsdl:portType[@name='PublishTest']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://PublishSchema.Test/']/wsdl:binding[@name='WSHttpBinding_ITwoWayAsync']


Error: Cannot import wsdl:port
Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on.
XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='http://PublishSchema.Test/']/wsdl:binding[@name='WSHttpBinding_ITwoWayAsync']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://PublishSchema.Test/']/wsdl:service[@name='BizTalkServiceInstance']/wsdl:port[@name='WSHttpBin
ding_ITwoWayAsync']


Generating files...
Warning: No code was generated.
If you were trying to generate a client, this could be because the metadata documents did not contain any valid contracts or services
or because all contracts/services were discovered to exist in /reference assemblies. Verify that you passed all the metadata documents to the tool.

Warning: If you would like to generate data contracts from schemas make sure touse the /dataContractOnly option.


The root cause of the above problem was I had a Common Types schema which I included for my Generic complex types schema

When you Generate a SingleWSDL SVCUTIL tool generates a single WSDL File which includes all referenced schema's. however the Included schema's does not work when you generate a Proxy class using SvcUtil.exe.

The Fix is very simple:
Generate a Single WSDL file and open in Note pad (NotePad++) and identify a schema which you originally included a schema and simply Delete the auto generated empty include node 

and save the wsdl and try SvcUtil.exe "UpdatedSinglewsdl.wsdl"
Drop a comment if this article helps you. you can reach me @ raj.webjunky@yahoo.com

Tuesday 15 September 2015

BizTalk SSO Manager A new Tool to manage your SSO settings

BizTalk SSO Manager Tool :

Aim : Aim to Create a new SSO application without  deploying your BizTalk solution and also manage your existing settings or add new configuration values for existing deployed interface.

Background : If you deploy a BizTalk interface in any environment with SSO enable ) 
True )
at you BDDF project , it would eventually deploy the solution and publish your environment settings to SSO. This is great option in BTDF. However it is quite hard to manage the settings in case of any changes like Add / Delete new entry , Delete Complete SSO settings without un-deploying the BizTalk interface or event Create a New SSO Application without deploying BizTalk interface.


This tool would be a best solution for you play. 

Screen1a : When you run the tool by default it loads the applications which are deploying using BTDF. 


Screen1b :  You can add new Row / update existing row.

Screen2 : You are in free hand to create a Brand new Application without deploying a BizTalk interface


Screen3 : You can even Delete complete SSO settings without un-deploying a BizTalk interface


Drop a comment if this article helps you. you can reach me @ raj.webjunky@yahoo.com
If you wish to download the code drop your comments.