Unable to call one way Peoplesoft service with WCF-Adapter from BizTalk 2010 - wcf

We are trying to call a one way PeopleSoft service that does not return any response from BizTalk 2010 with WCF-BasicHttp binding and one-way send port.
We are getting the following error.
System.ServiceModel.CommunicationException: The server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error.
I have read several articles regarding this issue. This one says due to reliable delivery feature one way messages are not supported by BizTalk
social.msdn.microsoft.com/Forums/en-US/biztalkgeneral/thread/3a55a044-0a07-416c-9931-1dd6bdeb717a
This one says I need to create WCF proxy that will call a one way web service and return an empty message to BizTalk so the messaging process doesn’t timeout waiting for an answer. (I would like to avoid this if possible)
www.pvle.be/2008/12/calling-one-way-wcf-service-with-biztalk-wcf-adapter-part-2/
At the end of this thread Rajesh says they used SOAP adapter for the same problem. (SOAP Adapter is deprecated)
http://social.msdn.microsoft.com/Forums/en/biztalkgeneral/thread/3b58e83a-3b69-40a2-941c-ff2d9a77ccc6
In another thread Rajesh says
As Steef mentioned earlier, a strict one way WCF-Send port is not supported in BizTalk. So you could try changing one-way send port to two-way send port and then you can ignore the response message in your orchestration if you dont need it
I tried changing the one-way send port to two way send port. I'm still getting the same error.
So my question is:
Is it possible to call a service that does not return any response from BizTalk 2010 without writing additional WCF proxies? If yes, can you provide a step-by-step example?
Thanks for your patience with my long post.
Alper

In this situation I believe your going to have to write a proxy for it. BizTalk is all about request / response and one-way is not really one way as people have found out. Take a look at this article here as it sheds some light on a similar topic.

Related

How to use NServiceBus with MSMQ

I am experimenting the new version of NServicsBus. I find following step by step sample on particular site.
https://docs.particular.net/samples/step-by-step/
Can any one tell me how to configure MSMQ for Transport. Here is my scenario.
Client create message
Client message should be stored in MSMQ
Server Application running on same machine which subscribe the message.
Server handler get message from MSMQ and process it further. i.e Store in DB or send to other web service.
Retry to process message if it does not worked first time
after 3 retries send message to error queue
How do i configure this sample to use MSMQ for my scenario.
Helpful information to include
Product name:NServiceBus.Core
Version: 6.3.4
Stacktrace:
Description:
Did you know that we have released a LearningTransport and LearningPersistence just for purposes like these? Have a look at it here.
Having said that, the transport swapping should be rather seamless so even if you have setup a small PoC using this transport/persistence, you can change it to MSMQ or other production-ready transports/persistence when you go live.
Again, as stated in the documentation page and as the name suggests, this is not for use in production.
I would recommend you walk through this.
https://docs.particular.net/tutorials/intro-to-nservicebus/
Will answer your questions, and future ones you have.

Biztalk orchestration published as Web Service consumed by Schedule Task Adapter

As I asked here, I have an orchestration that is started by a public port published as a web service. Everytime this service is called the orchestration starts
I need to start the orchestration every 30 minutes too.
I ended up using the Scheduled Task Adapter to call my own port. I created a scheduled receive port that creates messages every given time, and a send port that with a filter, receives messages from the port and send them to the web service port
Orchestation starts correctly, but there is an error:
System.ServiceModel.CommunicationException: The server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error.
After researching, I found out that Biztalk doesn't like one-way web services (even if this web-service was generated by "Biztalk Web Service Publishing Wizard")
I found solutions like a WCF-proxy, but I was wondering if I could just configure the orchestration webservice to be two-way (in the wizard you can force it) and then call it the way i'm doing now. I'm trying but still receiving similar errors
Anyone had a similar issue?
Thanks
Add a Listen shape to the start of your Orchestration, you can then have 2 (or more) parallel Activating Receive shapes.
Connect the secondary Receive shape to a new one-way logical port (Specify-later)
Once deployed, hook your Scheduled Task Adapter up to the one-way port, so it receives the regularly scheduled message.
As always with BizTalk, there is more than one way to de-fur a feline, but this was the first to come to mind.

How to set a connection just for server callbacks and a connection just for client calls using WCF ?

I don't think I was clear. What I meant was How to set a callback("server to client") in a different connection from a "client to server" connection using WCF ?
I always saw callbacks examples using just one DuplexChannelFactory. This implies using only one TCP connection to make client to server calls and receive server to client callbacks.
This question came to me after I read this this topic:
Seeking WCF Duplex "TwoWay" Subscribe+Callback Example
I the top answer, Ian Ringrose said:
Some rules I found to help avoid deadlocks. (Look at my WCF questions to see the pain I had!)
The sever must never call out to a client on the same connection as a call from the same client is in process on.
And/or
The client must never call back to the server on the same connection as is used for the “callbacks” while processing a call-back.
And I was wondering how to implement it using WCF.
This CodeProject on Robust Interapplication Communications using Double-Simplex WCF answers exactly your question:
What I decided to do was run two separate WCF connections (double simplex). Each application would run a WCF Host for incoming messages and each application would run a WCF Client for outgoing messages. This is a pretty robust solution and will not be broken by stopping and starting the applications. The WCF Client simply re-establishes the connection if needed.
The way it is solved meets the requirements you have extracted from the Ian Ringrose answer.

