You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ode.apache.org by Serkan Camurcuoglu <Se...@telenity.com> on 2009/04/02 15:22:04 UTC

int-string conversion

Hi all,
We have a problem with assigning from an int variable to a string 
variable. For example, when we assign an int variable with a value of 2 
to a string variable using the string() function, the result string is 
"2.0". However, the partner link that we call requires it to be "2". I 
know we can overcome this problem by using substring etc. but we want 
our bpel code to run on multiple bpel engines (e.g. both ODE and 
ActiveVOS) so we need a standard solution. Is there a better way to 
achieve this conversion?

Best regards,

SerkanC


Re: int-string conversion

Posted by "Ford, Mark" <ma...@ll.mit.edu>.
The code works as expected in ActiveVOS because the copy operations respect the underlying declared data types. Converting a variable or message part of type xs:int to a string will be done with java.lang.Integer.

You can configure ActiveVOS to support Xpath 2.0 using ODE's expression language URI's. The directions can be found here:

http://forums.activevos.com/showthread.php?t=3139&highlight=Xquery

These are from a previous release but the concept is still the same.

If you're looking for a solution that will work across all vendors without having to modify your BPEL per vendor or configure each installation then you either need to stick with Xpath 1.0 or use XSLT. XSLT offers a format-number function which will do exactly what you want. You could probably also solve this with Xpath 1.0 and substring-before but it's probably multiple steps which will make it ugly in your BPEL.


On 4/2/09 10:59 AM, "Serkan Camurcuoglu" <Se...@telenity.com> wrote:

The thing is, the same expression works the way we want in ActiveVOS
(i.e. it returns the string "2") while it works as I explained
previously in ODE (it returns "2.0"). Do you mean that if we used xpath
2.0 then this expression would work correctly in ODE? But AFAIK
ActiveVOS does not have xpath 2.0 support..



Matthieu Riou wrote:
> On Thu, Apr 2, 2009 at 6:22 AM, Serkan Camurcuoglu <
> Serkan.Camurcuoglu@telenity.com> wrote:
>
>
>> Hi all,
>> We have a problem with assigning from an int variable to a string variable.
>> For example, when we assign an int variable with a value of 2 to a string
>> variable using the string() function, the result string is "2.0". However,
>> the partner link that we call requires it to be "2". I know we can overcome
>> this problem by using substring etc. but we want our bpel code to run on
>> multiple bpel engines (e.g. both ODE and ActiveVOS) so we need a standard
>> solution. Is there a better way to achieve this conversion?
>>
>>
>
> Does ActiveVOS has XPath 2.0 support? I haven't tried this particular
> conversion but my guess is that it would work a bit better.
>
> Matthieu
>
>
>
>> Best regards,
>>
>> SerkanC
>>
>>
>>
>
>





--
Mark Ford
MIT Lincoln Laboratory
244 Wood Street
Lexington MA 02420
(781) 981-1843

Re: int-string conversion

Posted by Serkan Camurcuoglu <Se...@telenity.com>.
The thing is, the same expression works the way we want in ActiveVOS 
(i.e. it returns the string "2") while it works as I explained 
previously in ODE (it returns "2.0"). Do you mean that if we used xpath 
2.0 then this expression would work correctly in ODE? But AFAIK 
ActiveVOS does not have xpath 2.0 support..



Matthieu Riou wrote:
> On Thu, Apr 2, 2009 at 6:22 AM, Serkan Camurcuoglu <
> Serkan.Camurcuoglu@telenity.com> wrote:
>
>   
>> Hi all,
>> We have a problem with assigning from an int variable to a string variable.
>> For example, when we assign an int variable with a value of 2 to a string
>> variable using the string() function, the result string is "2.0". However,
>> the partner link that we call requires it to be "2". I know we can overcome
>> this problem by using substring etc. but we want our bpel code to run on
>> multiple bpel engines (e.g. both ODE and ActiveVOS) so we need a standard
>> solution. Is there a better way to achieve this conversion?
>>
>>     
>
> Does ActiveVOS has XPath 2.0 support? I haven't tried this particular
> conversion but my guess is that it would work a bit better.
>
> Matthieu
>
>
>   
>> Best regards,
>>
>> SerkanC
>>
>>
>>     
>
>   


Re: int-string conversion

Posted by Matthieu Riou <ma...@gmail.com>.
On Thu, Apr 2, 2009 at 6:22 AM, Serkan Camurcuoglu <
Serkan.Camurcuoglu@telenity.com> wrote:

> Hi all,
> We have a problem with assigning from an int variable to a string variable.
> For example, when we assign an int variable with a value of 2 to a string
> variable using the string() function, the result string is "2.0". However,
> the partner link that we call requires it to be "2". I know we can overcome
> this problem by using substring etc. but we want our bpel code to run on
> multiple bpel engines (e.g. both ODE and ActiveVOS) so we need a standard
> solution. Is there a better way to achieve this conversion?
>

Does ActiveVOS has XPath 2.0 support? I haven't tried this particular
conversion but my guess is that it would work a bit better.

Matthieu


>
> Best regards,
>
> SerkanC
>
>

Re: int-string conversion

Posted by Alex Boisvert <bo...@intalio.com>.
>From XPath 1.0 spec section 4.2, the string() function:

*[...] A number is converted to a string [...] *if the number is an integer,
the number is represented in decimal form as a
Number<http://www.w3.org/TR/xpath#NT-Number>with no decimal point and
no leading zeros,

So it could be an issue with Ode, although we would need a full BPEL code to
verify.   Please file an issue.

alex

On Thu, Apr 2, 2009 at 6:22 AM, Serkan Camurcuoglu <
Serkan.Camurcuoglu@telenity.com> wrote:

> Hi all,
> We have a problem with assigning from an int variable to a string variable.
> For example, when we assign an int variable with a value of 2 to a string
> variable using the string() function, the result string is "2.0". However,
> the partner link that we call requires it to be "2". I know we can overcome
> this problem by using substring etc. but we want our bpel code to run on
> multiple bpel engines (e.g. both ODE and ActiveVOS) so we need a standard
> solution. Is there a better way to achieve this conversion?
>
> Best regards,
>
> SerkanC
>
>