Send file to api SOAP with PHP

Asked

Viewed 32 times

0

I need to send jpg and pdf files eventually to an api. But in the WSDL there is the field:

<xs:element minOccurs="0" name="arquivo" type="xs:base64Binary"/>

Until then beauty, only it has a detail. The api is returning me this error:

Uncaught SoapFault exception: 
 [soap:Server] Anexo nao enviado ou Invalido, deve ser usado anexo MTOM-XOP.

I did not find anything that result, I made the code below:

$imagem = "img/teste.jpg";
$file = file_get_contents($imagem);
$data = base64_encode($file);

I read in the PHP documentation cached in Google that there is no need to decode because SOAP already does this. But I think I’m wrong.

Anyway, if anyone can give me a north I thank.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.