Visualizzazione dei risultati da 1 a 5 su 5
  1. #1

    WSDL/SOAP - accedere a Web Service con PHP

    Messaggio d'errore:

    Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://www.xxxxxx.com/ita/codice/id_service.php' : Premature end of data in tag html line 2 in /web/htdocs/www.aaaaaaaa.it/home/motchpotch.php:31 Stack trace: #0 /web/htdocs/www.aaaaaaaa.it/home/motchpotch.php(31): SoapClient->SoapClient('http://www.xxxx...', Array) #1 {main} thrown in /web/htdocs/www.aaaaaaaa.it/home/motchpotch.php on line 31

    Codice PHP:
    error_reporting(-1);
    ini_set('display_errors'TRUE);

    $wsdl 'http://www.xxxxxx.com/ita/codice/id_service.php';
    $id_user '00000'//user ID = l'id dell'utente assegnato per l'accesso al sito
    $id_serv_user 'zzzzzz'//serv_user ID = l'id assegnato allo sviluppatore.


    class RequestType
    {
        public 
    $user_id;
        public 
    $serv_user_id
    }
     
    $options = array();
    $options['classmap']['getConnIdType']  = 'RequestType';

    $bank = new RequestType;
    $bank->user_id $id_user;
    $bank->serv_user_id $id_serv_user;

    $soapclient = new SoapClient($wsdl,$options);
    $result $soapclient->getConnId($bank); 
    codice HTML:
    <h1>Result</h1>
    <pre>
    Codice PHP:
    var_dump($result
    codice HTML:
    </pre>
    Io con questo script devo accedere e il web service mi da un "token" con quale poi posso fare altre chiamate per le informazioni sui vari prodotti.

    Altra domanda: Nel mio caso, mi è stato indicato di accedere al web service con questo indirizzo che vedete, che finisce con .php ... negli esempi invece ho visto sempre, che l'indirizzo finisce con .wsdl
    Può essere qui il problema?
    L'indicazione è quella:
    [indicazione]
    I servizi messi a disposizione sul server www.xxxxxx.com sono attivi sulla porta 80 e sono
    implementati con lo standard WSDL/SOAP.
    ... controllo dell’accesso basato sul protocollo CHAP ...
    1- Il client interroga il servizio http://www.xxxxxx.com/ita/codice/id_service.php
    richiamando la funzione getConnId(user,serv_user) dove user è l’id dell’utente
    assegnato per l’accesso al sito e serv_user è l’id assegnato allo sviluppatore.
    2- Il server restituisce una stringa numerica lunga 16 caratteri chiamata TOKEN. Questo
    costituisce il “biglietto” che da diritto ad effettuare la successiva chiamata al servizio vero e
    proprio. Ad ogni chiamata il TOKEN è sempre diverso ed utilizzabile per 1 sola chiamata
    successiva.
    [/indicazione]

    Grazie anche per ogni piccolo aiuto!
    ciao
    topolina
    :-)

  2. #2
    domanda: se metti la url che tu usi per il wsdl nel tuo browser, vedi un wsdl? perchè se non vedi un wsdl è un cavoletto di bruxelles.... se ha problemi SoapClient (mi parrebbe strano) potresti anche provare a scaricarti il wsdl sul server e a farglielo leggere da locale
    IP-PBX management: http://www.easypbx.it

    Old account: 2126 messages
    Oldest account: 3559 messages

  3. #3
    sì, il web service risponde:

    [wsdl]
    <definitions targetNamespace="http://www.xxxxxx.com">
    <types>
    <xsd:schema targetNamespace="http://www.xxxxxx.com">
    <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
    <xsd:import namespace="http://schemas.xmlsoap.org/wsdl/"/>
    <xsd:complexType name="id">
    <xsd:all>
    <xsd:element name="id" type="xsd:string"/>
    </xsd:all>
    </xsd:complexType>
    </xsd:schema>
    </types>
    <message name="getConnIdRequest">
    <part name="user" type="xsd:string"/>
    <part name="serv_user" type="xsd:string"/>
    </message>
    <message name="getConnIdResponse">
    <part name="return" type="tns:id"/>
    </message>
    <portType name="id_servicePortType">
    <operation name="getConnId">
    <input message="tns:getConnIdRequest"/>
    <output message="tns:getConnIdResponse"/>
    </operation>
    </portType>
    <binding name="id_serviceBinding" type="tns:id_servicePortType">
    <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="getConnId">
    <soap:operation soapAction="http://www.xxxxxx.com/ita/codice/id_service.php/getConnId" style="rpc"/>
    <input>
    <soap:body use="encoded" namespace="http://www.xxxxxx.com" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
    </input>
    <output>
    <soap:body use="encoded" namespace="http://www.xxxxxx.com" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
    </output>
    </operation>
    </binding>
    <service name="id_service">
    <port name="id_servicePort" binding="tns:id_serviceBinding">
    <soap:address location="http://www.xxxxxx.com/ita/codice/id_service.php"/>
    </port>
    </service>
    </definitions>
    [/wsdl]

    [getConnId]
    Name: getConnId
    Binding: id_serviceBinding
    Endpoint: http://www.xxxxxx.com/ita/codice/id_service.php
    SoapAction: http://www.xxxxxx.com/ita/codice/id_....php/getConnId
    Style: rpc
    Input:
    use: encoded
    namespace: http://www.xxxxxx.com
    encodingStyle: http://schemas.xmlsoap.org/soap/encoding/
    message: getConnIdRequest
    parts:
    user: xsd:string
    serv_user: xsd:string
    Output:
    use: encoded
    namespace: http://www.xxxxxx.com
    encodingStyle: http://schemas.xmlsoap.org/soap/encoding/
    message: getConnIdResponse
    parts:
    return: tns:id
    Namespace: http://www.xxxxxx.com
    Transport: http://schemas.xmlsoap.org/soap/http
    [/getConnId]

    Grazie mille per ogni consiglio!
    ciao
    topolina
    :-)

  4. #4
    L'indirizzo era sbagliato ... ho aggiunto ?wsdl

    $wsdl = 'http://www.xxxxxx.com/ita/codice/id_service.php?wsdl';

    Adesso viene il messaggio:
    Catchable fatal error: Object of class RequestType could not be converted to string in /web/htdocs/www.aaaaaa.it/home/motchpotch.php on line 32

    ciao
    topolina
    :-)

  5. #5
    riuscita ... vi posto la soluzione (ho pensato troppo difficile ...):

    $soapclient = new SoapClient($wsdl);
    $result = $soapclient->getConnId($id_user,$id_serv_user);

    ciao
    topolina
    :-)

Tag per questa discussione

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.