IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Mon application mobile Discussion :

Phonegap avec SOAP


Sujet :

Mon application mobile

  1. #1
    Membre du Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Janvier 2012
    Messages
    56
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Janvier 2012
    Messages : 56
    Points : 60
    Points
    60
    Par défaut Phonegap avec SOAP
    Bonjour,

    Je suis en train de travailler avec phonegap. mon application consiste à faire un appel d'une fonction écrit en php avec nusoap. I write this code with phonegap.
    Le fichier index.html.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    <!DOCTYPE html>
    <!--
        Licensed to the Apache Software Foundation (ASF) under one
        or more contributor license agreements.  See the NOTICE file
        distributed with this work for additional information
        regarding copyright ownership.  The ASF licenses this file
        to you under the Apache License, Version 2.0 (the
        "License"); you may not use this file except in compliance
        with the License.  You may obtain a copy of the License at
    
        http://www.apache.org/licenses/LICENSE-2.0
    
        Unless required by applicable law or agreed to in writing,
        software distributed under the License is distributed on an
        "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
         KIND, either express or implied.  See the License for the
        specific language governing permissions and limitations
        under the License.
    -->
    <html>
        <head>
            <!--
            Customize this policy to fit your own app's needs. For more guidance, see:
                https://github.com/apache/cordova-plugin-whitelist/blob/master/README.md#content-security-policy
            Some notes:
                * gap: is required only on iOS (when using UIWebView) and is needed for JS->native communication
                * https://ssl.gstatic.com is required only on Android and is needed for TalkBack to function properly
                * Disables use of inline scripts in order to mitigate risk of XSS vulnerabilities. To change this:
                    * Enable inline JS: add 'unsafe-inline' to default-src
            -->
            <meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">
            <meta name="format-detection" content="telephone=no">
            <meta name="msapplication-tap-highlight" content="no">
            <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
            <link rel="stylesheet" type="text/css" href="css/index.css">
            <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
    <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
    
            <script type="text/javascript" src="js/jquery.js"></script>
            <title>Hello World</title>
        </head>
        <body>
          <form method="post">
                    <table>
                    <tr>
                       <td>nom:</td>
                   <td> <input type="text" id="nom"></td>
                   </tr>
                   <tr>
                   <td>prenom:</td>
       <td> <input type="text" id="prenom"></td>
       </tr>
      
      
       <tr>
       
       <td> <input type="button" id="insert" value="Ajouter"></td>
       </tr>
       </table>
       </form> 
            <script type="text/javascript" src="cordova.js"></script>
            <script type="text/javascript" src="js/index.js"></script>
            <script type="text/javascript" src="js/post.js"></script>
        </body>
    </html>
    Comme fonction avec javascript
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
     $(document).ready(function()
     {
     $("#insert").click(function(){
     var nom=$("#nom").val();
     var prenom=$("#prenom").val();
     
     var dataString="nom="+nom+"&prenom="+prenom;
     $.ajax({
                url:"http://192.168.1.12/fou/server.php/create_promo",
                type:"POST",
                data:dataString,
                crossDomain:true, 
                cache:false,
             
                success: function(data){
                    if (data=="ok")
                    {
                        alert("inserted");
                       
                    }
                    else if (data=="error")
                    {
                        alert("error");
                    }
                },
                error: function(err){
                     alert('error'+err);
                }
    	   
    });
    	
    
        });
    });
    La méthode créer avec php et le webservice nusoap a pour but l'ajout dans la base de données.

    J'ai en résultat une alert avec error[object Object], je teste sur android.

    Merci

  2. #2
    Membre du Club
    Profil pro
    Inscrit en
    Janvier 2010
    Messages
    36
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Janvier 2010
    Messages : 36
    Points : 42
    Points
    42
    Par défaut
    Salut,

    - est-ce que les infos sont stockée en base? (= le script coté serveur fonctionne)
    - si tu as chrome ou firefox, pose un breakpoint sur la ligne >alert('error'+err); < et inspecte l'objet err. Tu devrais avoir un message pour t'aider à avancer.

Discussions similaires

  1. VBA : Service Web avec SOAP et HTTPS
    Par uftu1 dans le forum VBA Access
    Réponses: 1
    Dernier message: 06/09/2007, 12h02
  2. Transfert fichier avec SOAP
    Par subseven dans le forum Services Web
    Réponses: 1
    Dernier message: 24/04/2007, 16h08
  3. DELPHI. Problème avec Soap et une DLL.
    Par SER dans le forum Delphi
    Réponses: 1
    Dernier message: 01/03/2007, 10h58
  4. Que peut on faire avec SOAP?
    Par feed_our_vision dans le forum XML/XSL et SOAP
    Réponses: 2
    Dernier message: 19/05/2006, 18h11
  5. Passer des Image avec SOAP
    Par pef421 dans le forum XML/XSL et SOAP
    Réponses: 2
    Dernier message: 01/03/2004, 21h32

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo