Update WCF service reference in Biztalk 2010 - wcf

I have consumed a WCF service in a biztalk solution by "Add generated items". Then I build up a quiet lenghty orchestration. Now I have to update the service (Add another method). How can I update the reference of that service in the project. Is there any direct way or I have to delete all files and do all things from point zero? (I am using biztalk server 2010.)

There is no such method to update service reference which is consumed through "Add generated Items" wizard. One possibility is to Make a separate folder in project and add reference again in that folder.

Related

What is the code created by the BizTalk WCF Service Publishing Wizard?

We have exposed a BizTalk Schema as a WCF service for a third party vendor so that they can push messages onto our ESB. The WCF service has a single function which accepts and returns messages of that schema type. The issue is that if a response is not made in a timely manner or another message e.g. an error is generated by the ESB the third party app fails/crashes.
It doesn't really matter what is in the message as long as it is in the correct format and the data in the returned message is not used by the vendor or ourselves. The vendor also supplies its own WCF service which we can use to pass back messages should we wish to do so. I would like to modify the existing WCF service or manually create an new one which immediately returns a response but also passes the message onto the ESB for further processing.
I have created an interface from the WSDL using svcutil but cannot find any code examples of how manually create a WCF service to expose a BizTalk schema. All examples point to the wizard.
What is the code that the wizard creates? Is there an example? Thank you.
EDIT 23/08/2013
So it would appear that changing a wcf service created by the wizard is not an option nor is creating a new service manually. I have tried creating an orchestration which consumes the service and sends a response then binding that to the same receive port which works if the itinerary works but doesn't run if there is an error. Plus it only runs after the itinerary is complete which is no good. I need an immediate response.
You can change a wcf service created by the wizard, but it is generally better to use the Wizard to re-publish it using the below from the command line.
BtsWcfServicePublishingWizard -WcfServiceDescription=C:\..\WcfServiceDescription.xml
The WcfServiceDescription.xml will be under under the folder where you published the web service in \App_Data\Temp\ e.g. C:\Inetpub\wwwroot\BizTalkWcfService\App_Data\Temp\WcfServiceDescription.xml
Keeping a copy of this xml file in your source control is a good idea. Running the wizard against the one under the web service is not a good idea as it deletes and re-creates everything in the folder and so you might manage to corrupt it, so copy it out first and run against the copy.

Difference between manually creating a client proxy and referencing a MSMQ WCF service?

In most examples of WCF services that use MSMQ transport it is always preferred to create a proxy manually using svcutil in Visual Studio command prompt rather than simply adding a Service Reference. When you can just reference the service by providing its endpoint address to the Add Service Reference dialog in visual studio why would you want to create a proxy with VS command prompt (since it is slightly more laborious)? I just came across this while reading WCF 4 Step by Step:
Note that you cannot easily use the Add Service Reference Wizard in
Visual Studio to add a reference to a WCF service that uses the MSMQ
transport.
Why exactly is it difficult? What exactly is the benefit (if any) of the former method of referncing a WCF service? It seems to me that creating a proxy manually is just unnecessarily complicating the task.
You don't need to pre-generate a proxy as long as you have a reference to the assemblies which define the service interface, operations, and data contracts. You can then create the proxy on the fly using ChannelFactory.
var factory = new ChannelFactory<IMyServiceInterface>("MyServiceNameInAppConfig");
var proxy = factory.CreateChannel();
This is far simpler than using svcutil. However, if the service is remote and you cannot get access to the type assemblies then you have no other choice but to generate a proxy.
Regarding your question about why it's easier to use svcutil instead of VS to generate the proxy code, without seeing the actual book it is hard to comment, but under the hood visual studio uses svcutil to generate the code anyway, so I can't see how it would be any better or worse. When you do this manually then you have more control over what gets generated I guess.

Update service references in multiple projects?

I have a visual studio 2008 solution with approximately 15 projects. Several of these projects have a WCF service reference to a WCF service project. Whenever I update the service project, I have to go to each of the other projects and right click the service reference and update it. Is there an easier way to do this, like a "Update All Service References In Solution" button, somewhere, somehow?
There's no such functionality, really - at least none that I'd be aware of.
You could do one of two things:
have svcutil.exe update your service references - it's a command line tool, which you can batch up, or have executed during a build process
or:
if you're controlling both ends of the communication channel, and both are .NET, you could put your service and data contracts into a separate assembly (or several), and then share those assemblies between server side and client side code. You'd have to change the way you build up your client side proxies a bit (instantiate a ChannelFactory<T> and create the channel from that factory for each service contract), but that would be a one-time effort.
Once done, any updates to the service and/or data contracts would be reflected in both the server side code, as well as your client proxy code.
The only drawback here is: it only works for .NET-to-.NET communication - if you have non-.NET clients, those are left out in the cold, obviously.....

What is "mexHttpBinding"?

