title: How to cast a variable extracted from a payload in citrus framework?
body: <p>I'm creating IT tests with <a href="http://www.citrusframework.org/" rel="nofollow">Citrus Framework</a>. I have two calls to the server, one for creating a user and another one for performing some operation with that user. </p>
  
  <p>Problem: I need a value from the create user request that is not a String, to put it in the request of the second call. Extraction of the value:</p>
  
  <pre><code>new SoapActionBuilder()
           .client(webServiceClient)
           .receive()
           .namespace("ns", MY_NAMESPACE)
           .extractFromPayload("//ns:someId", "someId")
  </code></pre>
  
  <p>And then this <em>someId</em> has to be used for building the next request. If it was a String it would be:</p>
  
  <pre><code>request.setSomeId("${someId}");
  </code></pre>
  
  <p>But it is a Long, so doing the casting doesn't work (Citrus resolves that value later on, and Long#valueOf is executed in that very moment):</p>
  
  <pre><code>request.setSomeId(Long.valueOf("${someId}"));
  </code></pre>
  
  <p><strong>Is there any way to easily cast that variable (maybe on extraction)?</strong> </p>
  
  <p>I manage to do it with a JavaAction, but is very weird for using it regularly (3 lines and a new method are needed). It's something like:</p>
  
  <pre><code>public void test() {
      ...
      action(new JavaActionBuilder(new JavaAction().setInstance(this))
              .method("setSomeId")
              .methodArgs(request, "${someId}"));
  
      ...
  }
  public void setSomeId(Request request, String someId) {
      request.setSomeId(Long.valueOf(someId));
  }
  </code></pre>