Forum Discussion

Mita's avatar
Mita
New Contributor
6 years ago

Counting element value based on values of the other elements

Hi all,

 

I have this Soap request:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:v1="http://localhost/pay/pay-ws/proc/v1" 
xmlns:type="http://localhost/pay/pay-ws/proc/v1/type">
   <soapenv:Header/>
   <soapenv:Body>
      <v1:processRefund>
         <v1:refundRequest>
           <type:messageId>${=new java.text.SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date())}</type:messageId>
            <type:provider>1234</type:provider>
            <type:merchantNumber>123456789</type:merchantNumber>
            <type:paymentNumber>123456789</type:paymentNumber>
            <type:amount>107</type:amount>
            <type:signature>${new java.function.forSignature("[value from <messageId> element]|[value from <provider> element]...")}</type:signature>
         </v1:refundRequest>
      </v1:processRefund>
   </soapenv:Body>
</soapenv:Envelope>

Is it possible to read values (fixed or counted - function based) from elements and use them in function in other element (signature in this case)?

 

Thanks

  • avidCoder's avatar
    avidCoder
    Super Contributor

    Mita - I couldn't understand the context. Would you like to elaborate please?

    What you want to achieve here? and the use cases please.

    • Mita's avatar
      Mita
      New Contributor

      I need count value into element <signature> based on values in other elements. In element <signature> will be Java function counts signature using private key and values from others elements.

       

      Final request will be something like this:

      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://gpe.cz/pay/pay-ws/proc/v1" xmlns:type="http://gpe.cz/pay/pay-ws/proc/v1/type">
         <soapenv:Header/>
         <soapenv:Body>
            <v1:getPaymentStatus>
               <v1:paymentStatusRequest>
                  <type:messageId>20190313132943615</type:messageId>
                  <type:provider>1234</type:provider>
                  <type:merchantNumber>9999999101</type:merchantNumber>
                  <type:paymentNumber>20190221154803</type:paymentNumber>
                  <type:signature>Jjydw6yw63fwiPd1fSO8Q1sKFnfEr2/JCZaAUJ/ExJCj+AgnS0bzXQ7h/5j3C5wS6MmlPU6vTXYGZy937DkZSilaDJdQgqhlN839kehgG8C8bvfRkhKeB0+JdFttHh3FX9Xo1drcvw2nvmXf2UGYvsaU0CzjldmSDac/ZoClwQFyJ4WQvTOnrsomwKP4NfjgVhb4C5gSkcPtErXFwJ2zNIpgd6zvc4u4TZ07lOnNpLqrY4o8MWE0fg+uCp4ymdXHPDyCTjTrLBrqWSsBTdZgPE9kd54siyMGpSKJ5as7NzXtAfVwFjo3Bu75fIYStg+/5yyPj8GRZiOZ6Ks0UrD+Mg==</type:signature>
               </v1:paymentStatusRequest>
            </v1:getPaymentStatus>
         </soapenv:Body>
      </soapenv:Envelope>

      The source for it is:

      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://gpe.cz/pay/pay-ws/proc/v1" xmlns:type="http://gpe.cz/pay/pay-ws/proc/v1/type">
         <soapenv:Header/>
         <soapenv:Body>
            <v1:getPaymentStatus>
               <v1:paymentStatusRequest>
                  <type:messageId>${=new java.text.SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date())}</type:messageId>
                  <type:provider>1234</type:provider>
                  <type:merchantNumber>9999999101</type:merchantNumber>
                  <type:paymentNumber>20190221154803</type:paymentNumber>
                  <type:signature>${new java.function.forSignature("[value from <messageId> element]|[value from <provider> element]...")}</type:signature>
               </v1:paymentStatusRequest>
            </v1:getPaymentStatus>
         </soapenv:Body>
      </soapenv:Envelope>

      The element <messageId> has dynamical value, based on Date. So value in <signature> element is dynamical too (based on dynamically counted value in element <messageId>).

       

      My question is - if is it possible somewhere take final (dynamically counted) value from <messageId> element and use it in dynamically counted function in element <signature> in one step using button "Submit request" (as a value in element <messageId> is counted before submitting)?