简体   繁体   中英

Soap BAD_REQUEST cannot parse template

I am using a WSDL file in order to send the sms, i generated all the php class by using Wsdl2PhpGenerator\Generator. One of the functions get as paramers @param base64Binary $tpl as you see the type of this parameter is base64Binary.

I've been trying to encode my $tpl without any luck

$tpl = __DIR__ . "/file00000"
$content = file_get_contents($tpl);
$src =  base64_encode($content);

The encoded result data starts with:

"SVMtQgAAAAFIRUFEAAAABAAAAAhGSUxFAA ...

This is my catch (\SoapFault $e)

{#355 ▼
      +"code": "BAD_REQUEST"
      +"desc": "cannot parse template"
    }

Do you have any idea?

Base64 is a string not binary.

If your WSDL file wants a parameter base64Binary type, do not use base64_encode() , because PHP Soap does the encoding by itself.

You can pass $content directly as $src .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM