Ir para conteúdo
Fórum Script Brasil
  • 0

Implantação de web service


Andryon PHProgrammer

Pergunta

Pessoal,

estou com dificuldade em saber como implatar um web service. Eu tenho o seguinte:

POST /sat.asmx HTTP/1.1

Host: services.satrotas.com.br

Content-Type: text/xml; charset=utf-8

Content-Length: length

SOAPAction: "http://services.satrotas.com.br/ConsultaRegioes"

<?xml version="1.0" encoding="utf-8"?>

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

<soap:Body>

<ConsultaRegioes xmlns="http://services.satrotas.com.br/" />

</soap:Body>

</soap:Envelope>

Mas não tenho nenhuma ideia de como seria a implantação disso. alguém teria algum exemplo ou sabe como fazer isso?

Link para o comentário
Compartilhar em outros sites

17 respostass a esta questão

Posts Recomendados

  • 0
Retorna algum erro?

Posta seu código e a descrição do que está ocorrendo..

Abraço

Romero, pior que não to conseguindo nem formular um código. Pelo que eu vi temos que pegar o código abaixo e transformar em uma requisição soap, mas não sei como fazer isso.

POST /sat.asmx HTTP/1.1

Host: services.satrotas.com.br

Content-Type: text/xml; charset=utf-8

Content-Length: length

SOAPAction: "http://services.satrotas.com.br/ConsultaRegioes"

<?xml version="1.0" encoding="utf-8"?>

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

<soap:Body>

<ConsultaRegioes xmlns="http://services.satrotas.com.br/" />

</soap:Body>

</soap:Envelope>

Link para o comentário
Compartilhar em outros sites

  • 0

Segue abaixo o script que estou usando:

<?php

// Pull in the NuSOAP code

require_once('nusoap.php');

// Create the client instance

$client = new nusoap_client('services.satrotas.com.br');

// Check for an error

$err = $client->getError();

if ($err) {

// Display the error

echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';

// At this point, you know the call that follows will fail

}

// Call the SOAP method

$result = $client->call('ConsultaRegioes', array('name' => 'Scott'));

// Check for a fault

if ($client->fault) {

echo '<h2>Fault</h2><pre>';

print_r($result);

echo '</pre>';

} else {

// Check for errors

$err = $client->getError();

if ($err) {

// Display the error

echo '<h2>Error</h2><pre>' . $err . '</pre>';

} else {

// Display the result

echo '<h2>Result</h2><pre>';

print_r($result);

echo '</pre>';

}

}

?>

<?php

// Display the request and response

echo '<h2>Request</h2>';

echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';

echo '<h2>Response</h2>';

echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';

?>

está aparecendo o erro no transport found, or selected transport is not yet supported!

Link para o comentário
Compartilhar em outros sites

  • 0

Velho,

Coloca esse link no browser: services.satrotas.com.br

É retornado o seguinte erro:

Server Error

403 - Forbidden: Access is denied.

You do not have permission to view this directory or page using the credentials that you supplied.

Provavelmente você vai precisar se autenticar para acessar o serviço.

Link para o comentário
Compartilhar em outros sites

  • 0
Velho,

Coloca esse link no browser: services.satrotas.com.br

É retornado o seguinte erro:

Server Error

403 - Forbidden: Access is denied.

You do not have permission to view this directory or page using the credentials that you supplied.

Provavelmente você vai precisar se autenticar para acessar o serviço.

Romero,

após alterar o script para:

<?php

// Pull in the NuSOAP code

require_once('nusoap.php');

// Create the client instance

$client = new nusoap_client('http://services.satrotas.com.br/sat.asmx?WSDL');

// Check for an error

$err = $client->getError();

if ($err) {

// Display the error

echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';

// At this point, you know the call that follows will fail

}

// Call the SOAP method

$result = $client->call('Login',array('usuario' => 'Scott','senha'=>'123'));

// Check for a fault

if ($client->fault) {

echo '<h2>Fault</h2><pre>';

print_r($result);

echo '</pre>';

} else {

// Check for errors

$err = $client->getError();

if ($err) {

// Display the error

echo '<h2>Error</h2><pre>' . $err . '</pre>';

} else {

// Display the result

echo '<h2>Result</h2><pre>';

print_r($result);

echo '</pre>';

}

}

?>

<?php

// Display the request and response

echo '<h2>Request</h2>';

echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';

echo '<h2>Response</h2>';

echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';

?>

