This request requires Basic Auth: user and password.
Headers with two fields.
and xml body.
This API is tested working in Postman. But I am not sure how to make this work in Laravel, I only work with JSON before.
Any suggestion how can I get started? or any package I can use?
You can use http post
$http=Http::withHeaders([
'Content-Type'=>'application/xml',
'SOAPAction'=>'balance'
])->post(url,$xmlBodyContent);
return response($http->body())
->withHeaders([
'Content-Type' => 'text/xml'
]);
Another way is to use withBody
method
$http=Http::withHeaders([
'Content-Type'=>'application/xml',
'SOAPAction'=>'balance'
])->withBody($xmlBodyContent,"text/xml")->post(url);
for xml doc notation Ref:https://www.php.net/manual/en/simplexml.examples-basic.php
To generate array to xml,use array-to-xml