> 
> We have to implement the punchout concept in magento2.
> 
> 
> 

There is a 3rd party system they will send data using the **cXML** format to Magento 2 endpoint. We need to fetch that data in the Magento2 & need to process & need to return the data in the form of **cXML** format.

For this, we have implemented the **vie/api/punchout** controller concept instead of REST APIs. which is working when we use the PUT method but it is not working for the POST method. 

Note: It should be work for the **POST** method. 
When we use **POST** method our controller is not triggering can anyone help me on this issue.

<https://drive.google.com/file/d/1b_aQdjNuamo1VLsLzts0nAsuPGUFjl2H/view>

<https://codeshare.io/alW8lB>
sample cXML format: <https://codeshare.io/2W91Nd>

I have followed the below approaches in the controller but those are working for the PUT method,
 not for the POST method as per the client request, it should work for the POST method. 

> 
> 1. $postData = $this->getRequest()->getContent();
> 2. ```
>  $opts = array('http' =>
> 
>     array(
>         'method'  => 'POST'
>         )
>         );
>     $context  = stream_context_create($opts);
> 
>     $x=file_get_contents("php://input", false, $context);>              
>     echo $x;
> 
> ```
> 3. ```
>   $rawData = file_get_contents("php://input");
>  echo $rawData;
> 
> ```
> 
> 
> 

Steps to verify:

> 
> 1. Create on the custom controller in your custom module ex: v**ie/api/punchout**
> 2. Open postman app
> 3. Keep sample XML data in the postman app at body and type is XML format which I have mentioned above.
> 4. Try to fetch the data using the POST method in the controller
> 
> 
>