The Sapp Family

A Frisco Texas Family

Here are a few photos that I took at church last night.  I hope you enjoy them.

 

 

This is only 8 of the 60 photos I have uploaded.  You can see the rest of them here…

http://sapp-family.com/photo-galleries/hope-fellowship/

 

Tim

So, I created an application for SharePoint 2010 and I needed to deploy it to our farm.  This was the first time I had to do this so it was quite the attempt to find out how to do it.  Once your application has been created in Visual Studio and you have been deploying it to your development web site on the same machine you are almost all the way there.

First, change your configuration from debug to release, then right click on your application name and click on “Package”.  This creates the WSP file and puts the files needed for the deployment.  A WSP file is actually just a .CAB file that has had the extension changed.   If you want to verify the files that are being moved and installed then just rename your file to *.cab and then open it with a cab viewer.  Most of the time you can just double click on it and Windows will show you the content.

Next copy the WSP file over to one of the servers on your SharePoint farm.  I always put this on the server that runs the Central Administration site.

Log into the server that has the WSP file on it and run the SharePoint 2010 Management Shell as an Administrator.  You can find this in the Start menu under Start/All Programs/Microsoft SharePoint 2010 Products/SharePoint 2010 Management Shell.   Just right click on it and Choose “Run as Administrator”.   If you don’t do this then the install will fail.

Once in the Management Shell type the following command.

Add-SPSolution -LiteralPath <The Path to your WSP File>

Without the <>’s, so for me that was

Add-SPSolution -LiteralPath C:\install\JobTicket_WSP\JobTicket_Application.wsp

 

 

 

This just adds the solution to your SharePoint 2010 installed solutions page within your Central Administration pages. It does not deploy the application to any of the servers on the site, or allow any of the applications to run it.

Once it is listed as a solution you can deploy the application to all of the servers in your farm.  from your Central Administration site click on System Settings and then Manage Farm Solutions, which is under the Farm Management heading.

Click on the solution name that you just added  and then click on Deploy Solution.  On the next screen you can leave everything as the default and deploy the solutions, or you can set a time as to when it will be deployed.  Since this was the first time I was installing the solution I wanted it out there now.  Once I hit deploy it took me back to the solutions page and the status of the solution was now “Deploying”.   I hit refresh a couple times and it then showed that the solution was deployed to my farm.

After that I was able to access all the pages of the application.

Tim

 

 

I realized that I never posted any of my photos from LDRS.  So here are a couple galleries to check out.

 

 

 

 

 

 

 

 

 

 

http://sapp-family.com/photo-galleries/ldrs-30-sunday/

http://sapp-family.com/photo-galleries/ldrs-30-monday/

 

Tim

 

My thanks to Harry to took the video and posted it up for everyone to see.

 

 

 

 

I created a quick and simple Web Service using the Microsoft Windows Communication Foundation (WCF) to test how it was going to work with SharePoint 2010.  It was working well until I decided I wanted to add a bit more security to it and remove the anonymous access to the web site through IIS. After that when I would try and go to the page  I would get this weird message that the application required anonymous access to be enabled.  Here is the message that you get in your browser.

Security settings for this service require ‘Anonymous’ Authentication but it is not enabled for the IIS application that hosts this service.

Great…  Thanks MS, that’s a big help. I had followed one of the MS tutorials and it worked great as long as you left anonymous access turned on.

I started doing Google searches on WCF and Windows Authentication and discovered that WCF will only work with anonymous access if you bind the endpoint to wsHttpBinding.  Most of the pages kept saying that you had to switch to basicHttpBinding and then set the  “security mode=”TransportCredentialOnly”.  Great!  A solution!   But maybe not…

I found another site that said I had to add a <bindings> section to the Web.config and that is were you can set the security mode. This is what they showed on their page.

<bindings>
<basicHttpBinding>
<binding name=”MyBinding”>
<security mode=”TransportCredentialOnly”>
<transport clientCredentialType=”Windows” />
</security>
</binding>
</basicHttpBinding>
</bindings>

So I added the <bindings> section, set the security mode and tried the page again.  No good…  I still go the same error staring me down.  I had changed the endpoint binding to basicHttpBinding but it was still not working.  It was weird, I had never changed bindings in a web config like this so I started doing some more searching.  This time I had more information to search for.  I started looking on the MS site for basicHttpBinding and properties and configuration.  I finally found what I was looking for.

While adding the section above to the Web.config did change the security mode, it only does it for that named instance.  See up there where it has the <binding name=”MyBinding”>, that is the named instance or configuration that has been changed.  In the endpoint you set binding=”basicHttpBinding” but then you have to add a configuration setting as well.  So for this one you also have to add bindingConfiguration=”MyBinding” to the line as well.   After I added this little part it all started to work as required.

