|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
SOAP Async Problem |
« View previous topic :: View next topic » |
Author |
Message
|
LuisR |
Posted: Sun Jun 12, 2016 5:27 pm Post subject: |
|
|
Apprentice
Joined: 07 Jun 2016 Posts: 25
|
|
Back to top |
|
 |
fjb_saper |
Posted: Sun Jun 12, 2016 7:35 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
you'd need to put a trace after the aggregate request node in the fan out flow.
What are you doing in the compute now in the fan in? I would have expected to see the compute node after the aggregate node on the fan in.
The reason you 're never seeing anything beyond trace 4 is because you did not wire all the terminals on the aggregate reply node.
Wire all those terminals and set a trace node after the aggregate request node with emphasis on the LocalEnvironment.
You may also want to run a user trace on both flows...
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
LuisR |
Posted: Mon Jun 13, 2016 7:44 am Post subject: |
|
|
Apprentice
Joined: 07 Jun 2016 Posts: 25
|
|
Back to top |
|
 |
LuisR |
Posted: Mon Jun 13, 2016 10:37 am Post subject: |
|
|
Apprentice
Joined: 07 Jun 2016 Posts: 25
|
Hello people,
Problem finally solved. The thing was to change the ESQL after the Aggregate Reply Node. Now the ESQL Code is this one:
Code: |
SET OutputRoot.Properties = InputRoot.ComIbmAggregateReplyBody.TestWSAggFolder1.Properties;
SET OutputRoot.HTTPInputHeader = InputRoot.ComIbmAggregateReplyBody.TestWSAggFolder1.HTTPInputHeader;
SET OutputRoot.SOAP = InputRoot.ComIbmAggregateReplyBody.TestWSAggFolder1.SOAP;
|
Now, with this step forward I've finally made a successful parallel execution adding a new branch in the flow after the Aggregate Control Node and this branch is exactly like the other one (SOAP Extract -> Mapping -> SOAP Async Request -> Aggregate Request and below a SOAP Async Response connected to the Aggregate Reply). This two branches in the flow works correctly and almost as it is expected.
Now the final problem. I've put a delay of 15 seconds in the operations called by the SOAP Async Nodes and the execution of the entire flows takes 30 seconds and not 15 seconds. The question here is why? Why the execution is not a parallel execution and waits for a branch to finalize to execute the second one?
Again, thanks for your help. |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Jun 13, 2016 4:22 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
That's because you need to scale the flow being called in the asyncRequest differently. If you have 2 requests that need to be processed in parallel, you'll need at least 2 instances of that flow...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
LuisR |
Posted: Tue Jun 14, 2016 6:30 am Post subject: |
|
|
Apprentice
Joined: 07 Jun 2016 Posts: 25
|
Hello fjb_saper,
I could add more instances and I know now what you were talking about. That was not my problem (although it will be my problem after this one, so thank you).
The problem is (check out the flow image) the branches after the Aggregate Control node are not executing in parallel, even worse, the second branch waits for the second branch to end, even with the SOAP Async Request - Response in the middle of the first branch.
Any idea of what I'm doing wrong? Do I need to use MQs to achieve the parallel behavior?
Thanks for your responses. |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Jun 14, 2016 6:46 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
The parallel execution doesn't happen until after the AggregateRequest node.
It should take you a small amount of time to send the request and reach the AggregateRequest node.
You should have a flow like
Code: |
... ->AggregateControl--|->(something that builds Request1) ->something that sends the request->AggregateRequest
->)something that builds request2) ->something that sends the request->AggregateRequest
|
Then the waiting time for the responses to come in occurs in parallel.
Unless they've done something in v10.x that allows this, you can't run two paths through a single message flow in parallel. _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
LuisR |
Posted: Tue Jun 21, 2016 11:38 am Post subject: |
|
|
Apprentice
Joined: 07 Jun 2016 Posts: 25
|
I've finally got this running. The Service wasn't sending the 202 response and that's why tooks so long to start the other branch,. Now it works perfectly.
For the ones interested, the WCF code is:
Code: |
/// <summary>
/// Provides a mechanism to modify or insert custom extensions across an entire service, including the ServiceHostBase.
/// This particular behavior implements the WS-Addressing standard for other bindings than the WsDualHttpBinding.
/// </summary>
[AttributeUsage(AttributeTargets.Class)]
public class AddressingBehavior : Attribute, IServiceBehavior
{
/// <summary>
/// Provides the ability to pass custom data to binding elements to support the contract implementation.
/// </summary>
/// <param name="serviceDescription">The service description of the service.</param>
/// <param name="serviceHostBase">The host of the service.</param>
/// <param name="endpoints">The service endpoints.</param>
/// <param name="bindingParameters">Custom objects to which binding elements have access.</param>
public void AddBindingParameters(ServiceDescription serviceDescription,
ServiceHostBase serviceHostBase,
Collection<ServiceEndpoint> endpoints,
BindingParameterCollection bindingParameters)
{
//Do nothing, this behavior doesn't performs any particular binding
}
/// <summary>
/// Provides the ability to change run-time property values or insert custom extension objects such as error handlers, message or parameter interceptors,
/// security extensions, and other custom extension objects.
/// This particular behavior uses this metod to register the WS-Addressing dispatcher as a message inspector.
/// </summary>
/// <param name="serviceDescription">The service description.</param>
/// <param name="serviceHostBase">The host that is currently being built.</param>
public void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)
{
foreach (ChannelDispatcher chDisp in serviceHostBase.ChannelDispatchers)
{
foreach (EndpointDispatcher epDisp in chDisp.Endpoints)
{
epDisp.DispatchRuntime.MessageInspectors.Add(new WSAddressingDispatcher());
}
}
}
/// <summary>
/// Provides the ability to inspect the service host and the service description to confirm that the service can run successfully.
/// </summary>
/// <param name="serviceDescription">The service description.</param>
/// <param name="serviceHostBase">The service host that is currently being constructed.</param>
public void Validate(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)
{
//Do nothing, this behavior doesn't perform any validation
}
} |
Code: |
/// <summary>
/// Defines the methods that enable custom inspection or modification of inbound and outbound application messages in service applications.
/// This particular dispatcher performs the actions needed to implement the WS-Addressing standard for other bindings than the WsDiualHttpBinding.
/// </summary>
public class WSAddressingDispatcher : IDispatchMessageInspector
{
/// <summary>
/// Called after an inbound message has been received but before the message is dispatched to the intended operation.
/// This dispatcher sends an acknowledgement to the invoker so it can continue without waiting for the service operation to end.
/// </summary>
/// <param name="request">The request message.</param>
/// <param name="channel">The incoming channel.</param>
/// <param name="instanceContext">The current service instance.</param>
/// <returns>The object used to correlate state. This object is passed back in the IDispatchMessageInspector.BeforeSendReply(Message@, Object) method.</returns>
public object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext)
{
//If the message uses the SOAP 1.2 version
if (request.Headers.MessageVersion.Envelope.ToString().StartsWith("Soap12"))
{
//If there's a "To" direction to send the message
if (request.Headers.To != null)
{
//Create an acknowledgment reply
Message ack = Message.CreateMessage(request.Version, request.Headers.Action);
ack.Properties.Encoder = request.Properties.Encoder;
//Send the acknowledgment
OperationContext.Current.RequestContext.Reply(ack);
}
}
//Return any object which will be passed to BeforeSendReply to correlate requests and replies (in this case there is no need of correlation)
return null;
}
/// <summary>
/// Called after the operation has returned but before the reply message is sent.
/// This dispatcher redirect the return to the "To" destination in the WS-Addressing header (if it exists).
/// </summary>
/// <param name="reply">The reply message. This value is null if the operation is one way.</param>
/// <param name="correlationState">
/// The correlation object returned from the IDispatchMessageInspector.AfterReceiveRequest(Message@, IClientChannel, InstanceContext) method.
/// For this dispatcher it doesn't matter because there is no correlation need.
/// </param>
public void BeforeSendReply(ref Message reply, object correlationState)
{
//If the message is SOAP 1.2
if (reply.Headers.MessageVersion.Envelope.ToString().StartsWith("Soap12"))
{
//If there's a "To" direction to send the message
if (reply.Headers.To != null)
{
//Create a copy of the message
MessageBuffer buffer = reply.CreateBufferedCopy(int.MaxValue);
Message redirectedReply = buffer.CreateMessage();
//Get the message as a string
XmlDictionaryReader reader = redirectedReply.GetReaderAtBodyContents();
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(reader);
reader.Close();
//Send the message
Utils.CallWebService(reply.Headers.To.AbsoluteUri, reply.Headers.Action, redirectedReply.ToString());
}
}
}
} |
Thanks to everyone for their answers. I hope it will help others. |
|
Back to top |
|
 |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|