começou aparecer a seguinte mensagem:

Fault

Array

(

[faultcode] => soap:Server

[faultstring] => Server was unable to process request. ---> Unable to generate a temporary class (result=1).

error CS0200: Property or indexer 'SATRotas.WebServices.Endereco.codTrecho' cannot be assigned to -- it is read only

error CS0200: Property or indexer 'SATRotas.WebServices.Endereco.codNoInicial' cannot be assigned to -- it is read only

error CS0200: Property or indexer 'SATRotas.WebServices.Endereco.logradouro' cannot be assigned to -- it is read only

error CS0200: Property or indexer 'SATRotas.WebServices.Endereco.numero' cannot be assigned to -- it is read only

error CS0200: Property or indexer 'SATRotas.WebServices.Endereco.cep' cannot be assigned to -- it is read only

error CS0200: Property or indexer 'SATRotas.WebServices.Endereco.bairro' cannot be assigned to -- it is read only

error CS0200: Property or indexer 'SATRotas.WebServices.Endereco.cidade' cannot be assigned to -- it is read only

error CS0200: Property or indexer 'SATRotas.WebServices.Endereco.uf' cannot be assigned to -- it is read only

error CS0200: Property or indexer 'SATRotas.WebServices.Endereco.numeracaoInicial' cannot be assigned to -- it is read only

error CS0200: Property or indexer 'SATRotas.WebServices.Endereco.numeracaoFinal' cannot be assigned to -- it is read only

error CS0200: Property or indexer 'SATRotas.WebServices.Endereco.latitude' cannot be assigned to -- it is read only

error CS0200: Property or indexer 'SATRotas.WebServices.Endereco.longitude' cannot be assigned to -- it is read only

[detail] =>

)

Request

POST /sat.asmx?WSDL HTTP/1.0

Host: services.satrotas.com.br

User-Agent: NuSOAP/0.7.3 (1.114)

Content-Type: text/xml; charset=ISO-8859-1

SOAPAction: ""

Content-Length: 546

<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns5790:Login xmlns:ns5790="http://tempuri.org"><usuario xsi:type="xsd:string">Scott</usuario><senha xsi:type="xsd:string">123</senha></ns5790:Login></SOAP-ENV:Body></SOAP-ENV:Envelope>

Response

HTTP/1.1 500 Internal Server Error

Cache-Control: private

Content-Type: text/xml; charset=utf-8

Server: Microsoft-IIS/7.5

X-AspNet-Version: 4.0.30319

X-Powered-By: ASP.NET

Date: Tue, 08 Nov 2011 17:20:25 GMT

Connection: close

Content-Length: 1847

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>Server was unable to process request. ---&gt; Unable to generate a temporary class (result=1).

error CS0200: Property or indexer 'SATRotas.WebServices.Endereco.codTrecho' cannot be assigned to -- it is read only

error CS0200: Property or indexer 'SATRotas.WebServices.Endereco.codNoInicial' cannot be assigned to -- it is read only

error CS0200: Property or indexer 'SATRotas.WebServices.Endereco.logradouro' cannot be assigned to -- it is read only

error CS0200: Property or indexer 'SATRotas.WebServices.Endereco.numero' cannot be assigned to -- it is read only

error CS0200: Property or indexer 'SATRotas.WebServices.Endereco.cep' cannot be assigned to -- it is read only

error CS0200: Property or indexer 'SATRotas.WebServices.Endereco.bairro' cannot be assigned to -- it is read only

error CS0200: Property or indexer 'SATRotas.WebServices.Endereco.cidade' cannot be assigned to -- it is read only

error CS0200: Property or indexer 'SATRotas.WebServices.Endereco.uf' cannot be assigned to -- it is read only

error CS0200: Property or indexer 'SATRotas.WebServices.Endereco.numeracaoInicial' cannot be assigned to -- it is read only

error CS0200: Property or indexer 'SATRotas.WebServices.Endereco.numeracaoFinal' cannot be assigned to -- it is read only

error CS0200: Property or indexer 'SATRotas.WebServices.Endereco.latitude' cannot be assigned to -- it is read only

error CS0200: Property or indexer 'SATRotas.WebServices.Endereco.longitude' cannot be assigned to -- it is read only

</faultstring><detail /></soap:Fault></soap:Body></soap:Envelope>

estou tentando utilizar a chamada de login, conforme abaixo:

POST /sat.asmx HTTP/1.1

Host: services.satrotas.com.br