<system.serviceModel>
  <bindings>
     <basicHttpBinding>
          <binding name="WindowsMethod">
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Windows" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <services>
      <service behaviorConfiguration="JT_WS.Service1Behavior"
        name="JT_WS.Service1">
        <endpoint address=""
                  binding="basicHttpBinding"  
 bindingConfiguration="WindowsMethod" 
                  contract="JT_WS.IJobTickets">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex"
                  binding="mexHttpBinding"
                  contract="IMetadataExchange" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="JT_WS.Service1Behavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

 

Note 1, remember that the Web.config is just an XML document so it is case sensitive.  Make sure that you have the name of the binding correct.  (Not that I did that or anything……)  🙂

Note 2, yeah, the bindings section goes inside the system.serviceModel.  Just make sure that you have all the required settings with it.

 

Cheri and I went away for a long weekend and boy did we have a great time.

Cheri came up with the idea of heading out to West Texas to fly some rockets with WTR.  So we drove to Odessa on Friday and stayed the night with Jim and Teresa Ballard for a couple nights and flew some rockets over the weekend.

 

 

I ended up setting my new personal altitude record this weekend with my two stage rocket.  I pulled 14,264′ flying it on a J520 Sparkey to a J285.  I have not downloaded the other information from the flight computer just yet so I can’t say how fast it went but I have a feeling that it was really screaming.

You can see even more photos from the launch here http://sapp-family.com/photo-galleries/october-airstart-2011/

On the way back we decided to drive back the “long way”.  We stayed a night in Ballenger TX and then decided to visit a couple other places on our last day of our long weekend. We entered a little town called Dublin and I knew there was something that the town was known for.  Then I saw a Dr. Pepper sign and remember that Dublin was the town that had the oldest bottler of Dr. Pepper.  They are over 100 years old and still bottle the Dr. Pepper with real Pure Cane Sugar.  We took a tour of the bottling plant (two machines and one magic marker)

After that we stopped at the Veldhuizen Family Farm between Dublin and Stephenville where they make their own cheese.  They start by milking the cows and then going all the way to packaging.  We sampled some cheese and then ended up buying 4 types of cheese.  I look forward to opening up a bottle of wine and having some of the cheese.

Speaking of wine, the last stop before heading the rest of the way home was Bluff Dale Vineyards, a small winery. We sampled their wine and had some cheese and crackers.  It was a great finish to a long weekend!  Cheri and I loved having all this time with each other.  I can’t wait until we can get away again.

 

 

 

 

Now this was a pain.  I thought I was going to pull my hair out on this one…  You can start here http://msdn.microsoft.com/en-us/library/ee554869.aspx on how to install SharePoint 2010 or SharePoint Foundations on Windows 7 x64.   It’s a pain to get SharePoint installed so hopefully it’s going to be worth the effort. There are a few things you need to be aware of if you are planning on installing this on a development workstation.

One, you have to install SharePoint before you install BizTalk, just like you have to install Visual Studio before Biztalk is installed. If you don’t install it before BizTalk then you will not have any support for SharePoint, and it does not appear that you can go back and install that support.  So, I hope you did not start this process before you figured this out.

Two, When installing SharePoint Server 2010 if you don’t select Install into a server farm, vs Stand alone server, it is going to install a nice fresh copy of SQL Server Express on your machine.  When you go to install BizTalk it’s going to fail when it finds SQL Server Express on there.

Three, before you even start the install of SharePoint you need to create a domain service account for Sharepoint, then give it rights on your database server to access the databases on it.  The database will be created using your user ID but as soon as it’s created it tries to use the service account and if you don’t have the permissions on it all ready, it will fail the install.  Then the next time you go to install or correct it, it is going to just install the express versions again.  I am on install #4 right now trying to get this right.

Four, after you do finally get it installed you need to install the Sharepoint SDK so Visual Studio can start developing things for SharePoint.

Then….  Then you can start the install of BizTalk and hope that everything goes well.

 

Tim

So, you have to run a stored procedure on a SQL Server from your BizTalk install.  Not only that but you have to send parameters to the stored proc and consume the results as well.  I found that it really does turn into a pain when you need to do it.  If you use temp tables in your stored proc then what you get back is a loosely named schema  that looks like this.

The first set is the schema for what you need to pass as parameters to the stored procedure.  The second set is the data that is returned to you from that same procedure.

