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

webservice ... socorro :)


Diuliano

Pergunta

3 respostass a esta questão

Posts Recomendados

  • 0

Diuliano,

Não compreendi sua dúvida.

O WSDL serve para você conhecer quais os métodos disponibilizados pelo WS, quais os parâmetros você tem que passar para cada método e qual o tipo de retorno.

Geralmente o WSDL tem que ser disponibilizado para você conhecer as regras. Mesmo para você criar classes proxy, você terá que conhecer o WSDL.

Link para o comentário
Compartilhar em outros sites

  • 0
Diuliano,

Não compreendi sua dúvida.

O WSDL serve para você conhecer quais os métodos disponibilizados pelo WS, quais os parâmetros você tem que passar para cada método e qual o tipo de retorno.

Geralmente o WSDL tem que ser disponibilizado para você conhecer as regras. Mesmo para você criar classes proxy, você terá que conhecer o WSDL.

sim eu tenho o wsdl tipo...

mas esse é o wsdl ai estão as regras:

bws.voegol.com.br.Utilities.wsdl

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:tns="http://bws.voegol.com.br/Utilities" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Utilities" targetNamespace="http://bws.voegol.com.br/Utilities" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  <wsdl:types>
    <xsd:schema targetNamespace="http://bws.voegol.com.br/Utilities/Imports">
      <xsd:import schemaLocation="" namespace="http://bws.voegol.com.br/Utilities" />
    </xsd:schema>
  </wsdl:types>
  <wsdl:message name="IUtilities_GetValidStations_InputMessage">
    <wsdl:part name="parameters" element="tns:GetValidStations" />
  </wsdl:message>
  <wsdl:message name="IUtilities_GetValidStations_OutputMessage">
    <wsdl:part name="parameters" element="tns:GetValidStationsResponse" />
  </wsdl:message>
  <wsdl:message name="IUtilities_GetFlightDelayInformation_InputMessage">
    <wsdl:part name="parameters" element="tns:GetFlightDelayInformation" />
  </wsdl:message>
  <wsdl:message name="IUtilities_GetFlightDelayInformation_OutputMessage">
    <wsdl:part name="parameters" element="tns:GetFlightDelayInformationResponse" />
  </wsdl:message>
  <wsdl:portType name="IUtilities">
    <wsdl:operation name="GetValidStations">
      <wsdl:input wsaw:Action="http://bws.voegol.com.br/Utilities/GetValidStations" message="tns:IUtilities_GetValidStations_InputMessage" />
      <wsdl:output wsaw:Action="http://bws.voegol.com.br/Utilities/GetValidStationsResponse" message="tns:IUtilities_GetValidStations_OutputMessage" />
    </wsdl:operation>
    <wsdl:operation name="GetFlightDelayInformation">
      <wsdl:input wsaw:Action="http://bws.voegol.com.br/Utilities/FlightDelayInformation" message="tns:IUtilities_GetFlightDelayInformation_InputMessage" />
      <wsdl:output wsaw:Action="http://bws.voegol.com.br/Utilities/FlightDelayInformationResponse" message="tns:IUtilities_GetFlightDelayInformation_OutputMessage" />
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="BasicHttpBinding_IUtilities" type="tns:IUtilities">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="GetValidStations">
      <soap:operation soapAction="http://bws.voegol.com.br/Utilities/GetValidStations" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="GetFlightDelayInformation">
      <soap:operation soapAction="http://bws.voegol.com.br/Utilities/FlightDelayInformation" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="Utilities">
    <wsdl:port name="BasicHttpBinding_IUtilities" binding="tns:BasicHttpBinding_IUtilities">
      <soap:address location="https://bws.voegol.com.br/BWS/Utilities.svc" />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>
