BPEL Assign expression count(nodes) returns double - wso2

Using wso2bps-3.5.1
The count() of nodes in my Assign activity is assigned to an Integer typed element (verifyTerminationRequest/connections):
<bpel:copy>
<bpel:from expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
<![CDATA[count($closeAccountResponse.closeAccountResponsePart/xclac:accountConnections/xcom:accountConnection)]]>
</bpel:from>
<bpel:to part="parameters" variable="verifyTerminationRequest">
<bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[wvete:verifyTerminationRequestMessage[1]/wvete:connections]]></bpel:query>
</bpel:to>
</bpel:copy>
For some reason the resulting message looks like this:
<verifyTerminationRequest xmlns="http://seb.se/ops/ica/vete/wsdl">
<ax2410:verifyTerminationRequestMessage xmlns:ax2410="http://seb.se/ops/ica/vete/wsdl">
<ax2410:connections>2.0</ax2410:connections>
</ax2410:verifyTerminationRequestMessage>
</verifyTerminationRequest>
And verifyTerminationRequestMessage/connections = 2.0 throws an exception:
Fault Name {http://seb.se/ops/ica/vete/wsdl}UnknownFault
Fault Data
<?xml version="1.0" encoding="UTF-8"?><message>
<Fault>
<faultcode>soapenv:Server</faultcode>
<faultstring>java.lang.NumberFormatException: For input string: "2.0"</faultstring>
</Fault>
</message>
Error Line 356
Why?
I've tried with round(count(...)) with no success.

try number function - number(count()) it works for me.

Related

Prestashop Webservices - Property OrderDetail->product_price is empty on order creation

I'm trying to create orders thanks to Prestashop WebServices. I successfully created Customers, Addresses and Carts but Order creation is crashing. Here is the error I get using the following curl request :
curl -i -X POST -d #tmpOrder.text http://secretKey#localhost:8888/api/orders
Property OrderDetail->product_price is empty
Here are the XML files I use to create my cart (and trying to create my order.
tmpCart.text
<?xml version="1.0" encoding="UTF-8"?>
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<cart>
<id></id>
<id_address_delivery>6</id_address_delivery>
<id_address_invoice>6</id_address_invoice>
<id_currency>1</id_currency>
<id_customer>2</id_customer>
<id_guest></id_guest>
<id_lang>1</id_lang>
<id_shop_group>1</id_shop_group>
<id_shop>1</id_shop>
<id_carrier>2</id_carrier>
<recyclable></recyclable>
<gift></gift>
<gift_message></gift_message>
<mobile_theme></mobile_theme>
<delivery_option></delivery_option>
<secure_key></secure_key>
<allow_seperated_package></allow_seperated_package>
<date_add></date_add>
<date_upd></date_upd>
<associations>
<cart_rows>
<cart_row>
<id_product>2</id_product>
<product_price>26.999852</product_price>
<id_product_attribute>1</id_product_attribute>
<id_address_delivery>6</id_address_delivery>
<quantity>2</quantity>
</cart_row>
</cart_rows>
</associations>
</cart>
</prestashop>
tmpOrder.txt
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink">
<order>
<id></id>
<id_address_delivery>6</id_address_delivery>
<id_address_invoice>6</id_address_invoice>
<id_cart>42</id_cart>
<id_currency>1</id_currency>
<id_lang>1</id_lang>
<id_customer>2</id_customer>
<id_carrier>2</id_carrier>
<current_state>1</current_state>
<module>cheque</module>
<payment>Chèque</payment>
<total_paid>1</total_paid>
<total_paid_real>54</total_paid_real>
<total_products>2</total_products>
<total_products_wt>54</total_products_wt>
<conversion_rate>1</conversion_rate>
<reference></reference>
<associations>
<order_rows>
<order_row>
<id></id>
<product_id>2</product_id>
<product_attribute_id>1</product_attribute_id>
<product_quantity>2</product_quantity>
<product_name>TEST</product_name>
<product_reference></product_reference>
<product_ean13></product_ean13>
<product_upc></product_upc>
<product_price>26.999852</product_price>
<unit_price_tax_incl>26.999852</unit_price_tax_incl>
<unit_price_tax_excl>26.999852</unit_price_tax_excl>
</order_row>
</order_rows>
</associations>
</order>
</prestashop>
I finally found out what is wrong. It seems that the product_attribute_id of my product was wrong. Therefore, it was looking for an inexistent price in the prices array.

forEach loop in BPEL (WSO2 BPS)

I am not able to figure out the root cause for the problem, why the forEach loop is not working,
<bpel:forEach name="eachMarket" parallel="no" counterName="marketCounter">
<bpel:startCounterValue>1</bpel:startCounterValue>
<bpel:finalCounterValue>count($input.payload/tns:DCTResponse/tns:DCTIDs/tns:DCTID)</bpel:finalCounterValue>
<bpel:scope>
<bpel:assign>
<bpel:copy ignoreMissingFromData="yes" insertMissingToData="yes">
<bpel:from>$input.payload/tns:DCTResponse/tns:DCTIDs/tns:DCTID[round($marketCounter)]/tns:DEFTYPE</bpel:from>
<bpel:to>$OrderParameterPLRequest.parameters/ns:DCTResponse/ns:DCTIDs/ns:DCTID[round($marketCounter)]/ns:DEFTYPE</bpel:to>
</bpel:copy>
<bpel:copy ignoreMissingFromData="yes" insertMissingToData="yes">
<bpel:from>$input.payload/tns:DCTResponse/tns:DCTIDs/tns:DCTID[round($marketCounter)]/tns:MarketName</bpel:from>
<bpel:to>$OrderParameterPLRequest.parameters/ns:DCTResponse/ns:DCTIDs/ns:DCTID[round($marketCounter)]/ns:MarketName</bpel:to>
</bpel:copy>
<bpel:copy ignoreMissingFromData="yes" insertMissingToData="yes">
<bpel:from>$input.payload/tns:DCTResponse/tns:DCTIDs/tns:DCTID[round($marketCounter)]/tns:DCTID</bpel:from>
<bpel:to>$OrderParameterPLRequest.parameters/ns:DCTResponse/ns:DCTIDs/ns:DCTID[round($marketCounter)]/ns:DCTID</bpel:to>
</bpel:copy>
</bpel:assign>
</bpel:scope>
</bpel:forEach>
<bpel:forEach name="eachParameter" parallel="no" counterName="parameterCounter">
<bpel:startCounterValue>1</bpel:startCounterValue>
<bpel:finalCounterValue>count($input.payload/tns:DCTResponse/tns:AdditionalParamters/tns:Parameter)</bpel:finalCounterValue>
<bpel:scope name="parameterScope">
<bpel:assign>
<bpel:copy ignoreMissingFromData="yes" insertMissingToData="yes">
<bpel:from>$input.payload/tns:DCTResponse/tns:AdditionalParamters/tns:Parameter[$parameterCounter]/tns:Name</bpel:from>
<bpel:to>$OrderParameterPLRequest.parameters/ns:DCTResponse/ns:AdditionalParamters/ns:Parameter[$parameterCounter]/ns:Name</bpel:to>
</bpel:copy>
<bpel:copy ignoreMissingFromData="yes" insertMissingToData="yes">
<bpel:from>$input.payload/tns:DCTResponse/tns:AdditionalParamters/tns:Parameter[$parameterCounter]/tns:Value</bpel:from>
<bpel:to>$OrderParameterPLRequest.parameters/ns:DCTResponse/ns:AdditionalParamters/ns:Parameter[$parameterCounter]/ns:Value</bpel:to>
</bpel:copy>
</bpel:assign>
</bpel:scope>
</bpel:forEach>
Input will contain multiple Ids,
<p:DCTIDs>
<p:DCTID>
<p:DEFTYPE>acvinclis</p:DEFTYPE>
<p:MarketName>pectoreflammas</p:MarketName>
<p:DCTID>3</p:DCTID>
</p:DCTID>
<p:DCTID>
<p:DEFTYPE>acvinclis</p:DEFTYPE>
<p:MarketName>pectoreflammas</p:MarketName>
<p:DCTID>3</p:DCTID>
</p:DCTID>
<p:DCTID>
<p:DEFTYPE>acvinclis</p:DEFTYPE>
<p:MarketName>pectoreflammas</p:MarketName>
<p:DCTID>3</p:DCTID>
</p:DCTID>
</p:DCTIDs>
Error message:
faultExplanation={http://docs.oasis-open.org/wsbpel/2.0/process/executable}selectionFailure: No results for expression: '$OrderParameterPLRequest.parameters/ns:DCTResponse/ns:DCTIDs/ns:DCTID[round($marketCounter)]/ns:DEFTYPE' against '
This question is probably not relevant for the original poster anymore, but I wanted to include an answer in case anybody else has the same problem.
If you want to get the DEFTYPE of the DCTID at position $Counter, use the following XPath:
($input.payload/tns:DCTResponse/tns:DCTIDs/tns:DCTID)[position() = $Counter]/tns:DEFTYPE
Two things are important here:
Put parentheses around the entire expression up to DTCID. For the reason why, see https://stackoverflow.com/a/8336922/5986352
While [1], [2], etc. will work, [$Counter] will not work. Instead, use [position() = $Counter]. You can also use position() to perform some more complex queries, e.g., [position() < 3] in order to select the first two nodes from a certain set.

EWS: unexpected SOAP validation error from Exchange 2013

I make a request with JAX-WS:
GetItemType itemRequest = new GetItemType()
.withItemShape(new ItemResponseShapeType()
.withBaseShape(DefaultShapeNamesType.ID_ONLY)
.withAdditionalProperties(new NonEmptyArrayOfPathsToElementType()
.withPath(objectFactory.createFieldURI(new PathToUnindexedFieldType()
.withFieldURI(UnindexedFieldURIType.ITEM_WEB_CLIENT_EDIT_FORM_QUERY_STRING)
)
)
)
)
.withItemIds(new NonEmptyArrayOfBaseItemIdsType()
.withItemIdOrOccurrenceItemIdOrRecurringMasterItemId(new ItemIdType()
.withId(id)
)
);
Which yields a soap message:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<ns3:MailboxCulture xmlns:ns3="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:ns2="http://schemas.microsoft.com/exchange/services/2006/messages">nb-NO</ns3:MailboxCulture>
</soap:Header>
<soap:Body>
<GetItem xmlns="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:ns2="http://schemas.microsoft.com/exchange/services/2006/types">
<ItemShape>
<ns2:BaseShape>IdOnly</ns2:BaseShape>
<ns2:AdditionalProperties>
<ns2:FieldURI FieldURI="item:WebClientEditFormQueryString"/>
</ns2:AdditionalProperties>
</ItemShape>
<ItemIds>
<ns2:ItemId Id="AQAZAEF4ZWwuV2F0aG5lQHNwYXJlYmFuazEubm8ARgAAA7k+kh3x38JJgjb3IcQO3bAHAP4YJIRG6m5GkZN2+/hve1MAAAIBEAAAAP4YJIRG6m5GkZN2+/hve1MAAAIbBgAAAA=="/>
</ItemIds>
</GetItem>
</soap:Body>
</soap:Envelope>
And get this response:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<s:Fault>
<faultcode xmlns:a="http://schemas.microsoft.com/exchange/services/2006/types">a:ErrorSchemaValidation</faultcode>
<faultstring xml:lang="nb-NO">The request failed schema validation: The 'FieldURI' attribute is invalid - The value 'item:WebClientEditFormQueryString' is invalid according to its datatype 'http://schemas.microsoft.com/exchange/services/2006/types:UnindexedFieldURIType' - The Enumeration constraint failed.</faultstring>
<detail>
<e:ResponseCode xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">ErrorSchemaValidation</e:ResponseCode>
<e:Message xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">The request failed schema validation.</e:Message>
<t:MessageXml xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<t:LineNumber>1</t:LineNumber>
<t:LinePosition>534</t:LinePosition>
<t:Violation>The 'FieldURI' attribute is invalid - The value 'item:WebClientEditFormQueryString' is invalid according to its datatype 'http://schemas.microsoft.com/exchange/services/2006/types:UnindexedFieldURIType' - The Enumeration constraint failed.</t:Violation>
</t:MessageXml>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>
So it seems to not like the value item:WebClientReadFormQueryString, but this seems correct to me, according to the enumeration in types.xsd from EWS:
<xs:simpleType name="UnindexedFieldURIType">
<xs:restriction base="xs:string">
...
<xs:enumeration value="item:WebClientReadFormQueryString"/>
Does anyone understand this validation error, or is it a bug?
Exchange version is 15.0.913.19
Try adding a RequestServerVersion element in your SOAP header and setting it to at least Exchange2010.

Not able pass array value in wso2 BPS

My Input Request is:
<body>
<p:UpdateEntID xmlns:p="http://tempuri.org/">
<!--1 or more occurrences-->
<xs:OldID xmlns:xs="http://tempuri.org/">GenreID_002</xs:OldID>
<xs:OldID xmlns:xs="http://tempuri.org/">GenreID_0021</xs:OldID>
<!--Exactly 1 occurrence-->
<xs:NewID xmlns:xs="http://tempuri.org/">GenreID_001</xs:NewID>
</p:UpdateEntID>
</body>
How to assign both the input values i.e OldID to wsdl's Input variable EquivalentEntPLRequest?
My assign is:
<bpel:assign validate="no" name="AssignInputForUpdateID">
<bpel:copy>
<bpel:from>
<bpel:literal>
<ns0:UpdateEntID xmlns:ns0="http://tempuri.org/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><ns0:newid>ns0:newid</ns0:newid>
<ns0:oldid>ns0:oldid</ns0:oldid>
</ns0:UpdateEntID>
</bpel:literal>
</bpel:from>
<bpel:to variable="EquivalentEntPLRequest" part="parameters"></bpel:to>
</bpel:copy>
<bpel:copy>
<bpel:from part="parameters" variable="clientRequest6">
<bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[tns:NewID]]></bpel:query>
</bpel:from>
<bpel:to part="parameters" variable="EquivalentEntPLRequest">
<bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
<![CDATA[ns3:newid]]>
</bpel:query>
</bpel:to>
</bpel:copy>
<bpel:copy>
<bpel:from part="parameters" variable="clientRequest6">
<bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[tns:OldID[1]]]></bpel:query>
</bpel:from>
<bpel:to part="parameters" variable="EquivalentEntPLRequest">
<bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[ns3:oldid[1]]]></bpel:query>
</bpel:to>
</bpel:copy>
</bpel:assign>
By the above assign i am able to map single value of request to single value of response.So how can i map multiple inputs of bpel input to multiple input of wsdl input?Thanks in advance