This is really not much use if you want to do anything with the results from the stored procedure.   The <Any> nodes are where your content should be, but the schema that is returned back from the stored proc does not have everything you need.

 

 

 

So, below is how you add a strong name to that dataset so you can use it in Orchestrations or in maps.  I will start at the beginning, with adding the Generated Items and then all the way to  being able to use the items in a map.

 

 

So, first create a new project in Visual Studio 2010 and add a BizTalk project to it.  I always select the empty project since I don’t want all the sample data in the project.  Once the project is created you need to go and get the schema for the stored procedure as VS 2010 and BizTalk see it.  You do that by adding a generated item, by right clicking on the project name and then hovering over add, and then selecting “Add Generated Item.

Next you select Consume Adapter Service and then click on add.  This is where it is going to start asking you the harder questions if you have never connected to a SQL server with BizTalk projects in Visual Studio 2010.

 

 

 

This is the Consume Adapter Service Wizard and once configured and ran it will create the schema files and the binding file that you will be using later.

If you know the URI connection string to your SQL Server and database then go ahead and knock yourself out.  However, since I know that I have to be in the configuration for that connection I go ahead and hit configuration button and enter everything from there.

 

 

 

So, click on the drop down titled “Select a binding” and choose sqlBinding.  The click on the configuration button and start filling out the fields you need.  We always use Windows Authentication for our databases so you can skip the first tab of the window that opens up.  Click on the second tab and start entering the information for your SQL Server.

So this is where I found a couple of “Got-yas”.  One it does not attempt to use the default port for SQL if you don’t put one there.  So you have to put in the port number along with the server name for it to connect.

Second, don’t put any special characters in the InboundID field.  I tried using something with an underscore “_” and BizTalk died with it in there.  I normally name this something having to do with the stored proc but I am being lazy right now.

 

 

 

 

 

If you have used Typed Polling before to get messages into BizTalk then you are probably familiar with this screen.  It’s where you set the polling information for getting the data from SQL into a message.

We are going to do basically the same thing but a few changes to it.  One, I leave the “InboundOperation Type” to polling.  Then I just use some random table to get a count over 0 (Zero) in the “PollDataAvailableStatement” field. This time I used  “Select count(*) from dbo.Products” because I know that the table will always have something in it.

For the “PollingStatement field I add a SQL command calling the stored proc along with all of the parameters.  This is what I am using for this one.

Exec sp_Get_Direct_Print_Details ‘RC_SAM3067’, ‘Reg’

 

 

 

 

So now, click on OK and it takes you back to the Consume Adapter Service Wizard.   Click on Connect and if everything went as planned you should connect to the database and the Category field gets populated with information from the database.

Leave the Contract type at client, and in the “Select a category” field click on Procedures to select it.  That will cause a list of all the stored procedures on the database to be displayed.  Select the stored procedure you wish to run and then click on add.

This will put the stored procedure down into the “Added categories and operations”.  Notice the name of the Node ID and it should be something like Procedure/DBO/your sp name.  You will start getting used to this in the next part of this procedure.

Add a FileName Prefix if you want and then click on OK.

 

 

 

Now the screen should disappear and you will find three new objects in your solution explorer.  The first one is the DataSetSchema.xsd, then the Procedure.dbo.xsd, and finally an oddly named XML file that will be something like WcfSendPoirt_SqlAdapterBinding_Custom.bindinginfo.xml.   You will end up using all three of the items so don’t delete them.  Before I clicked on the OK button of the last step I entered Sch_ into the filename Prefix field so don’t be alarmed if you don’t see the same file names as what you have.

Now comes the fun part….  Open Up BizTalk Server Administration Console and Create a new application.  Just name it anything because you are going to delete this as soon as we are done.  You also don’t need anything else from your VS project.

So, now that the Application has been created you need to create a new Receive Port.  OPen up the application viewer and right click on Receive Ports and select new\One-way receive Port.

Give it a name that is simple to remember because we will be using it in a few minutes. Click on Receive Locations on the left and then New…

 

Once the Receive Location Properties window is open change the Type drop down to WCF-SQL and click on Configure.  This opened up almost an identical configuration windows for the database that VS 2011 did. On the General Tab of this window click on configure and set the database connection information to be the same as the VS project.  Then click on the binding tab and do the same thing, setting the Data Available Statement and the Polling Statement.

Now click OK three times to save the location and port configuration.

 

I have a feeling that putting “Select 1” in the PolledDataAvailableStatement would work the same as the count statement but I have not tried it yet.  I may update the page if it works when I try it.  If someone tried it before me then let me know.

Now we need to create a File Send port and set the filter so it will route the messages from the Receive Port to a local file directory.  Right click on Send Ports and select New\Static One-Way Send Port.  You can leave the name the same and then change the Type to “File” and click 0n Configure.  Set the Destination Folder to something easy to get to like c:\temp, and then change the File Name to getSchema.xml.  Now click on OK to close the configuration window.

 

Now that the file part is configured we need to configure the Send Port to “Subscribe” to the messages coming out of the database.  Click on Filters and then set Property to “BTS.ReceivePortName”, Operator to “==”, and the Value needs to be set to the name you gave your RFeceive port.  For me, thats RecSQL.

 

Now we get to run our BizTalk application.   First, open up a Windows explorer window to the directory that you told the send port to drop the file.  Then go back to BizTalk and right click on the send port and click start, then right click on the Receive Location and click on Enable.  Switch back to the file explorer window and  if you configured everything correctly you should soon have a file dropped in that directory from BizTalk.

Switch back to BizTalk and disable the receive port down.  Or else every thirty seconds the file will be replaced as the polling will keep going out and getting the same file.

Open getSchema.xml with your favorite editor and remove the schema definition  from the file.  What you are looking for is the <DiffGram> and the schema name spaces that are in the file.  So, anything that starts with <xs: or </XS: you can delete.  Some may say to remark it but I just find it easier to get delete it. Once you have done that save the file and close it.

 

 

 

 

Now go to Start\All Programs\Visual Studio 2010\Visual Studio Tool and run the Visual Studio Command Prompt. You really need to run this one and not just open up a command prompt because this one adds the paths and environmental settings that you are going to need.  Change to the directory where you saved the file, in my case C:\temp.

Confirm that you are in the correct directory and then run the following command.

xsd.exe getSchema.xml

When this runs it is going to create three WSD schema definition files. They will be something like getSchema.xsd, getSchema_app1.xsd, and getSchema_app2.xsd.  One of the files is going to have the the schema for just the diffgram that has the elements from the stored procedure result set.  For me that has always been the _app1.xsd.  Open them up in your editor and it will be the only one that has all of the elements in it.  Rename that to match your naming convention and copy it to the project directory where all the other schema definition files are located. (The root of the project).  Go back into Visual Studio now and add an existing item and select the file you just dropped.

You will notice here that I named my new schema Sch_Strong_Name_Dataset.xsd.  This is what I am going to use now to add a strong name values to my procedures result set. But I have to do a couple things to it first or it will not work correctly.

 

 

 

Open the new schema file in Visual Studio, and single click on the <Schema> node to select it.  Then in the properties window click on the … for Imports.  Remove the first two elements that refer to the files that you did not copy over.  For me that was the first two lines that have a location of getSchema.xsd, and getSchema_app2.xsd.  If you forget to do this part then you will receive an error on the next step. Click on OK to save the changes and you can close and save your open schema file.

Now open up the DataSet schema that was created when you did the Add Generated Items.  For me that is Sch_DataSetSchema.xsd and this is what it looks like when you open up all the nodes.  We have two fields in the data set and they are both set to <any> and we are going to replace the second one.

 

 

 

 

But first we need to import the strongly named data set into our collection.  So single click on the <Schema> node and then on the … next to Imports in the properties.

Leave the drop down on XSD and click on add.  Manauver through the +s until you find the schema that we added to our project.  Select it and then click on OK twice to close the windows.  You might want to save your open schema file now.

 

With the schema file open delete the second <Any> node that is under DataSet.  Right click on DataSet and select Insert Schema Node\Child Record.  Name it diffgram and then single click on it to select it.  Over in the properties window click on the drop down for Data Structure Type and choose  ns0:diffgram.

 

 

 

Your diffgram can now be opened and it will have all of the elements under it that you needed.   Save your schema file and start using your strongly named schema in maps or orchestrations.

 

 

 

 

 

If you found this helpful them please leave a comment or a link back to this article.

 

Ok, So I am starting to add a few things to my blog here that have to do with my job.   Most of them are going to be how to do certain things in BizTalk or in C#.  I might even get into some web services.   If you find any of them useful then please add a comment or link them to one of your pages.

 

 

Tim Sapp

Geek on the Run

 

Over the weekend we were invited over to Craig and Amy’s house for a Crayfish Boil.  What a great time…    They had around 30 pounds of Crayfish in a gigantic pot along with corn, potato, onions, and spices.  Here is a photo Cheri got of me with her camera phone.

I ate until I was about to pop, and was eating well after everyone else was done.  Cheri even had a few and enjoyed them as well.

 

Craig and Amy hosted a great party!