tambem tenho isso... bws.voegol.com.br.Utilities.xsd
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:tns="http://bws.voegol.com.br/Utilities" elementFormDefault="qualified" targetNamespace="http://bws.voegol.com.br/Utilities" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="GetValidStations">
    <xs:complexType />
  </xs:element>
  <xs:element name="GetValidStationsResponse">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" maxOccurs="1" name="GetValidStationsResult" type="tns:ArrayOfStation" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:complexType name="ArrayOfStation">
    <xs:sequence>
      <xs:element minOccurs="0" maxOccurs="unbounded" name="Station" nillable="true" type="tns:Station" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="Station">
    <xs:sequence>
      <xs:element minOccurs="0" maxOccurs="1" name="IATA" type="xs:string" />
      <xs:element minOccurs="0" maxOccurs="1" name="Name" type="xs:string" />
      <xs:element minOccurs="0" maxOccurs="1" name="MAC" type="xs:string" />
    </xs:sequence>
  </xs:complexType>
  <xs:element name="GetFlightDelayInformation">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" maxOccurs="1" name="flightDelayRequests" type="tns:ArrayOfFlightDelayRequest" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:complexType name="ArrayOfFlightDelayRequest">
    <xs:sequence>
      <xs:element minOccurs="0" maxOccurs="unbounded" name="FlightDelayRequest" nillable="true" type="tns:FlightDelayRequest" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="FlightDelayRequest">
    <xs:sequence>
      <xs:element minOccurs="0" maxOccurs="1" name="CarrierCode" type="xs:string" />
      <xs:element minOccurs="0" maxOccurs="1" name="FlightNumber" type="xs:string" />
      <xs:element minOccurs="0" maxOccurs="1" name="DepartureStation" type="xs:string" />
      <xs:element minOccurs="0" maxOccurs="1" name="ArrivalStation" type="xs:string" />
    </xs:sequence>
  </xs:complexType>
  <xs:element name="GetFlightDelayInformationResponse">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" maxOccurs="1" name="GetFlightDelayInformationResult" type="tns:ArrayOfFlightDelayInformation" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:complexType name="ArrayOfFlightDelayInformation">
    <xs:sequence>
      <xs:element minOccurs="0" maxOccurs="unbounded" name="FlightDelayInformation" nillable="true" type="tns:FlightDelayInformation" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="FlightDelayInformation">
    <xs:sequence>
      <xs:element minOccurs="0" maxOccurs="1" name="CarrierCode" type="xs:string" />
      <xs:element minOccurs="0" maxOccurs="1" name="FlightNumber" type="xs:string" />
      <xs:element minOccurs="0" maxOccurs="1" name="DepartureStation" type="xs:string" />
      <xs:element minOccurs="0" maxOccurs="1" name="ArrivalStation" type="xs:string" />
      <xs:element minOccurs="1" maxOccurs="1" name="Delays_30Plus" type="xs:int" />
      <xs:element minOccurs="1" maxOccurs="1" name="Delays_60Plus" type="xs:int" />
      <xs:element minOccurs="1" maxOccurs="1" name="Cancelations" type="xs:int" />
    </xs:sequence>
  </xs:complexType>
</xs:schema>
eu queria saber como criar classes proxy, por so sei fazer o acesso xml podendo baixar o wsdl tipo quando usa a função. exemplo:
soapclient('http://webservice.host.com.br/?wsdl', true);

so sei assim queria saber esse outro modo de se realizar essa pesquisa :/...

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

  • 0

Prezado,

Estude um pouco sobre web services, wsdl, client e server.

Segue link que aborda nusoap, configuração do servidor e cliente. Está em inglês: http://www.scottnichol.com/nusoapprogwsdl.htm

Segue abaixo um exemplo para consumir um serviço que disponibiliza um método hello e espera um array como parâmetro

<?php

// Pull in the NuSOAP code
require_once('nusoap.php');

// Create the client instance
$client = new soapclient('http://localhost/phphack/hellowsdl2.php?wsdl', true);

// 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
}

// Create the proxy
$proxy = $client->getProxy();

// Call the SOAP method
$person = array('firstname' => 'Willi', 'age' => 22, 'gender' => 'male');
$result = $proxy->hello($person);

// Check for a fault
if ($proxy->fault) {
    echo '<h2>Fault</h2><pre>';
    print_r($result);
    echo '</pre>';
} else {
    // Check for errors
    $err = $proxy->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>';
    }
}

// Display the request and response
echo '<h2>Request</h2>';
echo '<pre>' . htmlspecialchars($proxy->request, ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2>';
echo '<pre>' . htmlspecialchars($proxy->response, ENT_QUOTES) . '</pre>';
// Display the debug messages
echo '<h2>Debug</h2>';
echo '<pre>' . htmlspecialchars($proxy->debug_str, ENT_QUOTES) . '</pre>';
?>

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,3k
    • Posts
      652,5k
×
×
  • Criar Novo...