End a WCF Session from the Server?

This may be a shot in the dark (I don't know much about the internals of WCF), but here goes...
I'm currently working with a legacy application at a client site and we're experiencing a persistent issue with a WCF service. The application is using the Microsoft Sync Framework 2.0 and syncing through the aforementioned service. The server-side implementation of the service has a lot of custom code in various states of "a mess."
Anyway, we're seeing an error on the client application most of the time and the pattern we're narrowing down centers around different users using the application on the same machine hitting the same service. It seems that the service and the client are getting out of sync in some way on an authentication level.
The error is discussed in an article here, and we're currently investigating the approach of switching from message layer security to transport layer security, which will hopefully solve the problem. However, we may be able to solve it in a less invasive manner if this question makes sense.
In the linked article, one of the suggestions was to forcibly terminate the connection if the specific exception is caught, try again, and if it fails again it wasn't because of this particular theory. Sounds good, and easy to implement. However, I find myself unable to say with confidence if the connection is being properly terminated.
The service operates through a custom interface, which is implemented on the server-side. The only thing that interface can do to end the connection is call EndSession() on the proxy itself, which calls EndSession() on the server which is a custom method.
So...
From a WCF service method, is there a way to properly and gracefully terminate the connection with the client in a way the client will like?
That is, in this custom EndSession() is there some last step I can take to cause the server to completely forget that this connection was open? Because it seems like when another user on the same machine tries to hit the service within the application, that's when it fails with the error in the linked article.
The idea is that, at the client side of things, code which calls EndSession() is followed by nulling out the proxy object, then a factory method is called to supply another one the next time it's needed. So I wonder if something additional needs to happen on the server side (and does by default in WCF were it not for all this custom implementation code) to terminate the connection on that end?
Like I said, a shot in the dark. But maybe in answers/discussions here I can at least further diagnose the problem, so any help is much appreciated. Thanks.
Unfortunately there are only really three ways in which a session can terminated
The client closes the proxy
The service's receiveTimeout is exceeded
before the client sends another
request
the service throws a
non-fault exception which will fault
the channel and so terminate the
session
if you don't want the client involved then you only have 2 and 3 neither of which end well for the client - they will get an exception in both situation on the next attempt to talk to the service.
You could use Duplex messaging and get the service to notify the client that its requires session termination - the client then gets an opportunity to close down the proxy gracefully but this is a cooperative strategy

Wcf service waiting for a reply from NServiceBus that will never come

Imagine the following setup: a Silverlight client tunnels a serialized command over the network using a WCF service which in turn deserializes the command and sends it using NServiceBus to a generic host which is responsible for processing the command. The WCF service has - upon sending the command - registered a callback to be invoked. The generic host validates the command and 'returns' an error code (either 0 == success or >0 == failure).
Note: The WCF service is modelled after the built-in WCF service. The difference is that this WCF service receives a 'universal command' (not an IMessage), deserializes it into a real command (which does implement IMessage), and consequently sends the deserialized command off to the bus.
When unexpected exceptions occur, the command gets (after a certain amount of retries) queued in an error queue. At this point, the initiating WCF service sits there idle, unaware of what just happened. At some later point, the Silverlight client will time out according to the WCF client proxy configuration.
Things which are fuzzy in my head:
Does NServiceBus handle this scenario in any way? When does the timeout exception get thrown (if at all)? Or is this something exclusive to sagas?
Presuming I use [OperationContract(AsyncPattern=true)], are there any WCF related timeout settings that will kill the service operation? Or will the EndXXX method be somehow called? Or will it sit there forever, leaking, waiting for something that will never come?
Ways to proceed:
reuse existing timeout mechanisms, provided things don't leak.
build my own timeout mechanism between the wcf service and nservicebus.
notify the wcf service somehow when the command lands in the error queue.
build my own async notifcation mechanism using full blown callback message handler in the WCF service layer.
Things I've done:
run the example provided with NServiceBus.
spiked the happy case.
Any guidance on how to proceed is welcome, be it blog post, mailing list entries, ...
Some motivations for picking my current approach
I'm trying to leverage some of the scalability advantages (using distributor in a later phase) of NServiceBus.
I don't want to host a gazillion WCF services (one for each command), that's why I cooked up a bus-like WCF service.
Even though this is somewhat request/response style, I'm mostly concerned with gracefully handling a command reply not coming through.
You can develop any sort of message type you desire, IMessage is simply a marker interface. If you inspect the WSDL file that the service mex endpoint provides, there is no reference to IMessage, therefore you can define any command you like in you service. That being the case you should be able to use the provided WCF host.
I was able to reproduce the issue you describe using the built-in WCF hosting option. When an exception is thrown, the entire transaction is rolled back and this includes the Bus.Return, and therefore the service never gets a response.
I found a hack around this that I could provide, but I recommend reconsidering how you are using the service. If you are truly looking to do some expensive operations in a separate process then I would recommend in your WCF endpoint that you do a Bus.Send to a different process altogether. This would ensure to your client that the command was successfully received and that work is in progress. From there it would be up to the server to complete the command(some up front validation would help ensure its success). If the command was not completed successfully this should be made known on another channel(some background polling from the client would do).