# How to use response body as a request body for next call

**URL:** <https://community.postman.com/t/how-to-use-response-body-as-a-request-body-for-next-call/31242>\
**Category:** Help Hub\
**Created:** [January 4, 2022, 6:39pm UTC](https://community.postman.com/t/how-to-use-response-body-as-a-request-body-for-next-call/31242 "2022-01-04T18:39:23Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![harutharut](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/harutharut/32/6996_2.png) [@harutharut](https://community.postman.com/u/harutharut)\
**Post date:** [January 4, 2022, 6:39pm UTC](https://community.postman.com/t/how-to-use-response-body-as-a-request-body-for-next-call/31242/1 "2022-01-04T18:39:23Z")

</div>

Hi everybody,  
How can I use first call’s response body in my next endpoint as a request body(raw)?  
I have set first call’s response body in my environment, after which I have no idea how can I get and use it as a request body in my next endpoint.  
Thanks in advance.

 ![setResponse](https://us1.discourse-cdn.com/getpostman/original/3X/d/1/d15b539e56cfe82ecf75400f3ce15d510eff91dd.png)

@bpricilla please help 🙂

---

<div class="post-metadata">

**Author:** ![harutharut](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/harutharut/32/6996_2.png) [@harutharut](https://community.postman.com/u/harutharut)\
**Post date:** [January 11, 2022, 12:09pm UTC](https://community.postman.com/t/how-to-use-response-body-as-a-request-body-for-next-call/31242/2 "2022-01-11T12:09:11Z")

</div>

could anyone help me, please?

---

<div class="post-metadata">

**Author:** ![jfbriere](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/jfbriere/32/8444_2.png) [@jfbriere](https://community.postman.com/u/jfbriere)\
**Post date:** [January 11, 2022, 3:56pm UTC](https://community.postman.com/t/how-to-use-response-body-as-a-request-body-for-next-call/31242/3 "2022-01-11T15:56:13Z")

</div>

Simply put {{signResponse}} in the raw body (of JSON type) of the next request:

 ![image](https://us1.discourse-cdn.com/getpostman/original/2X/7/73abd25d2fc2e59094ebd3693451fad833f5b6ee.png)

---

<div class="post-metadata">

**Author:** ![harutharut](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/harutharut/32/6996_2.png) [@harutharut](https://community.postman.com/u/harutharut)\
**Post date:** [January 12, 2022, 9:01am UTC](https://community.postman.com/t/how-to-use-response-body-as-a-request-body-for-next-call/31242/4 "2022-01-12T09:01:57Z")

</div>

Hi,  
thanks for your reply.  
It doesn’t work, because next request body should be raw(xml).  
I have done JSON.parse then have converted from json to xml, but again doesn’t work.

 ![Screenshot_10](https://us1.discourse-cdn.com/getpostman/original/2X/2/25232fdf3cd02f8297244686d9fa425d8f900305.png)  
 ![Screenshot_11](https://us1.discourse-cdn.com/getpostman/original/2X/a/abd0136fb4252bca7509ab984681ff5ab6d9969b.png)

---

<div class="post-metadata">

**Author:** ![harutharut](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/harutharut/32/6996_2.png) [@harutharut](https://community.postman.com/u/harutharut)\
**Post date:** [January 12, 2022, 9:07am UTC](https://community.postman.com/t/how-to-use-response-body-as-a-request-body-for-next-call/31242/5 "2022-01-12T09:07:42Z")

</div>

request body should be like this

 ![Screenshot_12](https://us1.discourse-cdn.com/getpostman/original/2X/3/320692043206a90c77a6c99b41c55c763db3385d.png)

---

<div class="post-metadata">

**Author:** ![jfbriere](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/jfbriere/32/8444_2.png) [@jfbriere](https://community.postman.com/u/jfbriere)\
**Post date:** [January 13, 2022, 4:29pm UTC](https://community.postman.com/t/how-to-use-response-body-as-a-request-body-for-next-call/31242/6 "2022-01-13T16:29:43Z")

</div>

Put the converted _signResponse_ to XML value into a local variable, then specify this new local variable into the raw (XML) body.

Pre-request Script:

```auto
// get the signResponse environment variable value initialized
// in a previous request and convert the string to a json object
let inputJSON = JSON.parse(pm.environment.get('signResponse'));
// convert the json object into a XML string
let output = OBJtoXML(inputJSON);
// set the XML string into the signResponseXML local variable
pm.variables.set('signResponseXML', output);

```

Body raw (XML):

```auto
{{signResponseXML}}

```

---

<div class="post-metadata">

**Author:** ![harutharut](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/harutharut/32/6996_2.png) [@harutharut](https://community.postman.com/u/harutharut)\
**Post date:** [January 14, 2022, 5:57pm UTC](https://community.postman.com/t/how-to-use-response-body-as-a-request-body-for-next-call/31242/7 "2022-01-14T17:57:13Z")

</div>

Thanks @jfbriere your promt response. I have tried it, but get an error - wrong xml.  
I think the problem is in the convert function. After converting to XML I don’t have proper structure. Let me show result of converting:

```auto
<MortgageRequest><RequestReference><RefNum>999995578</RefNum><OperationDate>13/12/2021 12:12:12</OperationDate></RequestReference><Loans><LoanContract><ContractNumber>61</ContractNumber><ContractDate>13/12/2021</ContractDate><MonthInfo><InterestPaymentDate>04/07/2020</InterestPaymentDate><InterestPaymentValue>123.03</InterestPaymentValue><InterestPaid>0000000000.00</InterestPaid></MonthInfo><MonthInfo><InterestPaymentDate>05/07/2020</InterestPaymentDate><InterestPaymentValue>123.45</InterestPaymentValue><InterestPaid>0.0</InterestPaid></MonthInfo><MonthInfo><InterestPaymentDate>06/07/2020</InterestPaymentDate><InterestPaymentValue>123.45</InterestPaymentValue><InterestPaid>0.0</InterestPaid></MonthInfo><QuarterInfo><PaymentYear>2018</PaymentYear><PaymentQuarter>1</PaymentQuarter><QuarterPaidInterest>8.00</QuarterPaidInterest></QuarterInfo><Borrower><ssn>3808970359</ssn><tin>00651800</tin><FirstName>Հայկ</FirstName><LastName>Սարհատյան</LastName></Borrower><Co_Borrowers><Co_Borrower><ssn>3808970359</ssn><tin>00651800</tin><FirstName>Հայկ</FirstName><LastName>Սարհատյան</LastName></Co_Borrower><Co_Borrower><ssn>3808970359</ssn><tin>00651800</tin><FirstName>Հայկ</FirstName><LastName>Սարհատյան</LastName></Co_Borrower></Co_Borrowers></LoanContract><LoanContract><ContractNumber>61</ContractNumber><ContractDate>13/12/2021</ContractDate><MonthInfo><InterestPaymentDate>04/07/2020</InterestPaymentDate><InterestPaymentValue>123.03</InterestPaymentValue><InterestPaid>0000000000.00</InterestPaid></MonthInfo><MonthInfo><InterestPaymentDate>05/07/2020</InterestPaymentDate><InterestPaymentValue>123.45</InterestPaymentValue><InterestPaid>0.0</InterestPaid></MonthInfo><MonthInfo><InterestPaymentDate>06/07/2020</InterestPaymentDate><InterestPaymentValue>123.45</InterestPaymentValue><InterestPaid>0.0</InterestPaid></MonthInfo><QuarterInfo><PaymentYear>2018</PaymentYear><PaymentQuarter>1</PaymentQuarter><QuarterPaidInterest>8.00</QuarterPaidInterest></QuarterInfo><Borrower><ssn>3808970359</ssn><tin>00651800</tin><FirstName>Հայկ</FirstName><LastName>Սարհատյան</LastName></Borrower><Co_Borrowers><Co_Borrower><ssn>3808970359</ssn><tin>00651800</tin><FirstName>Հայկ</FirstName><LastName>Սարհատյան</LastName></Co_Borrower><Co_Borrower><ssn>3808970359</ssn><tin>00651800</tin><FirstName>Հայկ</FirstName><LastName>Սարհատյան</LastName></Co_Borrower></Co_Borrowers></LoanContract><LoanContract><ContractNumber>61</ContractNumber><ContractDate>13/12/2021</ContractDate><MonthInfo><InterestPaymentDate>04/07/2020</InterestPaymentDate><InterestPaymentValue>123.03</InterestPaymentValue><InterestPaid>0000000000.00</InterestPaid></MonthInfo><MonthInfo><InterestPaymentDate>05/07/2020</InterestPaymentDate><InterestPaymentValue>123.45</InterestPaymentValue><InterestPaid>0.0</InterestPaid></MonthInfo><MonthInfo><InterestPaymentDate>06/07/2020</InterestPaymentDate><InterestPaymentValue>123.45</InterestPaymentValue><InterestPaid>0.0</InterestPaid></MonthInfo><QuarterInfo><PaymentYear>2018</PaymentYear><PaymentQuarter>1</PaymentQuarter><QuarterPaidInterest>8.00</QuarterPaidInterest></QuarterInfo><Borrower><ssn>3808970359</ssn><tin>00651800</tin><FirstName>Հայկ</FirstName><LastName>Սարհատյան</LastName></Borrower><Co_Borrowers><Co_Borrower><ssn>3808970359</ssn><tin>00651800</tin><FirstName>Հայկ</FirstName><LastName>Սարհատյան</LastName></Co_Borrower><Co_Borrower><ssn>3808970359</ssn><tin>00651800</tin><FirstName>Հայկ</FirstName><LastName>Սարհատյան</LastName></Co_Borrower></Co_Borrowers></LoanContract><LoanContract><ContractNumber>61</ContractNumber><ContractDate>13/12/2021</ContractDate><MonthInfo><InterestPaymentDate>04/07/2020</InterestPaymentDate><InterestPaymentValue>123.03</InterestPaymentValue><InterestPaid>0000000000.00</InterestPaid></MonthInfo><MonthInfo><InterestPaymentDate>05/07/2020</InterestPaymentDate><InterestPaymentValue>123.45</InterestPaymentValue><InterestPaid>0.0</InterestPaid></MonthInfo><MonthInfo><InterestPaymentDate>06/07/2020</InterestPaymentDate><InterestPaymentValue>123.45</InterestPaymentValue><InterestPaid>0.0</InterestPaid></MonthInfo><QuarterInfo><PaymentYear>2018</PaymentYear><PaymentQuarter>1</PaymentQuarter><QuarterPaidInterest>8.00</QuarterPaidInterest></QuarterInfo><Borrower><ssn>3808970359</ssn><tin>00651800</tin><FirstName>Հայկ</FirstName><LastName>Սարհատյան</LastName></Borrower><Co_Borrowers><Co_Borrower><ssn>3808970359</ssn><tin>00651800</tin><FirstName>Հայկ</FirstName><LastName>Սարհատյան</LastName></Co_Borrower><Co_Borrower><ssn>3808970359</ssn><tin>00651800</tin><FirstName>Հայկ</FirstName><LastName>Սարհատյան</LastName></Co_Borrower></Co_Borrowers></LoanContract><LoanContract><ContractNumber>61</ContractNumber><ContractDate>13/12/2021</ContractDate><MonthInfo><InterestPaymentDate>04/07/2020</InterestPaymentDate><InterestPaymentValue>123.03</InterestPaymentValue><InterestPaid>0000000000.00</InterestPaid></MonthInfo><MonthInfo><InterestPaymentDate>05/07/2020</InterestPaymentDate><InterestPaymentValue>123.45</InterestPaymentValue><InterestPaid>0.0</InterestPaid></MonthInfo><MonthInfo><InterestPaymentDate>06/07/2020</InterestPaymentDate><InterestPaymentValue>123.45</InterestPaymentValue><InterestPaid>0.0</InterestPaid></MonthInfo><QuarterInfo><PaymentYear>2018</PaymentYear><PaymentQuarter>1</PaymentQuarter><QuarterPaidInterest>8.00</QuarterPaidInterest></QuarterInfo><Borrower><ssn>3808970359</ssn><tin>00651800</tin><FirstName>Հայկ</FirstName><LastName>Սարհատյան</LastName></Borrower><Co_Borrowers><Co_Borrower><ssn>3808970359</ssn><tin>00651800</tin><FirstName>Հայկ</FirstName><LastName>Սարհատյան</LastName></Co_Borrower><Co_Borrower><ssn>3808970359</ssn><tin>00651800</tin><FirstName>Հայկ</FirstName><LastName>Սարհատյան</LastName></Co_Borrower></Co_Borrowers></LoanContract></Loans><Signature><$><xmlns>http://www.w3.org/2000/09/xmldsig#</xmlns></$><SignedInfo><CanonicalizationMethod><$><Algorithm>http://www.w3.org/TR/2001/REC-xml-c14n-20010315</Algorithm></$></CanonicalizationMethod><SignatureMethod><$><Algorithm>http://www.w3.org/2001/04/xmldsig-more#rsa-sha512</Algorithm></$></SignatureMethod><Reference><$><URI></URI></$><Transforms><Transform><$><Algorithm>http://www.w3.org/2000/09/xmldsig#enveloped-signature</Algorithm></$></Transform></Transforms><DigestMethod><$><Algorithm>http://www.w3.org/2001/04/xmlenc#sha512</Algorithm></$></DigestMethod><DigestValue>5KUQzVj4rI0Q+ZY2myn4EQQozIkM6OgyGtsr63rZiZNPf8Ug1XEY/vOSXGDR5Xu0SK26W3FeS5Ip9/IPaUyWVQ==</DigestValue></Reference></SignedInfo><SignatureValue>P9HsIyNgzCRyaCtkL8yRgWbC0TlJC9e9X9cd3dU9WLMU3oYKyNzloRKkFZUfhW8y2vhxyje1DgBdGkBALuRufn6ULlz+Mbzrav4GCpDJoxkMTvGcUp+9QgXKIY7xzLmy+2TiYFZs4RkruNAxKdVfMBl93hoWgXjNUUEn5oAbeWXg90WIkZyHvITbpGnSBjYkPHFjei6JAmUM3KJniEX1z1jdXZtX3od+7qpqvvwdSqyBS61kPVU+chOrTwL9n8WYnyX78gLtUGiQy8b3fW+d8R9eKhQQbcXrSkgqucuoqB22/BBWNtvmLJVPxV0GCqizGfsoZwAH3b2KHgvi9WDcOA==</SignatureValue><KeyInfo><KeyValue><RSAKeyValue><Modulus>pd0UTDf72nh0dBWlpqM8Aci1iwUgkmuvYmXgobxuF4tXVYENJzUU83E1L+TuHI6N1FtYY3ALhHTPHssklrS0b4rDvMxzDDi0KZQGZyge74q6jlkEgIFq/+ltHt9g4uTzuxsjHpmyW8rODNpmP6eMG9DL0+NXLDlN8sR6gDUC6XW1D5ri6PdsAedkXQ055X+gmA/PdOqxG3fXTDapVBBlsWxOhbb96nll3YOWQQz3jEoMsu5z/qPn6uNAiBechyzzyzNsdic3pJcNPsoB9j2CP/uOMWq40O3XsSArQULYaTt73dUaEN+kff+YIKZYObaPcN/ekK5tgj4F4jlNP/VFjQ==</Modulus><Exponent>AQAB</Exponent></RSAKeyValue></KeyValue></KeyInfo></Signature></MortgageRequest>

```

request body raw should be like this:

```auto
<MortgageRequest>
  <RequestReference>
    <RefNum>999995578</RefNum>
    <OperationDate>13/12/2021 12:12:12</OperationDate>
  </RequestReference>
  <Loans>
    <LoanContract>
      <ContractNumber>61</ContractNumber>
      <ContractDate>13/12/2021</ContractDate>
      <MonthInfo>
		  <InterestPaymentDate>04/07/2020</InterestPaymentDate>
		  <InterestPaymentValue>123.03</InterestPaymentValue>
		  <InterestPaid>0000000000.00</InterestPaid>
	  </MonthInfo>
      <MonthInfo>
		  <InterestPaymentDate>05/07/2020</InterestPaymentDate>
		  <InterestPaymentValue>123.45</InterestPaymentValue>
		  <InterestPaid>0.0</InterestPaid>
	  </MonthInfo>
      <MonthInfo>
		  <InterestPaymentDate>06/07/2020</InterestPaymentDate>
		  <InterestPaymentValue>123.45</InterestPaymentValue>
		  <InterestPaid>0.0</InterestPaid>
	  </MonthInfo>
      <QuarterInfo>
        <PaymentYear>2018</PaymentYear>
        <PaymentQuarter>1</PaymentQuarter>
        <QuarterPaidInterest>8.00</QuarterPaidInterest>
      </QuarterInfo>
      <Borrower>
        <ssn>3808970359</ssn>
        <tin>00651800</tin>
          <FirstName>Հայկ</FirstName>
          <LastName>Սարհատյան</LastName>
      </Borrower>
      <Co_Borrowers>
        <Co_Borrower>
          <ssn>3808970359</ssn>
          <tin>00651800</tin>
          <FirstName>Հայկ</FirstName>
          <LastName>Սարհատյան</LastName>
        </Co_Borrower>
        <Co_Borrower>
          <ssn>3808970359</ssn>
          <tin>00651800</tin>
          <FirstName>Հայկ</FirstName>
          <LastName>Սարհատյան</LastName>
        </Co_Borrower>
      </Co_Borrowers>
    </LoanContract>
    <LoanContract>
      <ContractNumber>61</ContractNumber>
      <ContractDate>13/12/2021</ContractDate>
      <MonthInfo>
		  <InterestPaymentDate>04/07/2020</InterestPaymentDate>
		  <InterestPaymentValue>123.03</InterestPaymentValue>
		  <InterestPaid>0000000000.00</InterestPaid>
	  </MonthInfo>
      <MonthInfo>
		  <InterestPaymentDate>05/07/2020</InterestPaymentDate>
		  <InterestPaymentValue>123.45</InterestPaymentValue>
		  <InterestPaid>0.0</InterestPaid>
	  </MonthInfo>
      <MonthInfo>
		  <InterestPaymentDate>06/07/2020</InterestPaymentDate>
		  <InterestPaymentValue>123.45</InterestPaymentValue>
		  <InterestPaid>0.0</InterestPaid>
	  </MonthInfo>
      <QuarterInfo>
        <PaymentYear>2018</PaymentYear>
        <PaymentQuarter>1</PaymentQuarter>
        <QuarterPaidInterest>8.00</QuarterPaidInterest>
      </QuarterInfo>
      <Borrower>
        <ssn>3808970359</ssn>
        <tin>00651800</tin>
          <FirstName>Հայկ</FirstName>
          <LastName>Սարհատյան</LastName>
      </Borrower>
      <Co_Borrowers>
        <Co_Borrower>
          <ssn>3808970359</ssn>
          <tin>00651800</tin>
          <FirstName>Հայկ</FirstName>
          <LastName>Սարհատյան</LastName>
        </Co_Borrower>
        <Co_Borrower>
          <ssn>3808970359</ssn>
          <tin>00651800</tin>
          <FirstName>Հայկ</FirstName>
          <LastName>Սարհատյան</LastName>
        </Co_Borrower>
      </Co_Borrowers>
    </LoanContract>
    <LoanContract>
      <ContractNumber>61</ContractNumber>
      <ContractDate>13/12/2021</ContractDate>
      <MonthInfo>
		  <InterestPaymentDate>04/07/2020</InterestPaymentDate>
		  <InterestPaymentValue>123.03</InterestPaymentValue>
		  <InterestPaid>0000000000.00</InterestPaid>
	  </MonthInfo>
      <MonthInfo>
		  <InterestPaymentDate>05/07/2020</InterestPaymentDate>
		  <InterestPaymentValue>123.45</InterestPaymentValue>
		  <InterestPaid>0.0</InterestPaid>
	  </MonthInfo>
      <MonthInfo>
		  <InterestPaymentDate>06/07/2020</InterestPaymentDate>
		  <InterestPaymentValue>123.45</InterestPaymentValue>
		  <InterestPaid>0.0</InterestPaid>
	  </MonthInfo>
      <QuarterInfo>
        <PaymentYear>2018</PaymentYear>
        <PaymentQuarter>1</PaymentQuarter>
        <QuarterPaidInterest>8.00</QuarterPaidInterest>
      </QuarterInfo>
      <Borrower>
        <ssn>3808970359</ssn>
        <tin>00651800</tin>
          <FirstName>Հայկ</FirstName>
          <LastName>Սարհատյան</LastName>
      </Borrower>
      <Co_Borrowers>
        <Co_Borrower>
          <ssn>3808970359</ssn>
          <tin>00651800</tin>
          <FirstName>Հայկ</FirstName>
          <LastName>Սարհատյան</LastName>
        </Co_Borrower>
        <Co_Borrower>
          <ssn>3808970359</ssn>
          <tin>00651800</tin>
          <FirstName>Հայկ</FirstName>
          <LastName>Սարհատյան</LastName>
        </Co_Borrower>
      </Co_Borrowers>
    </LoanContract>
    <LoanContract>
      <ContractNumber>61</ContractNumber>
      <ContractDate>13/12/2021</ContractDate>
      <MonthInfo>
		  <InterestPaymentDate>04/07/2020</InterestPaymentDate>
		  <InterestPaymentValue>123.03</InterestPaymentValue>
		  <InterestPaid>0000000000.00</InterestPaid>
	  </MonthInfo>
      <MonthInfo>
		  <InterestPaymentDate>05/07/2020</InterestPaymentDate>
		  <InterestPaymentValue>123.45</InterestPaymentValue>
		  <InterestPaid>0.0</InterestPaid>
	  </MonthInfo>
      <MonthInfo>
		  <InterestPaymentDate>06/07/2020</InterestPaymentDate>
		  <InterestPaymentValue>123.45</InterestPaymentValue>
		  <InterestPaid>0.0</InterestPaid>
	  </MonthInfo>
      <QuarterInfo>
        <PaymentYear>2018</PaymentYear>
        <PaymentQuarter>1</PaymentQuarter>
        <QuarterPaidInterest>8.00</QuarterPaidInterest>
      </QuarterInfo>
      <Borrower>
        <ssn>3808970359</ssn>
        <tin>00651800</tin>
          <FirstName>Հայկ</FirstName>
          <LastName>Սարհատյան</LastName>
      </Borrower>
      <Co_Borrowers>
        <Co_Borrower>
          <ssn>3808970359</ssn>
          <tin>00651800</tin>
          <FirstName>Հայկ</FirstName>
          <LastName>Սարհատյան</LastName>
        </Co_Borrower>
        <Co_Borrower>
          <ssn>3808970359</ssn>
          <tin>00651800</tin>
          <FirstName>Հայկ</FirstName>
          <LastName>Սարհատյան</LastName>
        </Co_Borrower>
      </Co_Borrowers>
    </LoanContract>
    <LoanContract>
      <ContractNumber>61</ContractNumber>
      <ContractDate>13/12/2021</ContractDate>
      <MonthInfo>
		  <InterestPaymentDate>04/07/2020</InterestPaymentDate>
		  <InterestPaymentValue>123.03</InterestPaymentValue>
		  <InterestPaid>0000000000.00</InterestPaid>
	  </MonthInfo>
      <MonthInfo>
		  <InterestPaymentDate>05/07/2020</InterestPaymentDate>
		  <InterestPaymentValue>123.45</InterestPaymentValue>
		  <InterestPaid>0.0</InterestPaid>
	  </MonthInfo>
      <MonthInfo>
		  <InterestPaymentDate>06/07/2020</InterestPaymentDate>
		  <InterestPaymentValue>123.45</InterestPaymentValue>
		  <InterestPaid>0.0</InterestPaid>
	  </MonthInfo>
      <QuarterInfo>
        <PaymentYear>2018</PaymentYear>
        <PaymentQuarter>1</PaymentQuarter>
        <QuarterPaidInterest>8.00</QuarterPaidInterest>
      </QuarterInfo>
      <Borrower>
        <ssn>3808970359</ssn>
        <tin>00651800</tin>
          <FirstName>Հայկ</FirstName>
          <LastName>Սարհատյան</LastName>
      </Borrower>
      <Co_Borrowers>
        <Co_Borrower>
          <ssn>3808970359</ssn>
          <tin>00651800</tin>
          <FirstName>Հայկ</FirstName>
          <LastName>Սարհատյան</LastName>
        </Co_Borrower>
        <Co_Borrower>
          <ssn>3808970359</ssn>
          <tin>00651800</tin>
          <FirstName>Հայկ</FirstName>
          <LastName>Սարհատյան</LastName>
        </Co_Borrower>
      </Co_Borrowers>
    </LoanContract>
  </Loans>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/><SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha512"/><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/></Transforms><DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha512"/><DigestValue>5KUQzVj4rI0Q+ZY2myn4EQQozIkM6OgyGtsr63rZiZNPf8Ug1XEY/vOSXGDR5Xu0SK26W3FeS5Ip9/IPaUyWVQ==</DigestValue></Reference></SignedInfo><SignatureValue>P9HsIyNgzCRyaCtkL8yRgWbC0TlJC9e9X9cd3dU9WLMU3oYKyNzloRKkFZUfhW8y2vhxyje1DgBdGkBALuRufn6ULlz+Mbzrav4GCpDJoxkMTvGcUp+9QgXKIY7xzLmy+2TiYFZs4RkruNAxKdVfMBl93hoWgXjNUUEn5oAbeWXg90WIkZyHvITbpGnSBjYkPHFjei6JAmUM3KJniEX1z1jdXZtX3od+7qpqvvwdSqyBS61kPVU+chOrTwL9n8WYnyX78gLtUGiQy8b3fW+d8R9eKhQQbcXrSkgqucuoqB22/BBWNtvmLJVPxV0GCqizGfsoZwAH3b2KHgvi9WDcOA==</SignatureValue><KeyInfo><KeyValue><RSAKeyValue><Modulus>pd0UTDf72nh0dBWlpqM8Aci1iwUgkmuvYmXgobxuF4tXVYENJzUU83E1L+TuHI6N1FtYY3ALhHTPHssklrS0b4rDvMxzDDi0KZQGZyge74q6jlkEgIFq/+ltHt9g4uTzuxsjHpmyW8rODNpmP6eMG9DL0+NXLDlN8sR6gDUC6XW1D5ri6PdsAedkXQ055X+gmA/PdOqxG3fXTDapVBBlsWxOhbb96nll3YOWQQz3jEoMsu5z/qPn6uNAiBechyzzyzNsdic3pJcNPsoB9j2CP/uOMWq40O3XsSArQULYaTt73dUaEN+kff+YIKZYObaPcN/ekK5tgj4F4jlNP/VFjQ==</Modulus><Exponent>AQAB</Exponent></RSAKeyValue></KeyValue></KeyInfo></Signature></MortgageRequest>

```

---

<div class="post-metadata">

**Author:** ![jfbriere](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/jfbriere/32/8444_2.png) [@jfbriere](https://community.postman.com/u/jfbriere)\
**Post date:** [January 14, 2022, 8:15pm UTC](https://community.postman.com/t/how-to-use-response-body-as-a-request-body-for-next-call/31242/8 "2022-01-14T20:15:25Z")

</div>

> [@harutharut](#):
>
> but get an error - wrong xml

What is the error, specifically?

I don’t think that this is a Postman error because the XML you provided is well constructed.

I think the error comes from your service.  
The reason for the error is impossible for me to know, but it might be because your XML does not conform to the appropriate XML schema of your service.

---

<div class="post-metadata">

**Author:** ![harutharut](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/harutharut/32/6996_2.png) [@harutharut](https://community.postman.com/u/harutharut)\
**Post date:** [January 15, 2022, 2:12pm UTC](https://community.postman.com/t/how-to-use-response-body-as-a-request-body-for-next-call/31242/9 "2022-01-15T14:12:38Z")

</div>

Thank you @jfbriere .  
Yes, is possible that the error comes from our service. I will check it.  
Maybe after converting function need to write special function for getting appropriate XML schema? Is it possible?

---

<div class="post-metadata">

**Author:** ![harutharut](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/harutharut/32/6996_2.png) [@harutharut](https://community.postman.com/u/harutharut)\
**Post date:** [January 15, 2022, 2:24pm UTC](https://community.postman.com/t/how-to-use-response-body-as-a-request-body-for-next-call/31242/10 "2022-01-15T14:24:46Z")

</div>

> [@jfbriere](#):
>
> I think the error comes from your service.

Yes, you are right. The error comes from our service. Need to build appropriate XML schema then send. But I don’t know how?

---

<div class="post-metadata">

**Author:** ![harutharut](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/harutharut/32/6996_2.png) [@harutharut](https://community.postman.com/u/harutharut)\
**Post date:** [January 24, 2022, 11:02am UTC](https://community.postman.com/t/how-to-use-response-body-as-a-request-body-for-next-call/31242/11 "2022-01-24T11:02:31Z")

</div>

Hey dear friends,  
I want to say that I have found the soultion. It was very easy 🙂.  
First of all, there is no need to convert response from XML to JSON Object, consequently there is no need to do JSON.stringify before setting in environment.  
Just set environment variable as it is

```auto
Tests:

if (pm.response.code == 200 ) {
pm.test("contract is signed successful", () => {
   pm.environment.set("signResponse", responseBody);

```

Then in the next request I have simply got the signResponse environment variable value initialized in a previous request

```auto
Pre-request Script:

let signedContract = pm.environment.get("signResponse");
pm.variables.set('signResponseXML', signedContract);

```

At the end I have used signResponseXML variable in my request body.

```auto
Body raw (XML):

{{signResponseXML}}

```

Many thanks @jfbriere , @bpricilla  
I hope this can help someone else 🙂.
