|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
SOAPInput, Two flows, same endpoint, what now? |
« View previous topic :: View next topic » |
Author |
Message
|
hongabonga |
Posted: Thu Apr 21, 2011 7:40 am Post subject: SOAPInput, Two flows, same endpoint, what now? |
|
|
 Novice
Joined: 15 Feb 2011 Posts: 24
|
Hi Friends,
Today, I faced an interesting situation where I was given a scenario where
I had to deploy two identical flows(with different names) in the same execution group.
Fine with that but the interesting thing is that both of them use the same message set derived from the same wsdl.
SOAPInput node for both the flows points to the same path suffix for url.
Instantly I could not solve this, but now back home, I tried to do a little test for this. Interestingly both the flows could be deployed without any problem. Now when I try to do SOAP request from XMLSpy, I get fine response also.
To make sure, which flow was doing the job, I added a little bit to their ESQL to modify the SOAP reply.
What I found was that both the flows are doing the job in a random fashion, for 10 requests I sent to the endpoint, flow1 responded 3 times and flow2 responded 7 times, and that also in a random fashion.
So could you guys help me understand the situation, i.e., is this a documented behavior that I am not aware of.
For your reference, here are the xsd,wsdl, endpoint etc.
request xsd:
Code: |
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:service2Types="http://www.hbsol.com/services/service2" targetNamespace="http://www.hbsol.com/services/service2" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="service2ReqType" type="service2Types:service2RequestType"/>
<xs:complexType name="service2RequestType">
<xs:sequence>
<xs:element name="ackNo" type="xs:string"/>
<xs:element name="flower" type="xs:string"/>
<xs:element name="color" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema> |
response xsd:
Code: |
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2010 rel. 3 (http://www.altova.com) by Unpacker (Unpacker) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:service2Types="http://www.hbsol.com/services/service2" targetNamespace="http://www.hbsol.com/services/service2" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="service2RespType" type="service2Types:service2ResponseType"/>
<xs:complexType name="service2ResponseType">
<xs:sequence>
<xs:element name="ackNo" type="xs:string"/>
<xs:element name="batchNumber" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="segmentInfo" type="service2Types:segmentInfoType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="segmentInfoType">
<xs:sequence>
<xs:element name="color" type="xs:string"/>
<xs:element name="flower" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema> |
wsdl:
Code: |
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://new.webservice.namespace" xmlns:service2Types="http://www.hbsol.com/services/service2" targetNamespace="http://new.webservice.namespace">
<wsdl:types>
<xs:schema>
<xs:import namespace="http://www.hbsol.com/services/service2" schemaLocation="reqv1.0.xsd"/>
<xs:import namespace="http://www.hbsol.com/services/service2" schemaLocation="respv1.0.xsd"/>
</xs:schema>
</wsdl:types>
<wsdl:message name="Service2Request">
<wsdl:part name="parameter" element="service2Types:service2ReqType"/>
</wsdl:message>
<wsdl:message name="Service2Response">
<wsdl:part name="parameter" element="service2Types:service2RespType"/>
</wsdl:message>
<wsdl:portType name="Service2Interface">
<wsdl:operation name="Service2Operation">
<wsdl:input message="tns:Service2Request"/>
<wsdl:output message="tns:Service2Response"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="Service2Binding" type="tns:Service2Interface">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="Service2Operation">
<soap:operation soapAction="http://www.hbsol.com/services/service2#Service2Operation"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="Service2">
<wsdl:port name="Service2Port" binding="tns:Service2Binding">
<soap:address location="http://www.hbsol.com/services/service2"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions> |
ESQL:
Code: |
DECLARE ns NAMESPACE 'http://www.hbsol.com/services/service2';
CREATE COMPUTE MODULE Flow2_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
SET OutputRoot.SOAP.Context.Namespace.(SOAP.NamespaceDecl)xmlns:ns= 'http://www.hbsol.com/services/service2';
SET OutputRoot.SOAP.Context.Namespace.(SOAP.NamespaceDecl)xmlns:ns2= 'http://schemas.xmlsoap.org/soap/envelope/';
-- get color and flower
DECLARE flower CHAR;
DECLARE color CHAR;
SET flower = InputRoot.SOAP.Body.ns:service2ReqType.ns:flower;
SET color = InputRoot.SOAP.Body.ns:service2ReqType.ns:color;
SET OutputRoot.SOAP.Body.ns:service2RespType.ns:ackNo = InputRoot.SOAP.Body.ns:service2ReqType.ns:ackNo;
SET OutputRoot.SOAP.Body.ns:service2RespType.ns:batchNumber = '0001';
SET OutputRoot.SOAP.Body.ns:service2RespType.ns:segmentInfo[1].ns:flower = flower || ' F';
SET OutputRoot.SOAP.Body.ns:service2RespType.ns:segmentInfo[1].ns:color = color || ' F';
SET OutputRoot.SOAP.Body.ns:service2RespType.ns:segmentInfo[2].ns:flower = color || ' F';
SET OutputRoot.SOAP.Body.ns:service2RespType.ns:segmentInfo[2].ns:color = flower || ' F';
RETURN TRUE;
END;
CREATE PROCEDURE CopyMessageHeaders() BEGIN
DECLARE I INTEGER 1;
DECLARE J INTEGER;
SET J = CARDINALITY(InputRoot.*[]);
WHILE I < J DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I = I + 1;
END WHILE;
END;
CREATE PROCEDURE CopyEntireMessage() BEGIN
SET OutputRoot = InputRoot;
END;
END MODULE;
CREATE COMPUTE MODULE Flow2_Clone_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
SET OutputRoot.SOAP.Context.Namespace.(SOAP.NamespaceDecl)xmlns:ns= 'http://www.hbsol.com/services/service2';
SET OutputRoot.SOAP.Context.Namespace.(SOAP.NamespaceDecl)xmlns:ns2= 'http://schemas.xmlsoap.org/soap/envelope/';
-- get color and flower
DECLARE flower CHAR;
DECLARE color CHAR;
SET flower = InputRoot.SOAP.Body.ns:service2ReqType.ns:flower;
SET color = InputRoot.SOAP.Body.ns:service2ReqType.ns:color;
SET OutputRoot.SOAP.Body.ns:service2RespType.ns:ackNo = InputRoot.SOAP.Body.ns:service2ReqType.ns:ackNo;
SET OutputRoot.SOAP.Body.ns:service2RespType.ns:batchNumber = '0001';
SET OutputRoot.SOAP.Body.ns:service2RespType.ns:segmentInfo[1].ns:flower = flower || ' FC';
SET OutputRoot.SOAP.Body.ns:service2RespType.ns:segmentInfo[1].ns:color = color || ' FC';
SET OutputRoot.SOAP.Body.ns:service2RespType.ns:segmentInfo[2].ns:flower = color || ' FC';
SET OutputRoot.SOAP.Body.ns:service2RespType.ns:segmentInfo[2].ns:color = flower || ' FC';
RETURN TRUE;
END;
CREATE PROCEDURE CopyMessageHeaders() BEGIN
DECLARE I INTEGER 1;
DECLARE J INTEGER;
SET J = CARDINALITY(InputRoot.*[]);
WHILE I < J DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I = I + 1;
END WHILE;
END;
CREATE PROCEDURE CopyEntireMessage() BEGIN
SET OutputRoot = InputRoot;
END;
END MODULE; |
Endpoint that I hit from XMLSpy:
Code: |
http://localhost:7800/services/service2 |
Many thanks in advance. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Apr 21, 2011 7:45 am Post subject: Re: SOAPInput, Two flows, same endpoint, what now? |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
hongabonga wrote: |
I had to deploy two identical flows(with different names) in the same execution group.
Fine with that but the interesting thing is that both of them use the same message set derived from the same wsdl. |
So you have 2 flows in the same execution group that both use the same wsdl and hence expose the same web service name, listening on the same port and you're confused why they're both picking up the request? Why is this confusing to you?
A better question is why do you have 2 flows with the same wsdl? What's the design requirement here?
hongabonga wrote: |
Interestingly both the flows could be deployed without any problem |
Why is that interesting? What else were you expecting to happen? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Apr 21, 2011 7:50 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Everything you have done is working as designed, but the wrong way to solve whatever problem you're trying to solve by putting the same SOAPInput node usign the same WSDL at the start of two separate flows. |
|
Back to top |
|
 |
hongabonga |
Posted: Thu Apr 21, 2011 8:27 am Post subject: |
|
|
 Novice
Joined: 15 Feb 2011 Posts: 24
|
@Vitor
Actually it is confusing as well interesting to me because I never faced this situation. Perhaps, being new to WMB/MQ, I am not getting the correct view of things. Ok, see, what I was expecting that once I try to deploy the 2nd flow, WMB would prevent me from doing that. For analogy, I could say, I can not deploy two enterprise applications with the same context root, under the same Application server, right?
It stops me from deploying the 2nd app. So, likewise, I thought, it would stop me from doing this.
I do understand now that this is quite possible in WMB. Thanks for your answer. But I am still a little confused, because if this is allowed, and keeping apart the design issue, anyone can even accidentally end up having two identical endpoints in the same execution group. Won't that be tough to debug?
@mqjeff
Yes, you are absolutely correct, no idea why this is needed. A senior guy asked me to do this and I got clueless because I never tried this before. |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Apr 21, 2011 8:31 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You can deploy two message flows that both read messages from the same MQ queue, and Broker will not do anything to notice or prevent you from doing so.
likewise with two flows trying to "read" from the same URL.
You should ask your senior guy to explain why he is using the same WSDL, that defines the full contract that a given endpoint needs to support, in two message flows that presumably do two different things.
If he is hoping somehow to route different operations to one flow than the other, he is not nearly senior enough to be telling you what to do. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Apr 21, 2011 8:47 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
hongabonga wrote: |
I can not deploy two enterprise applications with the same context root, under the same Application server, right?
It stops me from deploying the 2nd app. So, likewise, I thought, it would stop me from doing this. |
Broker is not an app server. Many people before you have come unstuck treating it as if it is.
There are good reasons why you'd have 2 flows accessing the same input data. Not many, but there are some. Certainly broker doesn't prevent it.
hongabonga wrote: |
anyone can even accidentally end up having two identical endpoints in the same execution group. Won't that be tough to debug? |
Yes. That's one good reason why people don't do it, but use other broker features to achieve the same ends.
hongabonga wrote: |
A senior guy asked me to do this |
I suspect he too thinks it's an app server. When you say senior, do you mean technical or management? Because this sounds a lot like a senior technical guy trying to claim dominance over WMB by treating it like something he knows well, or a senior manager trying to implement something he read in an airline magazine once.
Fortunately, as you're new to WMB/MQ you will be expected to learn by asking questions of more senior (and therefore more experienced) people. So you'll be able to find out what's required here quite easily.
I look forward to your post with the explaination. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
hongabonga |
Posted: Thu Apr 21, 2011 9:02 am Post subject: |
|
|
 Novice
Joined: 15 Feb 2011 Posts: 24
|
Hi Vitor and mqjeff,
Yes, senior guy is technical. Can't make more comment on him , after all he is senior to me. (you know what I mean)
But, I guess, yes, my understanding is more clear now. I think its more like the difference between legal and correct.
I do have this problem; making my flows do things that they are not meant to do. I believe with more experience I will have a more accurate point of view.
However, I'd definitely thank you guys for your answers.
Always good to discuss here.  |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|