PHP SOAP - SOAP-ERROR

Asked

Viewed 813 times

1

Good afternoon Guys, I’m doing a WEBSERVICE to consume a company API. But with the code below the return is always "SOAP-ERROR: Encoding: Object has no 'Active' Property" I don’t know what else to try someone can give a hint.

<?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());
}
  • The correct parameter is 'active' or 'active'?

1 answer

1

Message: "SOAP-ERROR: Encoding: Object has no 'Active' Property

Your error message indicates that you expect an object named "Active" and cannot find.

Please try to change the parameter from 'active' to 'active' by staying:

$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.

Browser other questions tagged

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