-
1. Check input parameters (bpel:condition)
objectiser Jan 10, 2011 11:17 AM (in response to izgur)Don't think there is the concept of null, so two possibilities are:
a) if element always exists, then it would probably be an empty string, so $input.payload/tns:sUsername=""
b) if element only present if a value specified, then use "exists($input.payload/tns:sUsername)"
Igor JStarter wrote:
if (myparam1 = null OR myparam2 = null OR myparam3 = null OR myparam4 = null)
go to sendReply (i saw the QUIT is not sending a reply) -> can I jump to replyOutput ??
else
execute the next bpel element
If using the same reply (i.e. normal response) in both paths, then best to put the reply following the if, and set the variable within each path - although wouldn't the first path return a fault?
Regards
Gary
-
2. Check input parameters (bpel:condition)
izgur Jan 10, 2011 1:54 PM (in response to objectiser)I almost sure it didn't return a fault using the same replyOutput if one of the else statements... I'll try it tomorrow for sure...
I pretty sure i will figure the replyOutput out... btw there is no function in BPEL like a goto ic C or jump to bpel element ???:)
But... what about the other question... is there a way to write this line
if (param1="" && param2="" &¶m3="" && param4="")
return "parameters already filled"
in BPEL :=) Can I check 4 params (check if they are empty strings) in sth like one line (not using 4 IFs) ??
The only way i tried and works to write IFs within IFs:
<bpel:if>
<bpel:condition param1="" .... >
<bpel:sequence>
<bpel:if>
<bpel:condition param2=""> .....
<bpel:sequence>
<bpel:if>
<bpel:condition param3=""> ....
But there must be a more efficient way - not using 200 lines to check if 4-5 input parameters are null or empty strings ...
Regards, Igor!
-
3. Check input parameters (bpel:condition)
jeffdelong Jan 10, 2011 1:59 PM (in response to izgur)If the input parameters are required elements in your message schema, perhaps you should use the bpel validate on the initial assign activity.
-
4. Check input parameters (bpel:condition)
izgur Jan 10, 2011 2:10 PM (in response to jeffdelong)Could you please tell sth more or provide a short example how to use BPEL VALIDATE?
Thank you in advance!
Regars, Igor!
-
5. Check input parameters (bpel:condition)
jeffdelong Jan 10, 2011 3:16 PM (in response to izgur)<bpel:assign validate="yes" name="AssignDataToRequest">
This can be set by a Checkbox in the BPEL Editor.
-
6. Check input parameters (bpel:condition)
izgur Jan 11, 2011 2:57 AM (in response to jeffdelong)CHECKING / VALIDATION
I got it know. I will test this today, got to expand the wsdl and try the validate.
But that means that I have to use/initialize all input data in this first assign validate=yes tag or are automatically all inputs validate when turning validate=yes on the first assign ?
That is help, but what about the other example...
Can I check if username=myuser and password=mypassword in one IF statement or within one condition, so that there would be only one else statement ...
SENDING ERROR REPLY
About replyOutput... i tested it know and there are no problems... i got more if/else statements and in each else I assigned an error string to the output variable and send the replyOutput... works fine...
<bpel:else>
<bpel:sequence>
<bpel:assign>
<bpel:copy>
<bpel:from>
<![CDATA[concat($output.payload/tns:sTransactionID,'Wrong password ')]]>
</bpel:from>
<bpel:to part="payload" variable="output">
<bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[tns:sTransactionID]]></bpel:query>
</bpel:to>
</bpel:copy>
</bpel:assign>
<bpel:reply name="replyOutput"
partnerLink="client"
portType="tns:alertUsers"
operation="process"
variable="output"
/>
</bpel:sequence>
</bpel:else>
-
7. Check input parameters (bpel:condition)
izgur Jan 11, 2011 5:08 AM (in response to izgur)Hey, the validate="yes" does nothing. What am I missing ?
I think there is nothing to change in the wsdl. I think i got this right. Element in the XSD is required if minOccurs="1" and maxOccurs="1".
And if none of these 2 are set, the default valuest are 1 and 1.
That's why I think you have only to set the validate right. How ?
Is the validate checking only the elements inside the assign tag. I think I shouldn't initialize the input in the first assign ... how can i get it validate ??
-
8. Check input parameters (bpel:condition)
objectiser Jan 11, 2011 5:37 AM (in response to izgur)Hi Igor
It appears as if ODE does not support the 'validate' capability - on the http://ode.apache.org/ws-bpel-20-specification-compliance.html page, it says:
"The specification also provides for validating variables at the end of an assignment using the validate attribute. ODE does not support this. This means that the bpel:invalidVariables fault is never thrown by an <assign> activity."
Going back to a previous question of yours, you should be able to do:
expr1 and expr2 and expr3 ....
instead of separate 'if' statements. Have you tried this?
Regards
Gary
-
9. Check input parameters (bpel:condition)
izgur Jan 11, 2011 8:33 AM (in response to objectiser)Yes, i read too that validate is not supported. But because of previous posts I thought only the bpel:validate isn't supported, but bpel:assign validate=yes is. So there is not way validating input...
How do you think expr1 and expr2 and expr3 .... would work ??
Tests:
it returns The XPath segment "child::tns:sUsername" cannot be resolved. If I change the order, child::tns:sPassword" cannot be resolved
<bpel:condition expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[$input.payload/tns:sPassword="kkiss" and $input.payload/tns:sUsername="kkiss"]]></bpel:condition>
not valid xpath expression
<bpel:condition expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[$input.payload/tns:sPassword="kkissuser"]] and [CDATA[$input.payload/tns:sUsername="kkisspasss"]]></bpel:condition>
What would be the correct syntax ?
-
10. Check input parameters (bpel:condition)
objectiser Jan 12, 2011 5:11 AM (in response to izgur)Hi Igor
I thought the first syntax should work - anyone else see what is wrong with it?
Regards
Gary
-
11. Check input parameters (bpel:condition)
bbrodt Jan 12, 2011 1:24 PM (in response to izgur)Hmm, the first one should be correct, i.e.:
<bpel:condition expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[$input.payload/tns:sPassword="kkiss" and $input.payload/tns:sUsername="kkiss"]]></bpel:condition>
I have no idea what the problem could be