Capture return of a Webservice

Asked

Viewed 515 times

0

I managed, via PHP to connect to a Webservice via SOAP, but I can not caputrar the return data. I made a var_dump in the return variable, and what is displayed on the screen follows below:

object(stdClass)[2]
  public 'BuscaSMPResult' => 
    object(stdClass)[3]
      public 'MensagensErro' => 
        object(stdClass)[4]
          public 'RetornoMensagem' => 
            object(stdClass)[5]
              ...
      public 'TransacaoOk' => boolean false
      public 'SMP' => null

How can I capture this data?

Edit

Text returned when using print_r in place ofvar_dump:

stdClass Object
(
    [InsereSMPResult] => stdClass Object
        (
            [MensagensErro] => stdClass Object
                (
                    [RetornoMensagem] => stdClass Object
                        (
                            [Codigo] => 1001
                            [Mensagem] => É necessário informar o Token
                        )

                )

            [TransacaoOk] => 
            [MensagensAviso] => stdClass Object
                (
                )

            [MensagensSucesso] => stdClass Object
                (
                )

            [AnoSMP] => 0
            [IdSMP] => 0
            [NumeroSMP] => 0
        )

)
  • 1

    echo($Sponse->Inserts Presult->Messagenserro->Returnname->Code); //So it doesn’t work?

  • 1

    It is returning an object, it would not be something like this: Whereas the return is in $date seeking to obtain the value of Code: $codigo = $data->Inserts;

  • @Everson returns empty

  • @Lucas Torres It is necessary to inform the Token

1 answer

0

Printed with:

 $result = $data->InsereSMPResult->MensagensErro->RetornoMensagem['Codi‌​go']
  • That solved the problem?

  • 1

    Yes, actually it was more of an interpretation error. As much as it was an object, it seems that the "Code" was a parameter,

Browser other questions tagged

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