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

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.

Related

Can BizTalk publish a single one and two way web service?

I am publishing a WCF service, using schemas not orchestrations, and using the BizTalk 2010 wizard. Some of my methods are one way and others are request/response. I finished the wizard successfully, published the services (hosted in IIS) and things were going fine until I went to import the bindings to my app.
There is only one Port, and one receive location connected to it, and its URI is something like /BizService.FTW/BizService.svc. The receive Port is marked as two way, so I can't bind my orchestrations that are one way to it. You cant have two receive locations pointed to the same URI, so my question is this; did the Wizard pull a fast one on me or is there a way to publish one and two way methods in a single service? If there is no way(using the wizard to do it) can I at least have two services (say at /BizService.FTW/BizService.svc and /BizService.FTW/BizServiceRR.svc ) coming from the same Web App?
Yes, but BizService and BizServiceRR would be two separate 'services'.
However, for the one-way Orchestration, did you consider Direct Binding and setting up a Filter for that particular message type?
I'll recommend you publishing two biztalk services (one-way and two-way ones). And build a WCF service, that will route requests to Bzt. services, based on request schema.

How to update WCF after deployment

Generally after added service reference client, we need to update the service reference to get the latest changes.
I created a service and hosted in production server. This is used by some client. After some time, i changed the service (by including new methods or modify some methods) and updated in the production server. So how these are updated in the client.
Again i update in development and host the updated client?
I am assuming you are using the SOAP bindings in WCF.
It depends on the scope of the change you have made.
If you have just added new operations to an existing service this won't affect existing clients.
If your service operation expose complex types, then if you have only added new fields then most client serializers will raise events rather than throw exceptions when encountering unexpected fields, with the net result that the client should still be able to cleanly deserialise your XML.
You need to be aware however, that if you have modified existing operations, or modified or removed fields in your contract types you may have made a breaking change to your existing clients. This means that existing clients will need to be recompiled against your new service contract and then redeployed in order to continue to consume your service.

How to Call WCF service from biztalk

I am new to Biztalk (Stack Overflow as well) I want to receive an xml schema file containing 2 digits and send it to WCF service which will do some arithematic operation on them and give me answer in a file as well. I have tried a lot but unfortunately couldn't succeeded.
What I have done...
I created a service and host it to IIS. It is running fine. I have tested it through (WCFTestClient.exe). Then I have created a biztalk project and Consume WCF Service from generated items. Then I deployed the project. And configured Receive and Send ports accordingly but have no luck.....
I have solved problem myself. Actually I read error message in suspended service messages in Biztalk Administration Console and after some google I was able to solve the issue.

Event Dispatcher for WCF call-backs

I have a server that needs to keep a small number of clients in sync. Whenever there is a change of state at the server, all the connected clients must be informed.
I am planning to use a “callback
contract”,
I can get hold of the
callback reference for each client on
the server by using
GetCallbackChanel().
I then need
to manage all these client channel
reference and call all of them when
needed.
So far so good however:
I don’t wish to block the server, so calls to the clients must be none blocking
Errors calling the client must be logged and coped with
Is there a standard WCF component to do this?
No, there is not a standard WCF component for this, at least through .NET 3.5. I can't speak to what may be available in .NET 4.0.
That said, there is a pretty straightforward way to do this. Juval Lowy, author of Programming WCF Services, describes how to do this using his WCF-based Publish-Subscribe Framework.
Basically, the idea is to create a separate WCF event service that resides in the same hosting application as your server (e.g., Windows service, IIS). When the state of your server changes, you publish the state change to the event service. The clients that need to be kept in sync subscribe to this same event via the event service. In effect, the event service becomes a broker for your server to notify clients of whatever events your server publishes.
The article I listed above has a code download, but you can also get the Publish-Subscribe Framework and a working example for free from his website, IDesign.net. Here is the link to the download. You may need to scroll your browser up just a little bit to see it as I believe their internal hyperlink is wrong.

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.