Visualizzazione dei risultati da 1 a 8 su 8

Discussione: PHP & Webservices

  1. #1

    PHP & Webservices

    Ciao a tutti!

    Qui al lavoro stiamo affrontando la problematica dei webservices & PHP. Il nostro sito, infatti, si dovrebbe interfacciare con due webservices per l'autenticazione e l'invio di pratiche ad Infocamere, che espone questi webservices con due WSDL:

    AUTENTICAZIONE MINOSSE (dovrebbe rilasciare un token di autenticazione)
    https://mnsews.infocamere.it/Minosse...n:Minosse?wsdl

    SERVIZI INVIO INFOCAMERE
    http://webtelemaco.infocamere.it/wsc...ioneUnica?wsdl

    Lavorando in PHP, abbiamo utilizzato degli strumenti tipo wsdl2php per generare a partire dall'XML delle WSDL le classi con cui interfacciarci. Per quel che riguarda minosse, però, otteniamo un errore "Missing Soap Binding", come se l'XML non fosse ben strutturato (credo). Come un unico riferimento da infocamere c'è un documento piuttosto generico

    http://www.registroimprese.it/dama/c...esComUnica.pdf

    e un esempio di client offline realizzato in Java. Essendo che il servizio viene già usufruito da altri, probabilmente siamo noi a sbagliare qualcosa. Avete qualche esperienza in merito di webservice? Noi stiamo un pò brancolando nel buio, quindi qualsiasi dritta sarebbe ben accetta...

  2. #2
    Mhmm, controllando con un validatore online, ad esempio

    http://www.validwsdl.com

    noto che la WSDL di minosse pare avere qualche problema... non sono sicuro che si possa usare il soapclient di PHP, visto che dal sito di Infocamere c'è solo un esempio di client in Java. Forse non è stato pensato per essere usufruibile o testato con il php... ?

    Infocamere non rilascia documentazione su questo webservice che dovrebbe essere pubblico?

  3. #3
    adesso non ho tempo di controllare meglio, però se il problema è il wsdl potete provare a "ripararlo" e poi riusare gli strumenti specifici. Io ho usato molto bene wsf (http://wso2.com/products/web-services-framework/php/) per la creazione di webservices, fa bene il suo lavoro e volendo ti tira giù tutto il debug del mondo (oddio, la parte server, il client non so non l'ho mai usato)

    Se proprio wsdl2php fallisce, costruitevi le classi a mano, tanto sono alquanto banali...
    IP-PBX management: http://www.easypbx.it

    Old account: 2126 messages
    Oldest account: 3559 messages

  4. #4
    Grazie per la risposta.

    Il WSDL non è creata da noi, ma da Infocamere; avendo però un "urn:" nel titolo sembra dare un errore di binding. Ovviamente non posso correggerla (non è nel mio server), ma a scopo sperimentale ho provato a salvare l'XML e generare le classi togliendo quell' "urn:". La generazione va a buon fine, ma quando ovviamente provo a usare le classi con la WSDL reale, mi si ripropone l'errore di binding.

  5. #5
    sinceramente, wsdl2php non l'ho mai usato,e provandolo mi dà il tuo stesso errore. Ho invece provato ad usare wsf, e il client me lo genera correttamente (sinceramente non l'ho provato, ma non mi ha dato problemi nel crearmi client e classi). Potete provare quello magari...
    IP-PBX management: http://www.easypbx.it

    Old account: 2126 messages
    Oldest account: 3559 messages

  6. #6
    cmq questo è l'output generato da wsdl:

    Codice PHP:

    <?php

    // PHP classes corresponding to the data types in defined in WSDL

    class register {
        public 
    $in0;
        public 
    $in1;
        public 
    $in2;
    }

    class 
    getGroup {
        public 
    $in0;
    }

    class 
    getGroupResponse {
        public 
    $getGroupReturn;
    }

    class 
    login {
        public 
    $in0;

        
    // You need to set only one from the following two vars

        /**
         * @var Plain Binary
         */
        
    public $in1;

        
    /**
         * @var base64Binary
         */
        
    public $in1_encoded;
        public 
    $in2;
        public 
    $in3;
        public 
    $in4;
    }

    class 
    loginResponse {
        public 
    $loginReturn;
    }

    class 
    getProfiles {
        public 
    $in0;
    }

    class 
    getProfilesResponse {

        
    /**
         * @var (object)ArrayOf_soapenc_string
         */
        
    public $getProfilesReturn;

    }

    class 
    ArrayOf_soapenc_string {

    }

    class 
    logout {

        
    /**
         * @var string
         */
        
    public $in0;

    }

    class 
    certificateLogin {

        
    // You need to set only one from the following two vars

        /**
         * @var Plain Binary
         */
        
    public $in0;

        
    /**
         * @var base64Binary
         */
        
    public $in0_encoded;


        
    /**
         * @var string
         */
        
    public $in1;

        
    /**
         * @var string
         */
        
    public $in2;

        
    /**
         * @var string
         */
        
    public $in3;

    }

    class 
    certificateLoginResponse {

        
    /**
         * @var string
         */
        
    public $certificateLoginReturn;

    }

    class 
    logoutAndLogin {

        
    /**
         * @var string
         */
        
    public $in0;

        
    /**
         * @var string
         */
        
    public $in1;

        
    // You need to set only one from the following two vars

        /**
         * @var Plain Binary
         */
        
    public $in2;

        
    /**
         * @var base64Binary
         */
        
    public $in2_encoded;


        
    /**
         * @var string
         */
        
    public $in3;

        
    /**
         * @var string
         */
        
    public $in4;

        
    /**
         * @var string
         */
        
    public $in5;

    }

    class 
    logoutAndLoginResponse {

        
    /**
         * @var string
         */
        
    public $logoutAndLoginReturn;

    }

    class 
    connectionLogin {

        
    /**
         * @var string
         */
        
    public $in0;

        
    /**
         * @var string
         */
        
    public $in1;

        
    /**
         * @var string
         */
        
    public $in2;

        
    /**
         * @var string
         */
        
    public $in3;

    }

    class 
    connectionLoginResponse {

        
    /**
         * @var string
         */
        
    public $connectionLoginReturn;

    }

    class 
    getUserId {

        
    /**
         * @var string
         */
        
    public $in0;

    }

    class 
    getUserIdResponse {

        
    /**
         * @var string
         */
        
    public $getUserIdReturn;

    }

    class 
    verifyRequest {

        
    /**
         * @var string
         */
        
    public $in0;

        
    /**
         * @var string
         */
        
    public $in1;

        
    /**
         * @var string
         */
        
    public $in2;

        
    /**
         * @var string
         */
        
    public $in3;

    }

    class 
    verifyRequestResponse {

        
    /**
         * @var boolean
         */
        
    public $verifyRequestReturn;

    }

    class 
    getIut {

        
    /**
         * @var string
         */
        
    public $in0;

    }

    class 
    getIutResponse {

        
    /**
         * @var string
         */
        
    public $getIutReturn;

    }

    class 
    getAnagrafica {

        
    /**
         * @var string
         */
        
    public $in0;

    }

    class 
    getAnagraficaResponse {

        
    /**
         * @var (object)Map
         */
        
    public $getAnagraficaReturn;

    }

    class 
    Map {

        
    /**
         * @var array[0, unbounded] of (object)mapItem
         */
        
    public $item;

    }

    class 
    mapItem {

        
    /**
         * @var (object)anyType
         */
        
    public $key;

        
    /**
         * @var (object)anyType
         */
        
    public $value;

    }

    class 
    verifyProfile {

        
    /**
         * @var string
         */
        
    public $in0;

        
    /**
         * @var string
         */
        
    public $in1;

    }

    class 
    verifyProfileResponse {

        
    /**
         * @var boolean
         */
        
    public $verifyProfileReturn;

    }

    class 
    verifyRole {

        
    /**
         * @var string
         */
        
    public $in0;

        
    /**
         * @var string
         */
        
    public $in1;

    }

    class 
    verifyRoleResponse {

        
    /**
         * @var boolean
         */
        
    public $verifyRoleReturn;

    }

    class 
    writeLogAccount {

        
    /**
         * @var string
         */
        
    public $in0;

        
    /**
         * @var (object)Map
         */
        
    public $in1;

    }

    class 
    changePassword {

        
    /**
         * @var string
         */
        
    public $in0;

        
    // You need to set only one from the following two vars

        /**
         * @var Plain Binary
         */
        
    public $in1;

        
    /**
         * @var base64Binary
         */
        
    public $in1_encoded;


        
    // You need to set only one from the following two vars

        /**
         * @var Plain Binary
         */
        
    public $in2;

        
    /**
         * @var base64Binary
         */
        
    public $in2_encoded;


        
    // You need to set only one from the following two vars

        /**
         * @var Plain Binary
         */
        
    public $in3;

        
    /**
         * @var base64Binary
         */
        
    public $in3_encoded;


    }

    class 
    connectionAndCertificateLogin {

        
    /**
         * @var string
         */
        
    public $in0;

        
    // You need to set only one from the following two vars

        /**
         * @var Plain Binary
         */
        
    public $in1;

        
    /**
         * @var base64Binary
         */
        
    public $in1_encoded;


        
    /**
         * @var string
         */
        
    public $in2;

    }

    class 
    connectionAndCertificateLoginResponse {

        
    /**
         * @var string
         */
        
    public $connectionAndCertificateLoginReturn;

    }

    class 
    sessionout {

        
    /**
         * @var string
         */
        
    public $in0;

        
    /**
         * @var string
         */
        
    public $in1;

    }

    class 
    getAnagraficaItem {

        
    /**
         * @var string
         */
        
    public $in0;

        
    /**
         * @var string
         */
        
    public $in1;

    }

    class 
    getAnagraficaItemResponse {

        
    /**
         * @var string
         */
        
    public $getAnagraficaItemReturn;

    }

    // define the class map
    $class_map = array(
        
    "register" => "register",
        
    "getGroup" => "getGroup",
        
    "getGroupResponse" => "getGroupResponse",
        
    "login" => "login",
        
    "loginResponse" => "loginResponse",
        
    "getProfiles" => "getProfiles",
        
    "getProfilesResponse" => "getProfilesResponse",
        
    "ArrayOf_soapenc_string" => "ArrayOf_soapenc_string",
        
    "logout" => "logout",
        
    "certificateLogin" => "certificateLogin",
        
    "certificateLoginResponse" => "certificateLoginResponse",
        
    "logoutAndLogin" => "logoutAndLogin",
        
    "logoutAndLoginResponse" => "logoutAndLoginResponse",
        
    "connectionLogin" => "connectionLogin",
        
    "connectionLoginResponse" => "connectionLoginResponse",
        
    "getUserId" => "getUserId",
        
    "getUserIdResponse" => "getUserIdResponse",
        
    "verifyRequest" => "verifyRequest",
        
    "verifyRequestResponse" => "verifyRequestResponse",
        
    "getIut" => "getIut",
        
    "getIutResponse" => "getIutResponse",
        
    "getAnagrafica" => "getAnagrafica",
        
    "getAnagraficaResponse" => "getAnagraficaResponse",
        
    "Map" => "Map",
        
    "mapItem" => "mapItem",
        
    "verifyProfile" => "verifyProfile",
        
    "verifyProfileResponse" => "verifyProfileResponse",
        
    "verifyRole" => "verifyRole",
        
    "verifyRoleResponse" => "verifyRoleResponse",
        
    "writeLogAccount" => "writeLogAccount",
        
    "changePassword" => "changePassword",
        
    "connectionAndCertificateLogin" => "connectionAndCertificateLogin",
        
    "connectionAndCertificateLoginResponse" => "connectionAndCertificateLoginResponse",
        
    "sessionout" => "sessionout",
        
    "getAnagraficaItem" => "getAnagraficaItem",
        
    "getAnagraficaItemResponse" => "getAnagraficaItemResponse");


    ?>
    IP-PBX management: http://www.easypbx.it

    Old account: 2126 messages
    Oldest account: 3559 messages

  7. #7

    seconda parte:

    Codice PHP:
    try {

        
    // create client in WSDL mode
        
    $client = new WSClient(array ("wsdl" =>"https://mnsews.infocamere.it/Minosse2WebService/services/urn:Minosse?wsdl",
            
    "classmap" => $class_map));

        
    // get proxy object reference form client 
        
    $proxy $client->getProxy();

        
    // create input object and set values
        
    $input = new register();
        
    //TODO: fill in the class fields of $input to match your business logic

        // call the operation
        
    $response $proxy->register($input);
        
    //TODO: Implement business logic to consume $response, which is of type anyType

        
    $input = new getGroup();
        
    //TODO: fill in the class fields of $input to match your business logic

        // call the operation
        
    $response $proxy->getGroup($input);
        
    //TODO: Implement business logic to consume $response, which is of type getGroupResponse

        
    $input = new login();
        
    //TODO: fill in the class fields of $input to match your business logic

        // call the operation
        
    $response $proxy->login($input);
        
    //TODO: Implement business logic to consume $response, which is of type loginResponse

        
    $input = new getProfiles();
        
    //TODO: fill in the class fields of $input to match your business logic

        // call the operation
        
    $response $proxy->getProfiles($input);
        
    //TODO: Implement business logic to consume $response, which is of type getProfilesResponse

        
    $input = new logout();
        
    //TODO: fill in the class fields of $input to match your business logic

        // call the operation
        
    $response $proxy->logout($input);
        
    //TODO: Implement business logic to consume $response, which is of type anyType

        
    $input = new certificateLogin();
        
    //TODO: fill in the class fields of $input to match your business logic

        // call the operation
        
    $response $proxy->certificateLogin($input);
        
    //TODO: Implement business logic to consume $response, which is of type certificateLoginResponse

        
    $input = new logoutAndLogin();
        
    //TODO: fill in the class fields of $input to match your business logic

        // call the operation
        
    $response $proxy->logoutAndLogin($input);
        
    //TODO: Implement business logic to consume $response, which is of type logoutAndLoginResponse

        
    $input = new connectionLogin();
        
    //TODO: fill in the class fields of $input to match your business logic

        // call the operation
        
    $response $proxy->connectionLogin($input);
        
    //TODO: Implement business logic to consume $response, which is of type connectionLoginResponse

        
    $input = new getUserId();
        
    //TODO: fill in the class fields of $input to match your business logic

        // call the operation
        
    $response $proxy->getUserId($input);
        
    //TODO: Implement business logic to consume $response, which is of type getUserIdResponse

        
    $input = new verifyRequest();
        
    //TODO: fill in the class fields of $input to match your business logic

        // call the operation
        
    $response $proxy->verifyRequest($input);
        
    //TODO: Implement business logic to consume $response, which is of type verifyRequestResponse

        
    $input = new getIut();
        
    //TODO: fill in the class fields of $input to match your business logic

        // call the operation
        
    $response $proxy->getIut($input);
        
    //TODO: Implement business logic to consume $response, which is of type getIutResponse

        
    $input = new getAnagrafica();
        
    //TODO: fill in the class fields of $input to match your business logic

        // call the operation
        
    $response $proxy->getAnagrafica($input);
        
    //TODO: Implement business logic to consume $response, which is of type getAnagraficaResponse

        
    $input = new verifyProfile();
        
    //TODO: fill in the class fields of $input to match your business logic

        // call the operation
        
    $response $proxy->verifyProfile($input);
        
    //TODO: Implement business logic to consume $response, which is of type verifyProfileResponse

        
    $input = new verifyRole();
        
    //TODO: fill in the class fields of $input to match your business logic

        // call the operation
        
    $response $proxy->verifyRole($input);
        
    //TODO: Implement business logic to consume $response, which is of type verifyRoleResponse

        
    $input = new writeLogAccount();
        
    //TODO: fill in the class fields of $input to match your business logic

        // call the operation
        
    $response $proxy->writeLogAccount($input);
        
    //TODO: Implement business logic to consume $response, which is of type anyType

        
    $input = new changePassword();
        
    //TODO: fill in the class fields of $input to match your business logic

        // call the operation
        
    $response $proxy->changePassword($input);
        
    //TODO: Implement business logic to consume $response, which is of type anyType

        
    $input = new connectionAndCertificateLogin();
        
    //TODO: fill in the class fields of $input to match your business logic

        // call the operation
        
    $response $proxy->connectionAndCertificateLogin($input);
        
    //TODO: Implement business logic to consume $response, which is of type connectionAndCertificateLoginResponse

        
    $input = new sessionout();
        
    //TODO: fill in the class fields of $input to match your business logic

        // call the operation
        
    $response $proxy->sessionout($input);
        
    //TODO: Implement business logic to consume $response, which is of type anyType

        
    $input = new getAnagraficaItem();
        
    //TODO: fill in the class fields of $input to match your business logic

        // call the operation
        
    $response $proxy->getAnagraficaItem($input);
        
    //TODO: Implement business logic to consume $response, which is of type getAnagraficaItemResponse

    } catch (Exception $e) {
        
    // in case of an error, process the fault
        
    if ($e instanceof WSFault) {
            
    printf("Soap Fault: %s\n"$e->Reason);
        } else {
            
    printf("Message = %s\n"$e->getMessage());
        }

    IP-PBX management: http://www.easypbx.it

    Old account: 2126 messages
    Oldest account: 3559 messages

  8. #8
    Grazie ancora per l'aiuto. Sembra impossibile, ma pare che documentazione su questi servizi (che pur dovrebbero essere pubblicamente disponibili, in quanto esposti dalle camere di commercio) sia introvabile...

    Aggiungiamo pure la mia inesperienza e capirai quante difficoltà sto incontrando.

    Detto questo: le classi che tu mi hai postate sono molto differenti da quelle generate (col barbatrucco di cui ho raccontato sopra) da apigenerator.com

    Qui, infatti, vengono generate delle classi per le varie funzioni (es. login) dove prima mi venivano generate come metodi. Come faccio in questo caso a passare i parametri? devo istanziare ad es. login e settare user e password?

    Secondo, ma questo credo dipenda dall'uso del WSF.... mi dà l'errore Class 'WSClient' not found perchè forse mi manca qualche componente di questo software...

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.