Saturday, December 12, 2009
Uploading File to Document Library Using ASP.Net
2. [Code Behind ]
using (SPSite site = new SPSite("YourSite"))
{
using (SPWeb web = site.OpenWeb())
{
SPFolder folder = web.GetFolder(YourDocumentLibrary);
SPFileCollection files = folder.Files;
FileStream fStream = File.OpenRead(OfflineUploadCtrl.PostedFile.FileName);
byte[] contents = new byte[fStream.Length];
fStream.Read(contents, 0, (int)fStream.Length);
fStream.Close();
Hashtable MetaDataTable = new Hashtable();
MetaDataTable.Add("Comments", "MyFirstUpload");
SPFile currentFile = files.Add(YourDocLibraryPath + OfflineUploadCtrl.FileName, contents, MetaDataTable, true);
}
}
3. UI Code
<asp:FileUpload ID="OfflineUploadCtrl" runat="server" />
<asp:Button ID="UploadButton" runat="server" Text="Upload"
onclick="UploadButton_Click" />
Steps to create and deploy a custom web part using Asp.Net in Office Server 2007
Office Server 2007 provides lot of out-of-box web parts to make development very easy to most of the scenarios. Still we may need to do some tailor-made solutions to meet our customer demands. We are going to see here how to create a custom web part and deploy the web part in our site and use it. Since the task of creation and deployment is important more than the sample it is up to the reader to put his own thoughts to that.
Web Part Creation
1. Create a web application
2. Add a user control to the web application
3. Add reference to Microsoft.Sharepoint.dll to the web application
4. Add a class file and do as mentioned below
[Code]
using System;
using System.Web.UI;
namespace YourNameSpace
{
public class YourClassName:Microsoft.SharePoint.WebPartPages.WebPart
{
#region "Global variable declarations"
protected Control _control = null;
protected string _exception = String.Empty;
//This UserControls is a folder in the VirtualServer
//directory of your Sharepoint WebApplication.
//We have to create this folder in the VirtualServer
//directory and copy the UserControl at that location
protected string UserControlPath = @"~/UserControls/";
protected string UserControlFileName = @"YourUserControl.ascx";
#endregion
#region "Create Child Controls method to create the controls for the webpart"
protected override void CreateChildControls()
{
try
{
_control = this.Page.LoadControl(UserControlPath + UserControlFileName);
this.Controls.Add(_control);
}
catch (Exception ex)
{
_exception += "CREATE ERROR:" + ex.Message;
}
finally
{
base.CreateChildControls();
}
}
#endregion
#region "RenderControls method , to render the controls inside the webpart class"
protected override void RenderContents(HtmlTextWriter writer)
{
try
{
base.RenderContents(writer);
}
catch (Exception ex)
{
_exception += "RENDER ERROR:" + ex.Message;
}
}
#endregion
}
}
[/Code]
5. Go to Solution Explorer -> Properties - > Assembly and add the following line as last
[assembly:System.Security.AllowPartiallyTrustedCallers]
6. Create an xml file with the name Manifest and add the following stuff
Change the SolutionId with a new GUID
7. Add a new file to the application with the name somename.ddf and add the following conent
;*** SharePoint Features Example MakeCAB Directive file
;
.OPTION EXPLICIT ; Generate errors
.Set CabinetNameTemplate=YourWSP.wsp
.set DiskDirectoryTemplate=CDROM ; All cabinets go in a single directory
.Set CompressionType=MSZIP ;** All files are compressed in cabinet files
.Set UniqueFiles="OFF"
.Set Cabinet=on
.Set DiskDirectory1=WSPFolder
;
; ** CAB Root
Manifest.xml
bin\YourWebApp.dll
;
;*** End
8. Add makecab.exe to the application
9. Open the command Prompt and execute the following
Makecab.exe –f Yourname.ddf
Web Part Deployment
10. For convenience open one more command prompt and execute the following
Stsadm –o addsolution filename [Your WSP Path ]\YourName.wsp
Changedirectory to C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN
11. Go to Central Admin - > Operation - > Solution Management and follow the steps
Using the Web Part in the Site
12. Go to the site where you have deployed the webpart. Click SiteActions -> Modify all settings
13. Click Webparts [ in the gallery section]
14. In the webpart gallery -> select new -> select your webpart and click populate gallery.
15. Go to the page where you want to add the webpart.
16. Click SiteActions / Edit Page
17. Click the Add Webpart - > find your webpart in Mics zone and add.
There are two more things we need to do :
1. Go the site virtual directory and open the web.config file
And change the trust level from minimal to full
2. Create a new folder in the site virtual directory with the name what you have provided in the Step 4 and add your ascx file to this folder.
That’s it . You are good to go with your new web part
Friday, October 30, 2009
Optional Last field in BizTalk Schema
There may be situations where in the last field in your schema may or may not be available. When we generate a schema for this kind some times it will show "Unexpected token found....."
To avoid the same we can try this.
1. Go to your schema
2. Select the last field which may be optional
3. Set min occurs = 0
HTH
Thursday, October 8, 2009
Generate Sequence number using Mapper
This is very simple
1. Drag and Drop Iteration functoid to the mapper.
2. Connect the record header to the functoid as input
3. Connect the result schema sequence number element to the functoid.
That's it
MJ
Thursday, August 27, 2009
The application domain or application pool is currently running version 4.0 or later of the .NET Framework. This can occur if IIS settings have been set to 4.0 or later for this Web application
Error :
“The application domain or application pool is currently running version 4.0 or later of the .NET Framework. This can occur if IIS settings have been set to 4.0 or later for this Web application, or if you are using version 4.0 or later of the ASP.NET Web Development Server. The <compilation> element in the Web.config file for this Web application does not contain the required 'targetFrameworkMoniker' attribute for this version of the .NET Framework (for example, '<compilation targetFrameworkMoniker=".NETFramework,Version=v4.0">'). Update the Web.config file with this attribute, or configure the Web application to use a different version of the .NET Framework.”
Solution :
Go to the web.config and set the targetframeworkmoniker as below
<compilation debug="true" targetFrameworkMoniker=".NETFramework,Version=v4.0" />
Hope this helps
A name was started with an invalid character - WCF 4.0
A name was started with an invalid character. Error processing resource 'http://localhost:81/MyWCFHello/MyHelloWcfApp.Servi...
<%@ ServiceHost Service="MyHelloWcfApp.Service1" %>
-^
Actually problem lies in your IISAdmin.
Follow the steps to resolve the same.
1. Open Inetmgr
2. Select your website
3. right click to properties -> Select ASP.Net tab
4. Change the version to ASP.Net 4.0
Hope this helps
Tuesday, August 25, 2009
WCF 4.0 Beta - Service Configuration Enhancements
The .Net Framework 4.0 beta1 has shown lots of improvements in the area of Windows Communication Foundation. The new version has simplified the developer experience. It also provides us a rich integration with Workflow foundation. On top of all the improvements done one thing stands apart.
That is nothing but easier configuration of your services.
List of Configuration Improvements
1. File less activation
2. Default Endpoint
3. Default Protocol Mapping
4. Default Binding Configurations
5. Default Behavior Configurations
In .Net 3.5 we were using .svc files to expose the services. We can configure the .svc extension by using IIS filter with little complexity. Now .Net 4.0 introduces file-less activation for the services. What they mean by this is “There is no more .svc files”.
Following configuration will set you free from .svc files.
<configuration>
<system.serviceModel>
<serviceHostingEnvironment>
<serviceActivations>
<add relativeAddress="/MyPath" service="MyService"/>
</serviceActivations>
</serviceHostingEnvironment>
</system.serviceModel>
</configuration>
Now we can browse the site like http://localhost/MyIISSite/MyPath.
Isn’t it cool ?
In WCF 3.5 / 3.0 if we host WCF service without endpoints it will throw error. Isn’t it ?
In .net 4.0 it is no longer an issue. In the runtime, default endpoints will be added
When the open method of ServiceHost is called, it will check the configuration file for the number of endpoints. If it is zero it will call the public method AddDefaultEndPoints to add the endpoint. One endpoint will be added per base address per service.
WCF 4.0 allows you to map the transport protocol schemes and the WCF bindings. There are two ways to map the same. One in machine.config and the other by overriding application configuration file.
In Machine.Config
<protocolMapping>
<add scheme="http" binding="basicHttpBinding"/>
<add scheme="net.tcp" binding="netTcpBinding"/>
<add scheme="net.pipe" binding="netNamedPipeBinding"/>
<add scheme="net.msmq" binding="netMsmqBinding"/>
</protocolMapping>
In App.Config
<system.serviceModel>
<protocolMapping>
<add scheme="http" binding="wsHttpBinding"
bindingConfiguration="secureConfiguration"/>
</protocolMapping>
</system.serviceModel>
This will be useful if in my application I am always going to use wshttpbinding rather than basic httpbinding for http protocol.
Default Binding Configurations
In WCF 3.5/3.0 we will define a named binding configuration which will be used against any endpoints. The problem here is we need to specify the configuration properly in the endpoints which may be cumbersome when we have more endpoints.
In WCF 4.0 we no longer have the name attribute. This will be considered as default and used by all default endpoints
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding messageEncoding="Mtom"> <!—No Name attribute -->
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
</configuration>
Default Behavior Configurations
Similar to Binding Configurations , WCF 4.0 supports default behavior Configurations.
<configuration>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior> <!-- notice no name attribute -->
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
WCF 4.0 provides more features apart from configuration enhancements which will reduce the developer burden as well as provide more opportunities to use WCF in new environments.
The configuration changes made in WCF 4.0 is for sure to make a difference to the developer / IT department world as they are the more concerned users.
Tuesday, August 4, 2009
command line proxy setting in vista
To set proxy details through command line do the following
1. Open command prompt as administrator
2. netsh winhttp set proxy proxy-server="give ur server name" bypass-list="ur list"
To reset
netsh winhttp reset proxy
HTH
MJ
Monday, August 3, 2009
WCF Service throws "Page Cannot be displayed"
When you create a website for your WCF services and it throws "Page cannot be displayed, open inet mgr -> right click on the site -> properties -> Asp.net change the version fron ASP.Net 1.1 to 2.0.
HTH
MJ
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