Content-Type: text/xml; charset=utf-8

Content-Length: length

SOAPAction: "http://services.satrotas.com.br/Login"

<?xml version="1.0" encoding="utf-8"?>

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

<soap:Body>

<Login xmlns="http://services.satrotas.com.br/">

<usuario>string</usuario>

<senha>string</senha>

</Login>

</soap:Body>

</soap:Envelope>

O pior que agora complicou de vez

Link para o comentário
Compartilhar em outros sites

  • 0

Veja se ajuda descomplicar:

set_time_limit(0);
$m='';
$acao=isset($_GET['acao'])?$_GET['acao']:0;

if ($acao==1) {

$xml=$_POST['xml'];

$fp = fsockopen("ops.epo.org", 80, $errno, $errstr, 90);
if (!$fp) {
    return "$errstr ($errno)<br />\n";
} else {
$out = 'POST /soap-services/biblio-retrieval HTTP/1.0
Content-Type: text/xml;charset=UTF-8
SOAPAction: "biblio-retrieval"
Host: ops.epo.org
Content-Length: '.strlen($xml).'


'.$xml;
    fwrite($fp, $out);
    while (!feof($fp)) $m.=fgets($fp);
    fclose($fp);
}
    $m="
<input type=button value=voltar onclick=\"window.location='?id=$id&acao=0'\"><t:area style=width:100%; rows=50>$m</t:area>";
    
} else {
$m='
<form method=post action=?id='.$id.'&acao=1>
<input type=submit value=enviar>
<t:area style=width:100%; rows=50 name=xml><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ops="http://ops.epo.org" xmlns:exc="http://www.epo.org/exchange">
<soapenv:Header />
<soapenv:Body>
<ops:biblio-retrieval full-publication-cycle="true">
<exc:publication-reference data-format="docdb">
<exc:document-id>
<exc:country>JP</exc:country>
<exc:doc-number>3071255</exc:doc-number>
<exc:kind>B2</exc:kind>
</exc:document-id>
</exc:publication-reference>
</ops:biblio-retrieval>
</soapenv:Body>
</soapenv:Envelope></t:area>
</form>
';
}

ECHO $m;

O SOAP esta apontado para outro local, basta adaptar as suas necessidade.

Link para o comentário
Compartilhar em outros sites

  • 0
Veja se ajuda descomplicar:

set_time_limit(0);
$m='';
$acao=isset($_GET['acao'])?$_GET['acao']:0;

if ($acao==1) {

$xml=$_POST['xml'];

$fp = fsockopen("ops.epo.org", 80, $errno, $errstr, 90);
if (!$fp) {
    return "$errstr ($errno)<br />\n";
} else {
$out = 'POST /soap-services/biblio-retrieval HTTP/1.0
Content-Type: text/xml;charset=UTF-8
SOAPAction: "biblio-retrieval"
Host: ops.epo.org
Content-Length: '.strlen($xml).'


'.$xml;
    fwrite($fp, $out);
    while (!feof($fp)) $m.=fgets($fp);
    fclose($fp);
}
    $m="
<input type=button value=voltar onclick=\"window.location='?id=$id&acao=0'\"><t:area style=width:100%; rows=50>$m</t:area>";
    
} else {
$m='
<form method=post action=?id='.$id.'&acao=1>
<input type=submit value=enviar>
<t:area style=width:100%; rows=50 name=xml><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ops="http://ops.epo.org" xmlns:exc="http://www.epo.org/exchange">
<soapenv:Header />
<soapenv:Body>
<ops:biblio-retrieval full-publication-cycle="true">
<exc:publication-reference data-format="docdb">
<exc:document-id>
<exc:country>JP</exc:country>
<exc:doc-number>3071255</exc:doc-number>
<exc:kind>B2</exc:kind>
</exc:document-id>
</exc:publication-reference>
</ops:biblio-retrieval>
</soapenv:Body>
</soapenv:Envelope></t:area>
</form>
';
}

ECHO $m;
O SOAP esta apontado para outro local, basta adaptar as suas necessidade.
Spider, alterei o código para:
<?

set_time_limit(0);
$m='';
$acao=isset($_GET['acao'])?$_GET['acao']:0;

