Typecasting in WSO2 - wso2

I have a property in my wso2 integration studio that stores the result of an arithmetic operation. The value of this property that is displayed in the logs is 12.0, how can I convert this property to integer type and make it 12?

Related

WSO2 ESB problem with convert xml to json

I use property mediator to convert xml to json <property name="messageType" scope="axis2" type="STRING" value="application/json"/>
It's work, but when the xml message contains a number like 50103015080000000550022052 then after converting to json the value changes to 5.010301508E25.
I need to have the original value. Any idea how to do this?
Thanks in advance.
This happens due to the auto primitive feature available with the wso2 ESB servers. Here when a conversion happens from XML JSON primitive types are automatically identified. Therefore the number 50103015080000000550022052 is identified as a number and represented in the scientific notation.
The auto primitive feature is by default enabled in the EI server [1].
We can disable the auto primitive feature globally by configuring synapse.commons.json.output.autoPrimitive=false in the following location. And this will be applied for all the primitive data types globally.
[EI_HOME]/conf/synapse.properties
Also, we can also disable the auto primitive feature only for a set of data by providing a regex pattern. If you want to disable the auto primitive feature only for the above data set you configure the following in [EI_HOME]/conf/synapse.properties file.
synapse.commons.json.output.disableAutoPrimitive.regex=^-?(0|[1-9][0-9]*)(.[0-9]+)?$
After configuring the above please restart the servers.
[1]-https://docs.wso2.com/display/EI650/Working+with+JSON+Message+Payloads

How to use > and < operators in SharePoint search API?

I am using SharePoint Search API and referring link SharePoint Search REST API overview. I want to use property operators. Please refer 'Property operators that are supported in property restrictions' section in link Keyword Query Language (KQL) syntax reference
I am forming query as http://server/_api/search/query?querytext='AmountCurrency > 10.50'&selectproperties='Title,Author'
Similarly http://server/_api/search/query?querytext='AmountNumber < 20.50'&selectproperties='Title,Author'
In above queries AmountCurrency and AmountNumber are managed properties for Currency column and Number column respectively. But search api not returing any row. For me : and = operators are working fine. How to use greater than and less than operators in search API?
Make sure the field name you are using is defined in the Managed Properties in the Search Schema.
Or you can build the query using SharePoint Search Query Tool.
Got it. It is due to the managed property type. Following are the available types when we create managed properties.
Text
Integer
Decimal
Date and Time
Yes/No
Double precision float
Binary
When managed property gets created automatically for site columns, the default type is Text. While creating managed property manually only Search Service Application administrator can choose any type. All other users can choose either Text or Yes/No.
I am not SSA Administrator. So I have used default unused managed properties. Please refer https://technet.microsoft.com/en-us/library/jj219667.aspx#Anchor_8. Used RefinableDecimal00 and RefinableDecimal01 and mapped appropriate crawled property to them. Now everything is working fine

how to remove the type attribute in property in wso2 esb developer studio

When i create a property element in WSO2 ESB it allows me to create without the "type" attribute being mentioned like
However while using the WSO2 developer studio to generate the property in one of the sequences it kind of mandates the 'type' attribute to be present . Is there an option to override it.
i tried removing the attribute in source view and tried saving it . But it overrides and invoked the attribute during save.
The attribute 'type' is mandatory in developer studio. If you are creating the sequence through the design view and you didn't define type it will consider as String by default.
If you are creating the sequence through the source view and you didn't define type or remove the type and save it will consider as OMElement by default.

Blank value in web service for Int64 type

I consume a web service that has a numeric element. The Delphi wsdl importer sets it up as Int64.
The web service allows this element to be blank. However, because it is defined as Int64, when I consume the web service in Delphi without setting a value for it, it defaults to 0 because it's an Int64. But I need it to be blank and the web service will not accept a value of 0 (0 is defined as invalid and returns an error by the web service).
How can I pass a blank value if the type is Int64?
Empty age (example)
<E06_14></E06_14>
could have a special meaning, for example be "unknown" age.
In this case, the real question is how to make the field nillable on the Delphi side.
From this post of J.M. Babet:
Support for 'nil' has been an ongoing issue. Several built-in types of
Delphi are not nullable. So we opted to use a class for these cases
(not elegant but it works). So with the latest update for Delphi 2007
I have added several TXSxxxx types to help with this. Basically:
TXSBoolean, TXSInteger, TXSLong, etc. TXSString was already there but
it was not registered. Now it is. When importing a WSDL you must
enable the Use 'TXSString for simple nillable types' option to make
the importer switch to TXSxxxx types. On the command line it is the
"-0z+" option.
The DocWiki for the Import WSDL Wizard also shows two options related to nillable elements:
Process nillable and optional elements - Check this option to make the WSDL importer generate relevant information about optional
and nillable properties. This information is used by the SOAP runtime
to allow certain properties be nil.
Use TXSString for simple nillable types - The WSDL standard allows simple types to be nil, in Delphi or NULL, in C++, while Delphi
and C++ do not allow that. Check this option to make the WSDL importer
overcome this limitation by using instances of wrapper classes.

Dynamics CRM 2011 Mocking

I have been setting up some unit tests for a service which surfaces Dynamics CRM 2011 data via the SDK and using Mocks to simulate the transactions. This works ok for most of the simple transactions, however, now I need to test a method which utilises the RetrieveAttributeRequest message from the SDK to retrieve OptionSetValue labels. To be able to Mock the returned object would require knowledge of exactly how this method is retrieving the attribute data, but I have not been able to find this information.
1) Is this the correct way to approach this problem, or are we left with an integration test as the main option.
2) If this is valid then which table is the data requested from?
Thanks.
To (only!) answer the second part of your question, OptionSetValues are stored in the StringMap table, key fields being AttributeName (the OptionSet field name), AttributeValue (the integer value of the OptionSetValue), Value (the string value), and ObjectTypeCode (the integer identifier of the related entity).
For reference: We ended up abstracting our 'GetOptionSetMetadata' method (which utilises the RetrieveAttributeRequest') into a Common interface. Then created a Mock implementation of the method which purely returned a Dictionary representing the Label and Value option set values. That way we circumvent the need to actually mock the specific returned object in the mockServiceContext.