How to Call WCF service from biztalk - wcf

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.

Related

WCF error 0xc00e0069 (MQ_ERROR_REMOTE_MACHINE_NOT_AVAILABLE)

I have a WPF app that uses WCF (duplex netMsmqBinding) to talk to a self-hosted service app in our domain.
I'm now trying to move this WPF app to the big wide world out there, to talk to the WCF service over the internet (well, make them talk to each other).
I've installed MSMQ and created the services on both, and checked queue and firewall permissions. Based on the reading I've found, what I needed to do then is:
1) Enable MSMQ's HTTP addon.
2) specify the binding's useActiveDirectory=false and queueTransferProtocol="Srmp" to ensure that it uses DIRECT to find the private queue.
However I did that and the WPF app receives the error
An error occurred while opening the queue:Unrecognized error
-1072824215 (0xc00e0069). The message cannot be sent or received from the queue. Ensure that MSMQ is installed and running. Also ensure that
the queue is available to open with the required access mode and
authorization.
Which translates to MQ_ERROR_REMOTE_MACHINE_NOT_AVAILABLE.
I can browse to the remote server ok, and the rest services work fine, so I must be missing something with HTTP or the fact that it's self hosting. Any ideas?
MSMQ over HTTP is a push technology (client -> web server).
You cannot open a remote queue and pull messages from it.

WCF service does not respond, how to debug?

consider a WCF service, which is heavily used and behaves normally. But then is stopps responding. In the sevice level message trace you can see the outgoing message on the client, but no incoming message on the server. On transport level theres a incoming message and then nothing. After 60 seconds the client throws a TimeoutException.
What can cause a behavior like this?
What would you do to debug this behavior?
Is it possible that this behavior is caused by too many concurrent connections/sessions?
EDIT:
Client and Server are on the same machine. Both are .NET apps. When the client is restarted the problem sometimes does not happen. Also the problem does only appear on a single machine. I was not able to reproduce the behavior on any other machine.
Regards
Michael
I understand you have no problem on network level as you have mentioned that you can see incoming request on transport level.
So the first thing to check does the service is up and does it works if the client is on the same machine.
Also you can analyze incoming messages may be the problem can be there.
Here WireShark will be your friend.
Also check can you view the wsdl from the client machine. By the way are your clients also .NET apps?
You can configure tracing using the application’s configuration file—either Web.config for Web-hosted applications, or Appname.config for self-hosted applications by Service Trace Viewer
or use from debug tools such Debug Diag

WCF MSMQ binding with an IIS service - how to instantiate the service?

I have a WCF service with netMsmqBinding. My client can send messages to my queue, and when the service is running it retrieves messages from the queue as expected. If the service is not running, messages received are queued until the service starts.
My problem is that the service does not start when a message hits the queue. The service is hosted in IIS, and so it is not instantiated until IIS receives a request. If I browse to the service then it processes the messages in the queue, but obviously this is not my desired method of processing the queue!
I expect that I need to change the service implementation, or change the IIS setup, but I do not know where or what to change.
UPDATE
Does anyone actually use MSMQ over WCF? I had this working for a short time - I enabled the binding on a different website on the same server, bizarrely - but now it has somehow stopped working again.
The only problem I am having is with the Activation of the service when there is a message in the queue. At present the queue only processes when the service is instantiated, e.g. when I browse the the .svc file. I have the net.msmq protocol enabled on the application, and I have the net.msmq binding enabled on the site... is there anything else I need to do?
You explicitly need to configure IIS for non HTTP activation. I don't know all the details of the top of my head but basically you need to use appcmd to configure and enable the net.msmq binding activation.
Check this blogpost or this screencast should give you all the details.
This might save somebody the hours it took me:
http://msdn.microsoft.com/en-us/library/ms731053.aspx
I believe that my problems using MSMQ binding over WCF were mainly around IIS.
I had no end of problems using Windows XP / Server 2003 with IIS 6.
Using Windows 7 or Server 2008 with IIS 7.5 everything works well.
An even better suggestion is to run MSMQ as a managed service / Windows Service or a stand-alone application rather than under IIS.

WCF can no longer step into a service that's locally hosted -- why not?

I have a WCF test service and a test client in the same solution. The service is configured to run on localhost (Ie, "http://localhost:8731/Design_Time_Addresses/MyService/Service") I run the client app and it correctly invokes the service and gets back the correct answer. I've verified via logs that it's definitely running the service that's local to my machine.
However, I can't debug into the service when running the client. WCF is supposed to allow just stepping through, but no breakpoints on the service get hit, and stepping in to the service call doesn't work either. Has anyone ever seen this?
I've checked all the obvious stuff like "is the PDB file being generated?" -- yes, it is. If I run the service project by itself, then hit it with some test client, breakpoints get hit correctly. So debugging on the service works. I can even explicitly "attach to remote process" and debug the service that way. But WCF will not automatically step from the client to the service.
I've had this happen as well. Curiously it seems to happen after I make changes to the build configuration (from x64 to x86). Here's how I've been able to fix it:
Right-click the solution, select Properties.
Under "Startup Project" switch from "Single startup project" to "Multiple startup projects".
Set Action to "Start" for the WCF project.
Even though I'm hosting the project in the local IIS server (not the VS Development Server) this solves it, which is a little puzzling. I suspect that setting a project to "Start" also causes VS to attach to the process for debugging.
http://msdn.microsoft.com/en-us/library/bb157685.aspx
For Visual Studio multi-configurations:
In the Property Pages of your solution, ensure that the "Configuration" for your web-service is set for "Debug", not "Release".
Are you using the automatic WCF service hosting feature in Visual Studio? You can check this by opening the project properties of your WCF service project and navigating to the WCF Options tab. Is the Start WCF Service Host when debugging another project in the same solution checkbox checked? If it is, then this explains the problem.
What's happening is that when you run your client, a separate process is created to automatically host your WCF service. Because it is a separate process, you will not be able to "step into" it when debugging your client. You'll have to run two separate debug sessions, one for your service and one for your client.
An easy way to do this is to put a call to System.Diagnostics.Debugger.Break() in the startup logic for your service. When your service is automatically started by the WCF service host, you'll be prompted to debug it, allowing you to open a second instance of Visual Studio for its debug session.
Also when using VS debug and attaching it to the w3wp.exe process and you have specific port bindings other than http:80:* you must have the debug > web in VS set to the site and port http is running on.
Yes, I got the same problem, WCF uses another processs.
At last, I found a way, i start a new instance(debug->start a new instance) of WCF service first, then start the client side, the breakpoints in the WCF service hits!
One other reason for not stepping into WCF service may be the size of your data that is passed to the WCF methods.
For ex., I was passing an array of dobules of size 1000, and I was getting a bad request error (400) with seeing how the method is run. I made the size 500 and now it debugs the WCF.
In my case, I had published it using Release configuration. You need to select Debug here.
I had similar problem. WCF hosted by WCF Service Host, requests tested by WCF Test Client. My problem was caused by space in build configuration name. As soon as I used configuration name without spaces, debbuging worked.
I guess the real problem was the build output folder ending with folder named by the configuration name.
#msulis - yes, thanks, this remedied it for me. I had also changed recently, the target CPU from any to x86. I couldn't reply directly to you message for some reason so apologize if this comes up as an "answer".

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.