Friday, July 17, 2009
Service Configuration editor
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin [ In Vista ]
For more details
http://msdn.microsoft.com/en-us/library/ms732009.aspx
HTH
Wednesday, July 15, 2009
The type or namespace name 'DataGrid' does not exist in the namespace 'System.Windows.Controls' (are you missing an assembly reference?)
http://www.microsoft.com/downloads/details.aspx?FamilyID=084a1bb2-0078-4009-94ee-e659c6409db0&displaylang=en
Microsoft has released a patch for the system.control.data and system.control.data.design dll's
After you do this the errors will go off.
Still you may not be able to drag and drop the datagrid to the page.
To get rid do the below :
Right click the toolbox and select reset toolbox.
HTH
MJ
Monday, July 13, 2009
B.NET Web Experts Meet!
First session started off on exact time and Pooran gave a very good insight on Web services and he also talked about the job opportunities available in his company.
Lot of people where looking eagerly on Windows Live Platform. Kevin stood out for every one’s expectation. We had fun when he asked about “what people think when someone says Internet?” and when people there unanimously answered Google. A good round of laughter went around there when ever he used the G Word.
Everyone was simply blown when he explained the Windows Live Earth particularly the 3D part and showing the route info of any city. It was great to see how easy to code or bring a live earth feature into our application. Thanks Kevin for the demo.
Next came the session on Infragistics.Jason was simply amazing. He explained how better their tools are when compared with MS default controls. Infragistics Data grid control stands out with tool supporting export to excel, dragging the columns, Multi sorting and much more. We had a nice Q & A session where people gave lot of ideas to Jason by asking whether a particular feature is available with infragistics for e.g. exporting grid data’s to PDF format. I hope even Jason enjoyed the event. Of course none can forget the way he distributed the prize ball to every one in the hall.
Thanks to the B.Net Founders and Organizers for the Saturday event and Thanks to all the speakers on that day. Thanks to all the audience present there as they are very important to make any event live and enjoyable.
Looking forward for more functions like this.
How to know a user has administrative rights are not:
Open a C# Console Application and copy the below code.
[Code]
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Net.Sockets;
using System.Net.Security;
using System.Security.Principal;
namespace WindImperson
{
class Program
{
static void Main(string[] args)
{
WindowsPrincipal wndPrin = LogonUser("username", "domain", "pwd");
Console.WriteLine("Logged on {0}", wndPrin.Identity.Name);
Console.WriteLine(wndPrin.IsInRole(WindowsBuiltInRole.Administrator).ToString());
}
public static WindowsPrincipal LogonUser(string userName, string domain, string password)
{
TcpListener tcpListener = new TcpListener(IPAddress.Loopback, 0);
tcpListener.Start();
WindowsIdentity id = null;
tcpListener.BeginAcceptTcpClient(delegate(IAsyncResult asyncResult)
{
using (NegotiateStream serverSide = new NegotiateStream(
tcpListener.EndAcceptTcpClient(asyncResult).GetStream()))
{
serverSide.AuthenticateAsServer(CredentialCache.DefaultNetworkCredentials,
ProtectionLevel.None, TokenImpersonationLevel.Impersonation);
id = (WindowsIdentity)serverSide.RemoteIdentity;
}
}, null);
using (NegotiateStream clientSide = new NegotiateStream(new TcpClient("localhost",
((IPEndPoint)tcpListener.LocalEndpoint).Port).GetStream()))
{
clientSide.AuthenticateAsClient(new NetworkCredential(userName, password, domain),
"", ProtectionLevel.None, TokenImpersonationLevel.Impersonation);
}
return new WindowsPrincipal(id);
}
}
}
[/ Code]
XAML PART I
e.g.
<Button Content = “ZAMMEL is XAML” />
In the above example Button element object directly relates to Button class of WPF.
When you specify an object element tag, you are instructing the XAML loader to create new instance of the named class when your XAML page is either compiled or interpreted.
Note:
If the user wants any class as an object element in XAML, the class must have a public parameterless constructor.
Property Setting Syntax:
Setting Properties in XAML can be done using a variety of syntaxes. Properties can be provided in the form of attributes also. In the Button example Content is a property which is represented as an xml attribute. All the properties cannot be expressed as attribute. We have another syntax called Property element syntax. Syntax is
e.g.
<Button Content="I am XAML" >
<Button.Background >
<SolidColorBrush Color="Aqua"/>
</Button.Background >
</Button>
Here content is represented as attribute syntax and Background is represented as Property element syntax.
Markup extensions are another property writing syntax which is useful when you want to return existing instance. {&} represents markup extensions.
E.g. Binding Markup extension; StaticResource Markup extension.
<Window.Resources>
<local:TestProp x:Key="tp1" />
</Window.Resources >
<TextBox Height="26" Margin="84,75,108,0" Name="textBox1" VerticalAlignment="Top"
Text="{Binding Path=MyColor,Source={StaticResource tp1}}" />
In this case it returns a reference to the MyColor Property that was previously instantiated as a keyed resource in resource dictionary.
Summary:
XAML files are xml files with .XAML extension we can specify the properties as Attribute Syntax, Property Object Element Syntax and Markup extensions.
XAML PART II Contd..
1.
XAML doesn’t allow us to split the content property. It should be continuous.
For example the following is illegal and will not compile.
<Button>
<Button.Content>Hello</Button.content> <Button.content>World<button.content>
</Button>
2.
XAML is case sensitive. All the Object elements, Property Elements and attribute names are case sensitive.
Values of the attributes are not always case sensitve. For example
<button content="HelloWorld" background="green"/>
It depends upon the type-converter behaviour associated with the property that takes the value. In the above example Background=”Green” or “green” is OK
3.
XAML ignores all nonsignificant whitespaces. Spaces will be considered if it’s in content property.
<button content=" HelloWorld" margin="26,59,0,0" background=" aqua " width="90" verticalalignment="Top" horizontalalignment="Left" height="21"/>
If you notice the above example the space surrounding “aqua” will be trimmed whereas space in front of “ Helloworld” will be considered.
4.
XAML files must have only one root element. It should be a well formed XML file and a valid XAML file
How to write inline coding in XAML:
We can write the code either in code behind page or inline. Code behind is recommended as definitely it’s advantageous.
To write an inline code in XAML we have to use x:Code directive along with
<button content="Hello" click="SayHello">
</button>
<x:code>
<![CDATA[
void SayHello (object sender, RoutedEventArgs e)
{
MessageBox.Show("Hello");
SayMorning();
}
void SayMorning (){
MessageBox.Show("Good Morning");
}
]]>
</x:code>
BizTalk Interview Questions
1. What is property promotion?
2. What is distinguished Field?
3. What are persistence points?
4. What are the adapters you have worked?
5. What are the challenges you have faced using Soap Adapter?
6. Can you use excel file in File Adapter?
7. Difference between Content Based Routing and Orchestration?
8. What are the communication patterns available in BizTalk?
9. What are the available message types?
10. What is debatching in BizTalk?
11. What is XPath? Benefits?
12. How will you specify delimiters for Flat File?
List of Interview Questions Sites:
http://groups.msn.com/bug-i/biztalkinterviewquestions.msnw
http://www.codeproject.com/useritems/BizTalkInterviewQuestions.asp
http://geekswithblogs.net/sthomas/archive/2005/12/29/64404.aspx
http://biztalkers.blogspot.com/2005/01/biztalk-interview-questions.html
http://www.topxml.com/forum/BizTalk_Interview_Questions/m_3153/tm.htm
http://www.topxml.com/rbnews/BizTalk%20Functoids/re-20587_Biztalk-Server-Interview-Questions.aspx
http://dotnetslackers.com/BizTalk/re-16764_Biztalk_Server_Interview_Questions.aspx
http://biztalkbits.blogspot.com/2005/03/biztalk-2004-interview-questions.html
Distinguished Fields vs Promoted Properties
Distinguished Fields | Promoted Properties |
Available within a single Orchestration instance and Not available to Receive location/Send Ports/SendPort Grps | Available for all BTS objects |
Fields can have any length | Fields can have max of 255 chars |
Less Performance impact as nothing is stored in MessageBox Database. | Uses MessageBox Database hence lesser performance |
Referred as MessageName.RecordName.ChildRecordName | Promoted properties are referred as MessageName(PropertyShemaName.PromotedPropertyName |
Tips :
We know that promoted properties are available to all BTS Objects. In case we want to restrict some valueable properties being available in HAT and BAM , Go to PropertySchema -> Select the property and Set Sensitive Information = yes for that particular property.
Read MSMQ through C# Application
Consider that we have a private queue named “Biztalk” and we receive an xml message in that queue. Now to read this xml in our .net application we need to follow the following code snippets :
Step 1: Create a C# Application
Step 2: refer System.Messaging.dll
Step 3: Copy the following code snippet and paste in the place you require
[ Code Snippet ]
// General Queue Path Format : FORMATNAME:DIRECT=OS:[SystemName]\PRIVATE$\[QueueName]
System.Messaging.MessageQueue MyQueue = new System.Messaging.MessageQueue([QueuePath]);
//Since we are receiving xmldocument we have to specify type as XMLDocument
MyQueue.Formatter =
new System.Messaging.XmlMessageFormatter(new Type[] { typeof(XmlDocument) });
System.Messaging.Message MyMsg = MyQueue.Receive;
//Now convert the message to our requirement
System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
xmlDoc = (XmlDocument) MyMsg.Body;
xmlDoc.Save(@"d:\[filename].xml");
[/ Code Snippet ]
Step 4: Run the application and find the resulting xml file in the place you have specified.
Recoverable Process Interchange
Take for instance we have multiple messages bundled together and sent as one single unit. Now if one message fails in a bundle of 5 the entire messages will fail. In BTS 2006 we can avoid this using Recoverable Interchange Processing. This is simple but powerful. If one message fails in a bundle of five rest 4 will be delivered in this case. How is that? Kewl isn’t it?
What is Failed Message Routing?
BTS 2006 allows us to subscribe for failed messages which was not available in previous versions
I will use a small example to understand the above concept. Please follow the above steps carefully.
1. Create a Biztalk Project “RecoverAndFailedRouting”
2. Add a schema “OrderEnvelope.xsd”
3. Change the root node “Orders”
4. Add a child record “Order”
5. Add any element to the “Order” Record
Configure the above schema to envelope schema
1. Select the Schema node set Envelope -> Yes
2. Select the root node “Orders” goto -> BodyXpath
3. Select the node which will contain your body schema. In this case it should be “Orders” as it contains the “Order”
4. Save the schema
Create Body Schema
1. Add a new schema “Order.xsd”
2. Change the root node “Order”
3. Add a child element “OrderID”
4. Add a child element “City”
5. Save the Schema
Create a Receive Pipeline
1. Add a new receivepipeline “RecvEnvelope.btp”
2. Add a XmlDissassembler in the disassemble portion of pipeline
3. Set document schema to “Order.xsd”
4. Set the envelope schema to “OrderEnvelope.xsd”
5. Set Validate Document Structure and Recoverable Interchange to true
6. Save all
General
1. Add the .snk file to the project
2. Select solution ->configuration->check deploy
3. Select project->configuratrion->Deployment->Give an application name
4. Deploy the solution
Administration
1. Open the BTS Admin Console
2. Expand the Group and then expand the Application
3. Select the deployed application
4. Create a new receive port a) Pipeline -> RecvEnvelope.btp b) Adapter -> File c) specify File path
5. Create a new send port “SuccessFulMessages” a)Adapter ->File b)Specify Filepath c)Go to Filters -> Add BTS.ReceivePortName = name of the receive port created
6. Create a new send port “FailedMessages” a)Adapter ->File b)Specify Filepath c)Go to Filters -> Add ErrorReport.ErrorType = “FailedMessage” Note : don’t use quotes while filling
7. Start the application
Testing the application
1. Drop the i/p file to receive folder
2. Check all messages
3. if there is an error in any one of the message in the bundle that will be sent to “FailedMessages” folder.
I/p message format : [ All Success ]
<ns0:Orders xmlns:ns0="http://FailRouter.OrderEnvelope">
<ns0:Order xmlns:ns0="http://FailRouter.Order">
<OrderID>OrderID_1</OrderID>
<City>City_0</City>
</ns0:Order>
<ns0:Order xmlns:ns0="http://FailRouter.Order">
<OrderID>OrderID_2</OrderID>
<City>City_0</City>
</ns0:Order>
<ns0:Order xmlns:ns0="http://FailRouter.Order">
<Order>OrderID_3</Order>
<City>City_0</City>
</ns0:Order>
</ns0:Orders>
I/p message format : [ Second One Fails ]
<ns0:Orders xmlns:ns0="http://FailRouter.OrderEnvelope">
<ns0:Order xmlns:ns0="http://FailRouter.Order">
<OrderID>OrderID_1</OrderID>
<City>City_0</City>
</ns0:Order>
<ns0:Ordered xmlns:ns0="http://FailRouter.Order">
<OrderID>OrderID_2</OrderID>
<City>City_0</City>
</ns0:Ordered>
<ns0:Order xmlns:ns0="http://FailRouter.Order">
<Order>OrderID_3</Order>
<City>City_0</City>
</ns0:Order>
</ns0:Orders>
Message Construction inside Orchestration
2. Add a construct shape with message assignment to the orchestration
3. Set the Message Constructed property
4. Inside the Message Assignment, Use the xmldocument variable as shown in the below example
varXMLDom.LoadXml(@"<ns0:OrderInfo xmlns:ns0=""http:// Construction.OrderInfo"">
<A>1</A>
<B>2</B>
<C>3</C>
</ns0: OrderInfo >");
Msg1 = varXMLDom;
5. Now you are ready to send the Msg1 to the send port.
HTH
Export data from datagrid to excel
Response.Buffer= true;
Response.AddHeader("content-disposition", "attachment;filename=Filename.xls"); Response.Charset = "";
Response.ContentType = "application/vnd.ms-excel"; // if you change the type to text/xml, you can export the data to xml file
this.EnableViewState = false;
// if you want to add the header for excel report, you can achieve through the following code
objStringWriter.WriteLine("Title for Excel if required");
System.Web.UI.HtmlTextWriter(objStringWriter);
YourDataGrid.RenderControl(objHtmlTextWriter);
Response.Write(objStringWriter.ToString());
Response.End();
HTH
Connecting SAP to .Net
1. After installing VS.Net Studio 1.1 , Install latest JVM
2. Install SAP .Net Connector 2.0
[/Prerequisites]
1. Open a new Web Application
2. Select -> Add new item -> SAP Connector Proxy
3. Open Server Explorer -> Select Application Server under SAP
4. Right Click it -> Select Add Application Server
5. Provide the SAP Credentials.
Example : Destination Type : Custom Logon Settings;Username:****;Password:****:AppServerHost:[IP Addr];SystemNumber:0;client:335
6. Once Connected, Select the SAP Server -> right click Functions -> Add Filter. Example : ZBAPI*
7. It will list all the corresponding BAPI’s inside the filter.
8. Now drag and drop the required BAPI from the filter to sapproxy.sapwsdl
9. Build the application. It will generate the SAP code automatically.
10. Open the Web form where you need to display the data.
11. Open ToolBox -> Drag and Drop SAP Table Wizard to the WebForm.
12. Now add the structure and BAPIReturn to the web form
13. Now connection code is as follows
[Code]
DataSet dsSapData = new DataSet();
public Sap_Proxies.SAP_Proxy objProxy = new Sap_Proxies.SAP_Proxy();
objProxy.ConnectionString = ConfigurationSettings.AppSettings["sapConn"].ToString();
objProxy.Connection.Open();
objProxy.YourBAPI(param1,param2,.....);
dsSapData.Tables.Add(yourbapitable.ToADODataTable());
[/Code]
14. Now bind the Dataset to Datagrid as follows
[Code]
YourDataGrid.DataSource = dsSapData;
YourDataGrid.DataBind();
[/Code]
Avoid print button while printing
2.
.asp_PrintButton
{
display:none;
}
3. <link type="text/css" media="print" href="print.css" rel="stylesheet">
4. <asp:Button id="Button1" CssClass="asp_PrintButton" runat="server"
Text ="Print">
HTH
Delivery Notification in BizTalk
a) Turn the delivery Notification property of Send Port from None to transmitted.
b) Catch the DeliveryNotificationException using xlang and divert it to different folder as required.
Microsoft.XLANGs.BaseTypes.DeliveryFailureException
To achieve this use a scope and set it’s transaction as None. Add an exception handler and catch the above exception.
HTH
Dynamic File Adapter
a) Create a send port of type dynamic
b) Before calling the send shape use an expression and enter the following code:
SendPortName(Microsoft .XLANGs.BaseTypes.Address) = “FILE://[Path]/Message.Xml”
Or
SendPortName(Microsoft .XLANGs.BaseTypes.Address) = “FILE://[Path]/” + Message.Destination + “/Message.Xml”
Message.Destination – Promoted Property of incoming message which holds the path
Publishing Orchestration as WebService
2. Add a request-response port and attach receive to request and send to response part of the port
3. After finishing the orchestration process build and deploy the orchestration to GAC [ Creation of strong name is must ]
4. Open Tools -> Biztalk Web services Publishing Wizard
5. Select Publish Biztalk orchestrations as web services
6. Select the orchestration dll
7. Provide the required target namespace and select project location in the coming wizards and then press create.
8. Go to biztalk explorer, select the orchestration -> Bind the port to webservice port that was created automatically.
Configuring SQLAdapter
We can configure SQL adapter in two ways:1) Receive2) Send
Receive Adapter:
We can use this to extract data from SQL SERVER. This receives data from SQLSERVER. Therefore only select and stored procedure is available.
Restrictions:
1. This adapter can be bound to one-way receive ports2. Supports only select statements3. we cannot return more than one result sets using stored procedures.
Send Adapter:
We can use this adapter to enrich the incoming content by getting the remaining data from SQLSERVER.
We can insert, update and delete data from the tables. We can parameterize and the parameter value dynamically. It can be bound to one-way or two-way solicit response.
General Structure of XSD files:<rootelementname><sync><before><nameoftable fieldname1="’FieldValue1’" fieldname2="’FieldValue2’"></before><after><nameoftable fieldname1="’FieldValue1’" fieldname2="’FieldValue2’"></after></sync></rootelementname>
Insert operations will have only
How to add the structure and configure SQL Adapter:
Adding:
1. Right click the Biztalk project and select add generated items2. Select add adapter.3. Select the sql adapter4. Click next and set the sqlserver connection string5. Check next and fill up the target namespace and root element name.6. Select between the receive and send adapter of SQL.7. Kindly notice that when you select receive, you will be asked to provide document root element name whereas when you select send, you will be asked to provide request root element name and response element name.
Note: Same name cannot be provided for request and response.
8. Click next and select the type of statement [updategram/storedprocedure].9. If you are selecting stored procedure, select the stored procedure and finish.10. If you are selecting update gram, choose the option between insert/delete/update and finish.
11. Now you can see an orchestration and xsd file.
Configuring:
1. Open the Biztalk Explorer2. Add the receive port and add a receive location3. Select the transport type as SQL4. Select the receive handler and receive pipeline5. You can configure the polling gap by seconds, minutes and hours by selecting polling unit of measure6. You can also specify the polling interval7. Set the connection string8. Enter the document root element name and target namespaceClick on SQL Command ellipse and select the project and schema. You can select only if you have deployed it already.
Tips:
You have forgotten the root element name and namespace. How to retrieve that?Instead of entering the document root element name and target namespace, go and select the project and schema through the SQL Command ellipse.
Sample Stored Procedure creation
CREATE PROCEDURE [SP_GetPODetails] @ID char (1) ASSELECT * FROM Purchase Details where OrderID = @ID for xml auto, xmldataGO
Xml auto:
To provide the result in xml format. This will return table name as the element name and all the columns as its attributes.
<Orders OrderID=”ORD1” Category = “Electronics” /><Orders OrderID=”ORD2” Category = “Hardware” />
Xml auto, elements:
This will provide the result set as a xml with table name as element and columns as child elements
<orders><orderid>ORD1</orderid><category>Electronics</category><orders>
XmlData:
XML DATA is used to generate the information required by SQLADAPTER
Important Note: Once the SQL SCHEMA is generated, remove the xmldata immediately.
Tips:
Are you getting the following error?
The reason is the query you are trying to add in not having XML AUTO |
Biztalk Install / Uninstall
http://go.microsoft.com/fwlink/?LinkId=81041
n'joy
How to debug .Net component called within Orchestration
1. Deploy the .Net component in Debug mode
2. Attach BTSNTSvc.exe to the .Net component by selecting Debug Menu - > Processes -> BtsNTSVC.exe.Make sure you are attaching right instance.
That's it and if it's a file drop, drop a file and you will the yellow highlight in the .Net Component
Hope this helps
Could not store transport type data for Primary Transport
Failed updating binding information. BindingException: Could not store transport type data for Primary Transport of Send Port 'SendPort for success folder' to config store. Primary SSO Server 'BIZTALK' failed. Cannot perform encryption because the secret is not available from the master secret server. See the event log for related errors
try out the below :
1) Go to run -> CMD2) go to <% Installation Drive %>/Program Files/Common Files/Enterprise Single Sign On3) type : ssoconfig -generatesecret d:\ssobkup.bak4)It will ask for password and reminder question
Now you have created the SSO password. You need to restore this password1)ssoconfig -restoresecret d:\ssobkup.bak
That's it.
HTH
Get Virtual Dir Path of WebApplication
Hope this helps
Regex - remove special char
Hope this helps
Microsoft OLE DB Provider for Oracle error '80004005'
Oracle client and networking components were not found. These components are supplied by Oracle Corporation and are part of the Oracle Version 7.3.3 or later client software installation. Provider is unable to function until these components are installed.
I got into this error while running a webservice which calls a stored proc in oracle database.
Solution :
ADD the following users to ora92 folder.
Hope this helps
No entries found in ServiceReferences.ClientConfig
When we tried to add service reference to a silverlight application, we will get an error w.r.t endpoint address.
When you cross check client config, you will see no entries there. Only thing you will find is
Solution :
Go to the config file of WCF. Change the binding from wsHttpBinding to basicHttpBindingRemove the old referenceAdd newly.
Hope this helps