How to traverse a list of ints in a BPEL process

I am building a BPEL process in Netbeans 6.8 and I invoke a Web Service that returns a list of ints.
<xs:complexType name="getHotelsResponse">
<xs:sequence>
<xs:element name="return" type="xs:int" minOccurs="0" maxOccurs="unbounded"></xs:element>
</xs:sequence>
</xs:complexType>
I want (if possible - not sure anymore...) to iterate through all those ints and invoke a different Web Service for each one of them.
I tried using a ForEach activity, but I can't figure out the usage for my case.
It requires a Start Value and an End Value (if I could somehow get how many ints I got back) but even then inside the ForEach activity if say I put an Assign activity how do I get the current element of the list in each loop?
I used following BPEL snippet to concat the content of a list in to a comma separated string.
You can use the same code with an invoke to call external service.
<bpel:forEach parallel="no" counterName="Counter" name="ForEach">
<bpel:startCounterValue>
<![CDATA[1]]>
</bpel:startCounterValue>
<bpel:finalCounterValue><![CDATA[count($input.payload/tns:return)]]></bpel:finalCounterValue>
<bpel:scope>
<bpel:assign validate="no" name="AppendItem">
<bpel:copy>
<bpel:from>
<![CDATA[concat($Response, $input.payload/tns:return[round($Counter)], ", ")]]>
</bpel:from>
<bpel:to variable="Response"></bpel:to>
</bpel:copy>
</bpel:assign>
</bpel:scope>
</bpel:forEach>
You can get the count of elements from the following XPath
count($input.payload/tns:return)
You can access value of the i th element using the following XPath
$input.payload/tns:return[round($Counter)]
You may get rid of the round() function, but I had to use to get rid of an issue in Apache ODE.