if ($acao==1) {

$xml=$_POST['xml'];

$fp = fsockopen("services.satrotas.com.br", 80, $errno, $errstr, 90);
if (!$fp) {
    return "$errstr ($errno)<br />\n";
} else {
$out = 'POST /sat.asmx HTTP/1.1
Content-Type: text/xml;charset=UTF-8
SOAPAction: "http://services.satrotas.com.br/Login"
Host: services.satrotas.com.br
Content-Length: '.strlen($xml).'


'.$xml;
    fwrite($fp, $out);
    while (!feof($fp)) $m.=fgets($fp);
    fclose($fp);
}
    $m="
<input type=button value=voltar onclick=\"window.location='?id=$id&acao=0'\"><t:area style=width:100%; rows=50>$m</t:area>";
    
} else {
$m='
<form method=post action=?id='.$id.'&acao=1>
<input type=submit value=enviar>
<t:area style=width:100%; rows=50 name=xml><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header />
<soapenv:Body>
    <Login xmlns="http://services.satrotas.com.br/">
      <usuario>string</usuario>
      <senha>string</senha>
    </Login>
</soapenv:Body>
</soapenv:Envelope></t:area>
</form>
';
}

echo $m;

?>

mas agora demora um monte para rodar e apareceu:

HTTP/1.1 500 Internal Server Error Cache-Control: private Content-Type: text/xml; charset=utf-8 Server: Microsoft-IIS/7.5 X-AspNet-Version: 4.0.30319 X-Powered-By: ASP.NET Date: Wed, 09 Nov 2011 12:28:15 GMT Content-Length: 1847 soap:ServerServer was unable to process request. ---> Unable to generate a temporary class (result=1). error CS0200: Property or indexer 'SATRotas.WebServices.Endereco.codTrecho' cannot be assigned to -- it is read only error CS0200: Property or indexer 'SATRotas.WebServices.Endereco.codNoInicial' cannot be assigned to -- it is read only error CS0200: Property or indexer 'SATRotas.WebServices.Endereco.logradouro' cannot be assigned to -- it is read only error CS0200: Property or indexer 'SATRotas.WebServices.Endereco.numero' cannot be assigned to -- it is read only error CS0200: Property or indexer 'SATRotas.WebServices.Endereco.cep' cannot be assigned to -- it is read only error CS0200: Property or indexer 'SATRotas.WebServices.Endereco.bairro' cannot be assigned to -- it is read only error CS0200: Property or indexer 'SATRotas.WebServices.Endereco.cidade' cannot be assigned to -- it is read only error CS0200: Property or indexer 'SATRotas.WebServices.Endereco.uf' cannot be assigned to -- it is read only error CS0200: Property or indexer 'SATRotas.WebServices.Endereco.numeracaoInicial' cannot be assigned to -- it is read only error CS0200: Property or indexer 'SATRotas.WebServices.Endereco.numeracaoFinal' cannot be assigned to -- it is read only error CS0200: Property or indexer 'SATRotas.WebServices.Endereco.latitude' cannot be assigned to -- it is read only error CS0200: Property or indexer 'SATRotas.WebServices.Endereco.longitude' cannot be assigned to -- it is read only

não sei mais o que fazer, achava web service sempre uma boa prática, mas to pegando ódio disso. Tem alguma ideia?

Link para o comentário
Compartilhar em outros sites

  • 0

Então o problema está no webservice que voce esta consultando ou na velocidade do servidor que voce esta usando para disparar o script.

Alguns web services são bem pesados mesmo, uando fiz algo para o hotels pro quase cai para tras ...

Notei que o erro retornado é um erro 500 ... erro de servidor ... la ... não o seu ... por isso não da certo

Os paramentros usuario e senha voce tem registrado la né?

Editado por Spiderpoison
Link para o comentário
Compartilhar em outros sites

  • 0
Então o problema está no webservice que voce esta consultando ou na velocidade do servidor que voce esta usando para disparar o script.

Alguns web services são bem pesados mesmo, uando fiz algo para o hotels pro quase cai para tras ...

Notei que o erro retornado é um erro 500 ... erro de servidor ... la ... não o seu ... por isso não da certo

Os paramentros usuario e senha voce tem registrado la né?

Ok spider, obrigado. Vou tentar entra em contato com o fornecedor do web service

Usuario e senha eu não tenho, segundo eles não é preciso autenticação, tambem tentei a chamada 'ConsultaRegioes' mas sem sucesso

Editado por Andryon PHProgrammer
Link para o comentário
Compartilhar em outros sites

  • 0
Então o problema está no webservice que voce esta consultando ou na velocidade do servidor que voce esta usando para disparar o script.

Alguns web services são bem pesados mesmo, uando fiz algo para o hotels pro quase cai para tras ...

