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

Services Web Java Discussion :

Webservice se comportant de façon "serveur" aussi bien que "client"


Sujet :

Services Web Java

  1. #1
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2010
    Messages
    16
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Suisse

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Finance

    Informations forums :
    Inscription : Avril 2010
    Messages : 16
    Par défaut Webservice se comportant de façon "serveur" aussi bien que "client"
    Bonjour,

    Mon problème est le suivant (je pense que c'est tout con mais je bloque vraiment):

    Dans le cadre d'un projet que je dois faire, j'ai créé une application n-tiers avec l'architecture suivante,

    Une servlet (couche présentation) appel un webservice en java (couche métier) qui lui même appel un autre webservice en PHP (couche données) qui enfin irra interrogé une base de données xml.

    Mon problème se situe au niveau du webservice java, j'arrive à l'interroger avec ma servlet du moment que je n'intègre pas les service qui irront interrogé le webservice PHP, mais dès que j'intègre ces fonctions, mon wsdl n'est plus fonctionnel.

    En gros ma question est : comment fait-on pour avoir un webservice qui se comporte de manière serveur autant que client ?

    J'ai essayé de mettre les stub clients généré par le WS PHP dans tous les dossiers inimaginables sans succès.

    Ci-dessous le code de mon WS java, merci d'avance pour votre aide.


    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
     
    import org.apache.axis.AxisFault;
    import org.apache.axis.MessageContext;
    import org.apache.axis.transport.http.HTTPConstants;
    import java.util.Enumeration;
    import java.util.ArrayList;
    import java.util.Iterator;
    import java.io.*; 
    import java.rmi.RemoteException;
    import javax.xml.rpc.ServiceException;
    import maTargetNameSpace.*;
     
    public class WEBserviceP
    {
      public String welcome(String sexe, String prenom, String nom) 
      {
        String message = "Bonjour " + sexe + " " + prenom + " " + nom + "<br />";
        return message;
      }
     
      public String map(String dst)
      {
        String js = "initialize('" + dst + "')";
        return js;
      }
     
      public static double convert(double localamount , String dpt, String dst)
      { 
        MonSERVICELocator service = new MonSERVICELocator();
        String rate=null;
        try
        {
          MonSERVICEPortType port = service.getmonSERVICEPort();
          dptrate = port.getRate(dpt);
          dstrate = port.getRate(dst);
        }
        catch (RemoteException e)
        {
          //e.printStackTrace();
        }
        catch (ServiceException el)
        {
          //el.printStackTrace();
        }
     
        double foreignamount = localamount * (dstrate/dptrate);
        return foreignamount;
      }
    }

  2. #2
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2010
    Messages
    16
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Suisse

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Finance

    Informations forums :
    Inscription : Avril 2010
    Messages : 16
    Par défaut
    Je précise encore le message d'erreur rencontré lorsque j'essaie d'afficher mon wsdl :

    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
    AXIS error
     
    Sorry, something seems to have gone wrong... here are the details:
     
    Fault - Error while compiling:  /var/lib/tomcat6/webapps/Projet_Webservice/WEB-INF/jwsClasses/WEBserviceP.java
     
    AxisFault
     faultCode: {http://xml.apache.org/axis/}Server.compileError
     faultSubcode: 
     faultString: Error while compiling:  /var/lib/tomcat6/webapps/Projet_Webservice/WEB-INF/jwsClasses/WEBserviceP.java
     faultActor: 
     faultNode: 
     faultDetail: 
    	{}Errors:Error compiling /var/lib/tomcat6/webapps/Projet_Webservice/WEB-INF/jwsClasses/WEBserviceP.java:
    Line 43, column -1:  cannot find symbol
    Line 44, column -1:  cannot find symbol
    Line 56, column -1:  cannot find symbol
    Line 56, column -1:  cannot find symbol
    Line 0, column 0: 
    4 errors

    J'en peux plus, j'ai essayé de mettre le chemin complet dans le import de maTargetNameSpace mais je tombe sur une autre erreur.

    Donc, ma déclaration:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    import .var.lib.tomcat6.webapps.Projet_Webservice.build.classes.maTargetNameSpace.*
    mais là il me donne cette erreur :

    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
     
    AXIS error
     
    Sorry, something seems to have gone wrong... here are the details:
     
    Fault - Error while compiling:  /var/lib/tomcat6/webapps/Projet_Webservice/WEB-INF/jwsClasses/WEBserviceP.java
     
    AxisFault
     faultCode: {http://xml.apache.org/axis/}Server.compileError
     faultSubcode: 
     faultString: Error while compiling:  /var/lib/tomcat6/webapps/Projet_Webservice/WEB-INF/jwsClasses/WEBserviceP.java
     faultActor: 
     faultNode: 
     faultDetail: 
    	{}Errors:Error compiling /var/lib/tomcat6/webapps/Projet_Webservice/WEB-INF/jwsClasses/WEBserviceP.java:
    Line 15, column 6:  <identifier> expected
    Line 0, column 0: 
    1 error
    Si vous avez une idée c'est volontiers que je suis preneur et si vous avez besoin d'autres informations n'hésitez pas à me demander.

    Merci pour votre aide

  3. #3
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2010
    Messages
    16
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Suisse

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Finance

    Informations forums :
    Inscription : Avril 2010
    Messages : 16
    Par défaut
    je mets également mes stubs (générés par le wsdl) si ça peut aider quelqu'un à m'aider.

    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
     
    /**
     * MonSERVICE.java
     *
     * This file was auto-generated from WSDL
     * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
     */
     
    package maTargetNameSpace;
     
    public interface MonSERVICE extends javax.xml.rpc.Service {
        public java.lang.String getmonSERVICEPortAddress();
     
        public maTargetNameSpace.MonSERVICEPortType getmonSERVICEPort() throws javax.xml.rpc.ServiceException;
     
        public maTargetNameSpace.MonSERVICEPortType getmonSERVICEPort(java.net.URL portAddress) throws javax.xml.rpc.ServiceException;
    }
    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
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
     
    /**
     * MonSERVICEBindingStub.java
     *
     * This file was auto-generated from WSDL
     * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
     */
     
    package maTargetNameSpace;
     
    public class MonSERVICEBindingStub extends org.apache.axis.client.Stub implements maTargetNameSpace.MonSERVICEPortType {
        private java.util.Vector cachedSerClasses = new java.util.Vector();
        private java.util.Vector cachedSerQNames = new java.util.Vector();
        private java.util.Vector cachedSerFactories = new java.util.Vector();
        private java.util.Vector cachedDeserFactories = new java.util.Vector();
     
        static org.apache.axis.description.OperationDesc [] _operations;
     
        static {
            _operations = new org.apache.axis.description.OperationDesc[4];
            _initOperationDesc1();
        }
     
        private static void _initOperationDesc1(){
            org.apache.axis.description.OperationDesc oper;
            org.apache.axis.description.ParameterDesc param;
            oper = new org.apache.axis.description.OperationDesc();
            oper.setName("getRate");
            param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "pays"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
            oper.addParameter(param);
            oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "double"));
            oper.setReturnClass(double.class);
            oper.setReturnQName(new javax.xml.namespace.QName("", "rate"));
            oper.setStyle(org.apache.axis.constants.Style.RPC);
            oper.setUse(org.apache.axis.constants.Use.ENCODED);
            _operations[0] = oper;
     
            oper = new org.apache.axis.description.OperationDesc();
            oper.setName("getCurrency");
            param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "pays"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
            oper.addParameter(param);
            oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
            oper.setReturnClass(java.lang.String.class);
            oper.setReturnQName(new javax.xml.namespace.QName("", "currency"));
            oper.setStyle(org.apache.axis.constants.Style.RPC);
            oper.setUse(org.apache.axis.constants.Use.ENCODED);
            _operations[1] = oper;
     
            oper = new org.apache.axis.description.OperationDesc();
            oper.setName("getNameDPT");
            param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "pays"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
            oper.addParameter(param);
            oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
            oper.setReturnClass(java.lang.String.class);
            oper.setReturnQName(new javax.xml.namespace.QName("", "namedpt"));
            oper.setStyle(org.apache.axis.constants.Style.RPC);
            oper.setUse(org.apache.axis.constants.Use.ENCODED);
            _operations[2] = oper;
     
            oper = new org.apache.axis.description.OperationDesc();
            oper.setName("getNameDST");
            param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "pays"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
            oper.addParameter(param);
            oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
            oper.setReturnClass(java.lang.String.class);
            oper.setReturnQName(new javax.xml.namespace.QName("", "namedst"));
            oper.setStyle(org.apache.axis.constants.Style.RPC);
            oper.setUse(org.apache.axis.constants.Use.ENCODED);
            _operations[3] = oper;
     
        }
     
        public MonSERVICEBindingStub() throws org.apache.axis.AxisFault {
             this(null);
        }
     
        public MonSERVICEBindingStub(java.net.URL endpointURL, javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
             this(service);
             super.cachedEndpoint = endpointURL;
        }
     
        public MonSERVICEBindingStub(javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
            if (service == null) {
                super.service = new org.apache.axis.client.Service();
            } else {
                super.service = service;
            }
            ((org.apache.axis.client.Service)super.service).setTypeMappingVersion("1.2");
        }
     
        protected org.apache.axis.client.Call createCall() throws java.rmi.RemoteException {
            try {
                org.apache.axis.client.Call _call = super._createCall();
                if (super.maintainSessionSet) {
                    _call.setMaintainSession(super.maintainSession);
                }
                if (super.cachedUsername != null) {
                    _call.setUsername(super.cachedUsername);
                }
                if (super.cachedPassword != null) {
                    _call.setPassword(super.cachedPassword);
                }
                if (super.cachedEndpoint != null) {
                    _call.setTargetEndpointAddress(super.cachedEndpoint);
                }
                if (super.cachedTimeout != null) {
                    _call.setTimeout(super.cachedTimeout);
                }
                if (super.cachedPortName != null) {
                    _call.setPortName(super.cachedPortName);
                }
                java.util.Enumeration keys = super.cachedProperties.keys();
                while (keys.hasMoreElements()) {
                    java.lang.String key = (java.lang.String) keys.nextElement();
                    _call.setProperty(key, super.cachedProperties.get(key));
                }
                return _call;
            }
            catch (java.lang.Throwable _t) {
                throw new org.apache.axis.AxisFault("Failure trying to get the Call object", _t);
            }
        }
     
        public double getRate(java.lang.String pays) throws java.rmi.RemoteException {
            if (super.cachedEndpoint == null) {
                throw new org.apache.axis.NoEndPointException();
            }
            org.apache.axis.client.Call _call = createCall();
            _call.setOperation(_operations[0]);
            _call.setUseSOAPAction(true);
            _call.setSOAPActionURI("http://localhost/WSPHP.php/getRate");
            _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
            _call.setOperationName(new javax.xml.namespace.QName("", "getRate"));
     
            setRequestHeaders(_call);
            setAttachments(_call);
     try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {pays});
     
            if (_resp instanceof java.rmi.RemoteException) {
                throw (java.rmi.RemoteException)_resp;
            }
            else {
                extractAttachments(_call);
                try {
                    return ((java.lang.Double) _resp).doubleValue();
                } catch (java.lang.Exception _exception) {
                    return ((java.lang.Double) org.apache.axis.utils.JavaUtils.convert(_resp, double.class)).doubleValue();
                }
            }
      } catch (org.apache.axis.AxisFault axisFaultException) {
      throw axisFaultException;
    }
        }
     
        public java.lang.String getCurrency(java.lang.String pays) throws java.rmi.RemoteException {
            if (super.cachedEndpoint == null) {
                throw new org.apache.axis.NoEndPointException();
            }
            org.apache.axis.client.Call _call = createCall();
            _call.setOperation(_operations[1]);
            _call.setUseSOAPAction(true);
            _call.setSOAPActionURI("http://localhost/WSPHP.php/getCurrency");
            _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
            _call.setOperationName(new javax.xml.namespace.QName("", "getCurrency"));
     
            setRequestHeaders(_call);
            setAttachments(_call);
     try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {pays});
     
            if (_resp instanceof java.rmi.RemoteException) {
                throw (java.rmi.RemoteException)_resp;
            }
            else {
                extractAttachments(_call);
                try {
                    return (java.lang.String) _resp;
                } catch (java.lang.Exception _exception) {
                    return (java.lang.String) org.apache.axis.utils.JavaUtils.convert(_resp, java.lang.String.class);
                }
            }
      } catch (org.apache.axis.AxisFault axisFaultException) {
      throw axisFaultException;
    }
        }
     
        public java.lang.String getNameDPT(java.lang.String pays) throws java.rmi.RemoteException {
            if (super.cachedEndpoint == null) {
                throw new org.apache.axis.NoEndPointException();
            }
            org.apache.axis.client.Call _call = createCall();
            _call.setOperation(_operations[2]);
            _call.setUseSOAPAction(true);
            _call.setSOAPActionURI("http://localhost/WSPHP.php/getNameDPT");
            _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
            _call.setOperationName(new javax.xml.namespace.QName("", "getNameDPT"));
     
            setRequestHeaders(_call);
            setAttachments(_call);
     try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {pays});
     
            if (_resp instanceof java.rmi.RemoteException) {
                throw (java.rmi.RemoteException)_resp;
            }
            else {
                extractAttachments(_call);
                try {
                    return (java.lang.String) _resp;
                } catch (java.lang.Exception _exception) {
                    return (java.lang.String) org.apache.axis.utils.JavaUtils.convert(_resp, java.lang.String.class);
                }
            }
      } catch (org.apache.axis.AxisFault axisFaultException) {
      throw axisFaultException;
    }
        }
     
        public java.lang.String getNameDST(java.lang.String pays) throws java.rmi.RemoteException {
            if (super.cachedEndpoint == null) {
                throw new org.apache.axis.NoEndPointException();
            }
            org.apache.axis.client.Call _call = createCall();
            _call.setOperation(_operations[3]);
            _call.setUseSOAPAction(true);
            _call.setSOAPActionURI("http://localhost/WSPHP.php/getNameDST");
            _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
            _call.setOperationName(new javax.xml.namespace.QName("", "getNameDST"));
     
            setRequestHeaders(_call);
            setAttachments(_call);
     try {        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {pays});
     
            if (_resp instanceof java.rmi.RemoteException) {
                throw (java.rmi.RemoteException)_resp;
            }
            else {
                extractAttachments(_call);
                try {
                    return (java.lang.String) _resp;
                } catch (java.lang.Exception _exception) {
                    return (java.lang.String) org.apache.axis.utils.JavaUtils.convert(_resp, java.lang.String.class);
                }
            }
      } catch (org.apache.axis.AxisFault axisFaultException) {
      throw axisFaultException;
    }
        }
     
    }

    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
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
     
    /**
     * MonSERVICELocator.java
     *
     * This file was auto-generated from WSDL
     * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
     */
     
    package maTargetNameSpace;
     
    public class MonSERVICELocator extends org.apache.axis.client.Service implements maTargetNameSpace.MonSERVICE {
     
        public MonSERVICELocator() {
        }
     
     
        public MonSERVICELocator(org.apache.axis.EngineConfiguration config) {
            super(config);
        }
     
        public MonSERVICELocator(java.lang.String wsdlLoc, javax.xml.namespace.QName sName) throws javax.xml.rpc.ServiceException {
            super(wsdlLoc, sName);
        }
     
        // Use to get a proxy class for monSERVICEPort
        private java.lang.String monSERVICEPort_address = "http://localhost/WSPHP.php";
     
        public java.lang.String getmonSERVICEPortAddress() {
            return monSERVICEPort_address;
        }
     
        // The WSDD service name defaults to the port name.
        private java.lang.String monSERVICEPortWSDDServiceName = "monSERVICEPort";
     
        public java.lang.String getmonSERVICEPortWSDDServiceName() {
            return monSERVICEPortWSDDServiceName;
        }
     
        public void setmonSERVICEPortWSDDServiceName(java.lang.String name) {
            monSERVICEPortWSDDServiceName = name;
        }
     
        public maTargetNameSpace.MonSERVICEPortType getmonSERVICEPort() throws javax.xml.rpc.ServiceException {
           java.net.URL endpoint;
            try {
                endpoint = new java.net.URL(monSERVICEPort_address);
            }
            catch (java.net.MalformedURLException e) {
                throw new javax.xml.rpc.ServiceException(e);
            }
            return getmonSERVICEPort(endpoint);
        }
     
        public maTargetNameSpace.MonSERVICEPortType getmonSERVICEPort(java.net.URL portAddress) throws javax.xml.rpc.ServiceException {
            try {
                maTargetNameSpace.MonSERVICEBindingStub _stub = new maTargetNameSpace.MonSERVICEBindingStub(portAddress, this);
                _stub.setPortName(getmonSERVICEPortWSDDServiceName());
                return _stub;
            }
            catch (org.apache.axis.AxisFault e) {
                return null;
            }
        }
     
        public void setmonSERVICEPortEndpointAddress(java.lang.String address) {
            monSERVICEPort_address = address;
        }
     
        /**
         * For the given interface, get the stub implementation.
         * If this service has no port for the given interface,
         * then ServiceException is thrown.
         */
        public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
            try {
                if (maTargetNameSpace.MonSERVICEPortType.class.isAssignableFrom(serviceEndpointInterface)) {
                    maTargetNameSpace.MonSERVICEBindingStub _stub = new maTargetNameSpace.MonSERVICEBindingStub(new java.net.URL(monSERVICEPort_address), this);
                    _stub.setPortName(getmonSERVICEPortWSDDServiceName());
                    return _stub;
                }
            }
            catch (java.lang.Throwable t) {
                throw new javax.xml.rpc.ServiceException(t);
            }
            throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
        }
     
        /**
         * For the given interface, get the stub implementation.
         * If this service has no port for the given interface,
         * then ServiceException is thrown.
         */
        public java.rmi.Remote getPort(javax.xml.namespace.QName portName, Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
            if (portName == null) {
                return getPort(serviceEndpointInterface);
            }
            java.lang.String inputPortName = portName.getLocalPart();
            if ("monSERVICEPort".equals(inputPortName)) {
                return getmonSERVICEPort();
            }
            else  {
                java.rmi.Remote _stub = getPort(serviceEndpointInterface);
                ((org.apache.axis.client.Stub) _stub).setPortName(portName);
                return _stub;
            }
        }
     
        public javax.xml.namespace.QName getServiceName() {
            return new javax.xml.namespace.QName("maTargetNameSpace", "monSERVICE");
        }
     
        private java.util.HashSet ports = null;
     
        public java.util.Iterator getPorts() {
            if (ports == null) {
                ports = new java.util.HashSet();
                ports.add(new javax.xml.namespace.QName("maTargetNameSpace", "monSERVICEPort"));
            }
            return ports.iterator();
        }
     
        /**
        * Set the endpoint address for the specified port name.
        */
        public void setEndpointAddress(java.lang.String portName, java.lang.String address) throws javax.xml.rpc.ServiceException {
     
    if ("monSERVICEPort".equals(portName)) {
                setmonSERVICEPortEndpointAddress(address);
            }
            else 
    { // Unknown Port Name
                throw new javax.xml.rpc.ServiceException(" Cannot set Endpoint Address for Unknown Port" + portName);
            }
        }
     
        /**
        * Set the endpoint address for the specified port name.
        */
        public void setEndpointAddress(javax.xml.namespace.QName portName, java.lang.String address) throws javax.xml.rpc.ServiceException {
            setEndpointAddress(portName.getLocalPart(), address);
        }
     
    }

    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
     
    /**
     * MonSERVICEPortType.java
     *
     * This file was auto-generated from WSDL
     * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
     */
     
    package maTargetNameSpace;
     
    public interface MonSERVICEPortType extends java.rmi.Remote {
        public double getRate(java.lang.String pays) throws java.rmi.RemoteException;
        public java.lang.String getCurrency(java.lang.String pays) throws java.rmi.RemoteException;
        public java.lang.String getNameDPT(java.lang.String pays) throws java.rmi.RemoteException;
        public java.lang.String getNameDST(java.lang.String pays) throws java.rmi.RemoteException;
    }

    Merci beaucoup

  4. #4
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2010
    Messages
    16
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Suisse

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Finance

    Informations forums :
    Inscription : Avril 2010
    Messages : 16
    Par défaut
    Excusez-moi pour le post, j'ai trouvé la réponse tout seul à mon problème.

    Ce n'était pas un souci de comment appeler un WS au moyen d'un autre WS mais simplement une erreur dans mon code java.

    En effet, dans la fonction

    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
     
    public static double convert(double localamount , String dpt, String dst)
      { 
        MonSERVICELocator service = new MonSERVICELocator();
        String rate=null;
        try
        {
          MonSERVICEPortType port = service.getmonSERVICEPort();
          dptrate = port.getRate(dpt);
          dstrate = port.getRate(dst);
        }
        catch (RemoteException e)
        {
          //e.printStackTrace();
        }
        catch (ServiceException el)
        {
          //el.printStackTrace();
        }
     
        double foreignamount = localamount * (dstrate/dptrate);
        return foreignamount;
      }
    les variables dptrate et dstrate ne sont pas déclarées, à la place je déclare un String rate qui n'a rien à voir et qui vient de ma fonction comme je l'avais faite au début.

    J'ai donc corrigé la fonction comme suit :

    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
     
      public static double convert(double tochange , String dpt, String dst)
      { 
        MonSERVICELocator service = new MonSERVICELocator();
        double dptrate = 0.0;
        double dstrate = 0.0;
     
        try
        {
          MonSERVICEPortType port = service.getmonSERVICEPort();
          dptrate = port.getRate(dpt);
          dstrate = port.getRate(dst);
        }
        catch (RemoteException e)
        {
          //e.printStackTrace();
        }
        catch (ServiceException el)
        {
          //el.printStackTrace();
        }
     
        double foreignamount = tochange * (dstrate/dptrate);
        return foreignamount;
      }
    et maintenant tout marche impeccable.

    Désolé encore d'avoir créer un sujet inutile

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Serveur java aussi simple que possible
    Par figogo dans le forum Servlets/JSP
    Réponses: 7
    Dernier message: 22/01/2012, 21h42
  2. Comportement différent IE8 localhost/serveur distant
    Par fabrice91 dans le forum Mise en page CSS
    Réponses: 8
    Dernier message: 28/09/2009, 13h29
  3. Mon prgram se comporte differement sur 2 serveurs
    Par rosedeepa123 dans le forum VB 6 et antérieur
    Réponses: 1
    Dernier message: 06/05/2008, 19h09
  4. [webservice] intégration de logiciel sur un serveur web
    Par nicor35 dans le forum Général Conception Web
    Réponses: 4
    Dernier message: 28/03/2007, 01h40

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