ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » SOAP Async Problem

Post new topic  Reply to topic Goto page Previous  1, 2
 SOAP Async Problem « View previous topic :: View next topic » 
Author Message
LuisR
PostPosted: Sun Jun 12, 2016 5:27 pm    Post subject: Reply with quote

Apprentice

Joined: 07 Jun 2016
Posts: 25

Hello,

I'm pretty sure my problem is with the Aggregation Reply Node, but I don't know why and I don't know if the Async Response Node is losing something.

My test flow is this one:

https://drive.google.com/open?id=0B_ItEiUvlMG_M3NSSkxUWV9FQ3c

The traces are all registering this:
Root:
${Root}
LocalEnvironment:
${LocalEnvironment}
ExceptionList:
${ExceptionList}

And the traces that I'm getting are these (in URLs to keep it simple to the eye):

Trace 0: https://drive.google.com/open?id=0B_ItEiUvlMG_bDlJanplQUNSSW8
Trace 1: https://drive.google.com/open?id=0B_ItEiUvlMG_RlhrcE5tNUNLcE0
Trace 2: https://drive.google.com/open?id=0B_ItEiUvlMG_YkNWX3dja2xGbjg
Trace 3: https://drive.google.com/open?id=0B_ItEiUvlMG_NGhfTmdJV3QtODA
Trace 3.5: https://drive.google.com/open?id=0B_ItEiUvlMG_Wm5jcGJDVl9lT1k
Trace 4: https://drive.google.com/open?id=0B_ItEiUvlMG_d0Y3MFgwdnQwZzA

I'm not getting any trace beyond Trace 4 and I'm not getting any error.

What am I doing wrong? Is something missing?

Thanks for your help
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sun Jun 12, 2016 7:35 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
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
View user's profile Send private message Send e-mail
LuisR
PostPosted: Mon Jun 13, 2016 7:44 am    Post subject: Reply with quote

Apprentice

Joined: 07 Jun 2016
Posts: 25

Hello fjb_saper,

Thanks for your response. It gave me some enlightenment on the aggregation behavior, but it keeps failing.

I've put a Trace after the Aggregation Request as you told me and the Trace is the Trace 3.5 (listed below). Also I believe that all the terminals are wired to the Aggregate Reply Node, please correct me if I'm wrong and tell me what is missing if you see the error. Finally I've run the user trace to see what's happening and I'm attaching it to this message.

What I'm seeing to be the error is simple enough, the Extract Node is receiving a wrong message. Is like the Aggregate Reply Node erases the message and set a new one.

By the way, the flow without the Aggregation stuff is working fine and as expected (that flow is SOAP Input -> SOAP Extract -> Mapping -> SOAP Async Request > SOAP Async Response -> SOAP Extract -> Mapping -> SOAP Reply).

The new flow is this one:
https://drive.google.com/open?id=0B_ItEiUvlMG_VW9GRTZ1Q011WW8

The traces are:
Trace 0: https://drive.google.com/open?id=0B_ItEiUvlMG_V2M4UFhNcFlqbkE
Trace 1: https://drive.google.com/open?id=0B_ItEiUvlMG_R0FkVmhpQ2hobDA
Trace 2: https://drive.google.com/open?id=0B_ItEiUvlMG_bTdpVDlvMEdlMFE
Trace 3: https://drive.google.com/open?id=0B_ItEiUvlMG_dFU2QURMQ0xLN3c
Trace 3.5: https://drive.google.com/open?id=0B_ItEiUvlMG_STU4d2FQUVBselE
Trace 4: https://drive.google.com/open?id=0B_ItEiUvlMG_Y3E5RGdnQjl2QzA
Trace 5: https://drive.google.com/open?id=0B_ItEiUvlMG_WHgyZnpOVnZqSDg

The user trace is this one (is in spanish, but I can translate anything you want/need, here or PM me):
https://drive.google.com/open?id=0B_ItEiUvlMG_cnJxeEdfdDRzaWs

Thanks a lot for your help
Back to top
View user's profile Send private message
LuisR
PostPosted: Mon Jun 13, 2016 10:37 am    Post subject: Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Mon Jun 13, 2016 4:22 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
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
View user's profile Send private message Send e-mail
LuisR
PostPosted: Tue Jun 14, 2016 6:30 am    Post subject: Reply with quote

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
View user's profile Send private message
mqjeff
PostPosted: Tue Jun 14, 2016 6:46 am    Post subject: Reply with quote

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
View user's profile Send private message
LuisR
PostPosted: Tue Jun 21, 2016 11:38 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page Previous  1, 2 Page 2 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » SOAP Async Problem
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.