Notei que o erro retornado é um erro 500 ... erro de servidor ... la ... não o seu ... por isso não da certo

Os paramentros usuario e senha voce tem registrado la né?

Ok spider, obrigado. Vou tentar entra em contato com o fornecedor do web service

Usuario e senha eu não tenho, segundo eles não é preciso autenticação, tambem tentei a chamada 'ConsultaRegioes' mas sem sucesso

Pessoal,

Conversei com o pessoal fornecedor do web service e segundo eles resolveram o problema, mas ainda está me retornando outro tipo de erro:

segue abaixo meu script

set_time_limit(0);
$m='';
$acao=isset($_GET['acao'])?$_GET['acao']:0;

if ($acao==1) {

$xml=$_POST['xml'];

$fp = fsockopen("services.satrotas.com.br", 80, $errno, $errstr, 90);
if (!$fp) {
    return "$errstr ($errno)<br />\n";
} else {
$out = 'POST /sat.asmx HTTP/1.1
Content-Type: text/xml;charset=UTF-8
SOAPAction: "http://services.satrotas.com.br/ConsultaRegioes"
Host: services.satrotas.com.br
Content-Length: '.strlen($xml).'


'.$xml;
    fwrite($fp, $out);
    while (!feof($fp)) $m.=fgets($fp);
    fclose($fp);
}
    $m="
<input type=button value=voltar onclick=\"window.location='?id=$id&acao=0'\"><t:area style=width:100%; rows=50>$m</t:area>";
    
} else {
$m='
<form method=post action=?id='.$id.'&acao=1>
<input type=submit value=enviar>
<t:area style=width:100%; rows=50 name=xml><?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <ConsultaRegioes xmlns="http://services.satrotas.com.br/" />
  </soap:Body>
</soap:Envelope></t:area>
</form>
';
}

echo $m;

SEGUE O ERRO APRESENTADO ABAIXO:

HTTP/1.1 400 Bad Request Content-Type: text/html; charset=us-ascii Server: Microsoft-HTTPAPI/2.0 Date: Thu, 10 Nov 2011 11:59:29 GMT Connection: close Content-Length: 374

Link para o comentário
Compartilhar em outros sites

  • 0

Parceiro,

Aqui funcionou com o seguinte código

<?php
require ('lib/nusoap/lib/nusoap.php');

$wsdl = "http://services.satrotas.com.br/sat.asmx?wsdl";
$client = new SoapClient($wsdl,array('login' => 'Scott','password' => 123));

$err = $client->getError();

if ($err) {
    echo "Erro no construtor<pre>" . $err . "</pre>";
}

$proxy = $client->getProxy();

echo '<pre>';


$result = $proxy->ConsultaRegioes(array());

if ($client->fault) {
    echo "Falha<pre>" . print var_dump($result) . "</pre>";
} else {
    $err = $client->getError();
    if ($err) {
        echo "Erro<pre>" . $err . "</pre>";
    } else {
        print var_dump($result);
    }
}
Olha o retorno:
array(1) {
  ["ConsultaRegioesResult"]=>
  array(1) {
    ["Regiao"]=>
    array(15) {
      [0]=>
      array(2) {
        ["cod"]=>
        string(1) "1"
        ["nome"]=>
        string(16) "Grande São Paulo"
      }
      [1]=>
      array(2) {
        ["cod"]=>
        string(1) "2"
        ["nome"]=>
        string(14) "Rio de Janeiro"
      }
      [2]=>
      array(2) {
        ["cod"]=>
        string(1) "3"
        ["nome"]=>
        string(14) "Belo Horizonte"
      }
      [3]=>
      array(2) {
        ["cod"]=>
        string(1) "4"
        ["nome"]=>
        string(12) "Porto Alegre"
      }
      [4]=>
      array(2) {
        ["cod"]=>
        string(1) "5"
        ["nome"]=>
        string(20) "Litoral de São Paulo"
      }
      [5]=>
      array(2) {
        ["cod"]=>
        string(1) "6"
        ["nome"]=>
        string(8) "Salvador"
      }
      [6]=>
      array(2) {
        ["cod"]=>
        string(1) "7"
        ["nome"]=>
        string(7) "Goiania"
      }
      [7]=>
      array(2) {
        ["cod"]=>
        string(1) "8"
        ["nome"]=>
        string(19) "São José dos Campos"
      }
      [8]=>
      array(2) {
        ["cod"]=>
        string(1) "9"
        ["nome"]=>
        string(14) "Ribeirão Preto"
      }
      [9]=>
      array(2) {
        ["cod"]=>
        string(2) "10"
        ["nome"]=>
        string(15) "Grande Curitiba"
      }
      [10]=>
      array(2) {
        ["cod"]=>
        string(2) "11"
        ["nome"]=>
        string(7) "Maringá"
      }
      [11]=>
      array(2) {
        ["cod"]=>
        string(2) "12"
        ["nome"]=>
        string(7) "Base PE"
      }
      [12]=>
      array(2) {
        ["cod"]=>
        string(2) "14"
        ["nome"]=>
        string(10) "Piracicaba"
      }
      [13]=>
      array(2) {
        ["cod"]=>
        string(2) "80"
        ["nome"]=>
        string(28) "São José dos Campos - Antiga"
      }
      [14]=>
      array(2) {
        ["cod"]=>
        string(2) "99"
        ["nome"]=>
        string(8) "Sem base"
      }
    }
  }
}

