PHP SOAP - SOAP-ERROR

0

Good afternoon Guys, I'm doing a WEBSERVICE to consume an API from a company. But with the code below the return is always "SOAP-ERROR: Encoding: object has no 'Active' property" I do not know what else to try anyone can give a tip.

<?php

$wsdl = 'http://layer.ezcommerce.com.br/CatalogoWS.svc?singleWsdl';
$method = 'SalvarMarca';
$login = 'login';
$password = 'senha';

$arrContextOptions = [
    "ssl" => [
        "verify_peer" => false,
        "verify_peer_name" => false,
        'crypto_method' => STREAM_CRYPTO_METHOD_TLS_CLIENT,
    ]
];

$options = [
    'uri' => 'http://schemas.xmlsoap.org/soap/envelope/',
    'style' => SOAP_RPC,
    'use' => SOAP_ENCODED,
    'soap_version' => SOAP_1_2,
    'cache_wsdl' => WSDL_CACHE_NONE,
    'connection_timeout' => 500,
    'trace' => true,
    'encoding' => 'UTF-8', //ISO-8859-1
    'exceptions' => true,
    'stream_context' => stream_context_create($arrContextOptions),
    'login' => $login,
    'password'=> $password
];

$wsu = 'http://schemas.xmlsoap.org/ws/2002/07/utility';

$client = new SoapClient($wsdl,$options);
$soapHeaders[] = new SoapHeader($wsu, 'UsernameToken', $login, $password);
$client->__setSoapHeaders($soapHeaders);

$params[] = [
    'marca' => [
        'MarcaID' => 8888, //int 8 obrigatorio
        'Nome' => 'MARCA MAICON', //string 50 obrigatorio
        'Url' => "http://wwww.incoterm.com.br",
        'Logotipo' => '', //string 50 obrigatorio
        'Ordem' => 111, //int 8 nao_obrigatorio
        'ativo' => true, //boolean true/false obrigatorio
        'CodigoIntegracao' => '1999999'
    ]
];

$request = new SoapVar($params, XSD_ANYXML);

try {
    $result = $client->__soapCall($method, $params);
} catch (Exception $e) {
    $result = $e;
    die($e->getMessage());
}
    
asked by anonymous 24.10.2018 / 20:34

1 answer

0

Message: "SOAP-ERROR: Encoding: object has no 'Active' property

Your error message indicates that you expect an object named "Active" and can not find it.

Please try to change the parameter from 'active' to 'Active', where:

$params[] =  ['marca'=>[
    'MarcaID'=>8888, //int 8 obrigatorio
    'Nome'=>'MARCA MAICON', //string 50 obrigatorio
    'Url'=>"http://wwww.incoterm.com.br",
    'Logotipo'=>'', //string 50 obrigatorio
    'Ordem'=> 111, //int 8 nao_obrigatorio
    'Ativo'=> true, //boolean true/false obrigatorio
    'CodigoIntegracao'=>'1999999']
];

I hope it helps.

    
24.10.2018 / 22:38