What is "mexHttpBinding" in WCF? When should this binding be used in preference to other bindings?
It is a binding that returns metadata so you can build a proxy at the client side. See here. More here as well.
mexHTTPBinding allows to use WS-MetadataExchange over HTTP. You don't need it unless you implemented policies which may change over time and you need to discover your service with UDDI for example
Many people says it's needed for creating client side proxies. This is not true. For client side proxies you need to publish WSDL. You can do that by specifying in your service behavior.
Shortly, you don't know it -> you don't need it.
mexHttpBinding is used while adding a new Service Reference in a Project in Visual Studio 2013 (DEBUG) that will consume your WebService (providing the mexHttpBinding). After you've added the Service Reference successfully you might disable the mexHttpBinding.
It is all described in the App.config when you're creating a WCF Service Library Project in the Visual Studio 2013 ( Solution >> Add New Project >> Visual C# >> WCF >> WCF Service Library)

Consuming a WCF service in BizTalk 2006 R2

I'm trying to figure out how to consume a WCF service in BizTalk 2006 R2 (sending a request and receiving a response).
I've gotten as far as going through the "Add Generated Items" wizard. Now I am trying to find out how to use the items it generated in an orchestration.
How should the request be made?
Below is a description of how to do this - I'm going to presume at least basic knowledge of things like BizTalk mapping, please let me know if you need any more detail and I'll update.
After generating the items in BizTalk you should have (at the least):
An orchestration file with Messages and Port Types created
A schema that describes the messages you send and receive from and to your WCF service
A .Binding.xml file that describes the service contract exposed by the WCF service and allows easy configuration in BizTalk
Open the orchestration file. This should be empty.
Drag a Port from the toolbox onto the orchestration designer surface.
Name the port appropriately.
Select "Use an existing Port Type" - one of the existing port types will be your WCF service (created by the Add Generated Items wizard)
Specify that you will be sending and receiving messages
Specify Bind Later
This port should have Request and Response operation messages and they should have been automatically configured to use the messages for your WCF service. If your service exposes multiple operations, you will see that reflected here.
Using standard BizTalk mapping methods, map the data you want to send to the WCF service into the request message for the WCf port. (you may want the change the message names in the orchestration designer to be something better than the default message_1, message_2...)
Drag Receive and Send shapes onto the orchestration designer and connect them to the right Port messages.
Wire up the rest of the BizTalk orchestration to take data from appropriate source systems (this is just basic BizTalk, not WCF)
Deploy the BizTalk application.
The application is now ready to go, you can deploy it to BizTalk.
Configure the BizTalk application
Open the BizTalk Server 2006 Administration Console and find the application containing the orchestration you just deployed.
The orchestraion will be unenlisted, you need to bind all of its ports
For most of the ports this is just like any other BizTalk application - only the ports that deal with the WCF service differ.
For the WCF ports you have (at least to begin with) two main options:
Import the bindings file made by the BizTalk Generate Items wizard (right click on the applicaiton and import - navigate to the .xml binding file) - Perhaps advisable until you have an idea of how Biztalk represents all the WCF binding options.
Configure your own WCF send port.
For this the port needs to be Solicit-Response to match the WCF service.
Choose one of the WCF Send Port types to match the binding type of your WCF service.
To begin with (for a basic Webservice) this will often be WCF-BasicHttp.
Once you have the basics working you might want to return here and experiment with the options available in the Custom binding - there is a LOT there!
Configure the send port.
In the general tab enter the url where the .svc file is specified
e.g. http://localhost/WCF/myservice.svc
Set the Action to match the action specified in the WCF service .wsdl file
e.g. http://tempuri.org/IMyContract/MyMethod
With your WCF port now created you can bind the orchestration ports to it.
Once all this is done, you should be able to start the BizTalk application and things should work.
One thing that may help - errors will be written to the event log, they may not be helpful, but you should also be able to see any soap fault messages returned from the service in the suspended message view.
Good luck!
BizTalk is overkill if you are just using it to orchestrate WCF services. You can use WCF services in .NET 3.5 inside of Windows Workflow Foundation a bit more easily.
That said, here is a screencast that should help:
http://www.pluralsight.com/community/blogs/aaron/archive/2007/11/15/49172.aspx
Its is very simple as other Service development in BizTalk. Let make it more simpler.
Just Develop you desire Work Flow (Orchestration) and Service.
Open WCF Web publishing Wizard and Check (a) Enable Metadata Endpoint , (b) Create BizTalk Receive Location in the in ur application.
Go to you BizTalk console and Enable the Receive location and Start your Application from Biztalk Console.
Then Browse it from IE or Fire Fox to check that either Service is running or Not.
Now Service has been Develop. Lets do something for its Client.
Go to the Patah "c:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\" and Write SVCUTL and your url of your service i.e. c:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\svcutil localhost:axix//axx.svx?wsdl, this will copy the two files, one is output.config and other is BizTalkServiceInstance. cut and paste both files to your ciletn and then See you service desp for its consumption.
I Think this is the most simplest which i tried to make.
Thanks
Abdul Aziz Farooqi.