Link para o comentário
Compartilhar em outros sites

  • 0
Parceiro,

Aqui funcionou com o seguinte código

<?php
require ('lib/nusoap/lib/nusoap.php');

$wsdl = "http://services.satrotas.com.br/sat.asmx?wsdl";
$client = new SoapClient($wsdl,array('login' => 'Scott','password' => 123));

$err = $client->getError();

if ($err) {
    echo "Erro no construtor<pre>" . $err . "</pre>";
}

$proxy = $client->getProxy();

echo '<pre>';


$result = $proxy->ConsultaRegioes(array());

if ($client->fault) {
    echo "Falha<pre>" . print var_dump($result) . "</pre>";
} else {
    $err = $client->getError();
    if ($err) {
        echo "Erro<pre>" . $err . "</pre>";
    } else {
        print var_dump($result);
    }
}
Olha o retorno:
array(1) {
  ["ConsultaRegioesResult"]=>
  array(1) {
    ["Regiao"]=>
    array(15) {
      [0]=>
      array(2) {
        ["cod"]=>
        string(1) "1"
        ["nome"]=>
        string(16) "Grande São Paulo"
      }
      [1]=>
      array(2) {
        ["cod"]=>
        string(1) "2"
        ["nome"]=>
        string(14) "Rio de Janeiro"
      }
      [2]=>
      array(2) {
        ["cod"]=>
        string(1) "3"
        ["nome"]=>
        string(14) "Belo Horizonte"
      }
      [3]=>
      array(2) {
        ["cod"]=>
        string(1) "4"
        ["nome"]=>
        string(12) "Porto Alegre"
      }
      [4]=>
      array(2) {
        ["cod"]=>
        string(1) "5"
        ["nome"]=>
        string(20) "Litoral de São Paulo"
      }
      [5]=>
      array(2) {
        ["cod"]=>
        string(1) "6"
        ["nome"]=>
        string(8) "Salvador"
      }
      [6]=>
      array(2) {
        ["cod"]=>
        string(1) "7"
        ["nome"]=>
        string(7) "Goiania"
      }
      [7]=>
      array(2) {
        ["cod"]=>
        string(1) "8"
        ["nome"]=>
        string(19) "São José dos Campos"
      }
      [8]=>
      array(2) {
        ["cod"]=>
        string(1) "9"
        ["nome"]=>
        string(14) "Ribeirão Preto"
      }
      [9]=>
      array(2) {
        ["cod"]=>
        string(2) "10"
        ["nome"]=>
        string(15) "Grande Curitiba"
      }
      [10]=>
      array(2) {
        ["cod"]=>
        string(2) "11"
        ["nome"]=>
        string(7) "Maringá"
      }
      [11]=>
      array(2) {
        ["cod"]=>
        string(2) "12"
        ["nome"]=>
        string(7) "Base PE"
      }
      [12]=>
      array(2) {
        ["cod"]=>
        string(2) "14"
        ["nome"]=>
        string(10) "Piracicaba"
      }
      [13]=>
      array(2) {
        ["cod"]=>
        string(2) "80"
        ["nome"]=>
        string(28) "São José dos Campos - Antiga"
      }
      [14]=>
      array(2) {
        ["cod"]=>
        string(2) "99"
        ["nome"]=>
        string(8) "Sem base"
      }
    }
  }
}

Muito obrigado a todos, agora já está resolvido

Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,1k
    • Posts
      651,8k
×
×
  • Criar Novo...