Bonjour,

Je suis en développement d'un ptit code juste pour tester un web service sur l'intranet de l'entreprise. C'est écrit en html/javascript sur mon c:\temp.

Si j'éxécute le script ci-dessous sur IE8, çà fonctionne. Avec Firefox ou sur chrome çà ne marche plus.

Pourquoi ?

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
 
<html>
<head>
    <title>SOAP JavaScript Client Test</title>
    <script type="text/javascript">
        // convert a text to an xml object
        function loadXMLString(txt) {                
            if (window.DOMParser) {                
                parser=new DOMParser();
                xmlDoc=parser.parseFromString(txt,"text/xml");
            }
            else { // code for IE                            
                xmlDoc=new ActiveXObject("Microsoft.XMLDOM");                
                xmlDoc.async=false;
                xmlDoc.loadXML(txt);
            }
            return xmlDoc;
        }
 
        function parsemyxml(piv_xml) {                    
            var xmlDoc=loadXMLString(piv_xml);            
 
            var n=xmlDoc.getElementsByTagName('ns0:node');
 
            for (i=0;i<n.length;i++) {
                document.write(n[i].getAttribute('IUID')); document.write(" ");
                document.write(n[i].getAttribute('nodeType')); document.write(" ");
                document.write(n[i].getAttribute('fitiName')); document.write(" ");
                document.write(n[i].getAttribute('valency')); document.write("<br>");
            } 
        }    
 
        function soap() {
            var xmlhttp = new XMLHttpRequest();
            var wsUrl = 'http://ifliaiaplv002:9004/WS/intfgetDataMDM-service.serviceagent/intfwsgetDataMDMEndpoint0';    
 
            xmlhttp.open('POST', wsUrl, true);
 
            // build SOAP request
            var sIUID=document.getElementById("html_input_iuid").value;            
            var soapRequest ='<?xml version="1.0" encoding="utf-8"?>' + '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:inp="http://www.tibco.com/schemas/POC/Resources/XSD/inParamNode.xsd"><soapenv:Header/><soapenv:Body><inp:input><inp:IUID>'+sIUID+'</inp:IUID></inp:input></soapenv:Body></soapenv:Envelope>';            
 
            xmlhttp.onreadystatechange = function () {
                if (xmlhttp.readyState == 4) {
                    if (xmlhttp.status == 200) {
 
                        //alert('done use firebug to see response');
                        // alert(xmlhttp.responseText);
                        if( xmlhttp.responseText ) {
                            parsemyxml(xmlhttp.responseText);
                        }
                    }
                }
            }
            // Send the POST request            
            xmlhttp.setRequestHeader("SOAPAction", "/WS/intfgetDataMDM-service.serviceagent//GetNodesOp");
            xmlhttp.setRequestHeader("Content-Type", "text/xml;charset=\"utf-8\"");
            xmlhttp.setRequestHeader("Style", "Document");
            xmlhttp.setRequestHeader("Type", "Request-Response");
 
            xmlhttp.send(soapRequest);
        }        
    </script>
</head>
 
<body>
    <form name="Demo" action="" method="post">
    Switch - external ref codes:
    <input id="html_input_iuid" type="text" value="1342"/><br>
        <div>
            <input type="button" value="Soap" onclick="soap();" /><br>
        </div>
    </form>
</body>
<html>
Lors de son exécution Firefox retourne l'erreur : 404 not found

De plus, si j’exécute le script avec firefox en mode tab IE, çà fonctionne.

A quoi est du le problème ?
Pourquoi firefox ne trouve pas le serveur : http://ifliaiaplv002:9004/ ?
Et pourquoi IE8 trouve sans problème mon serveur ?

Que faut-il faire pour que firefox et chrome accepte ce serveur ?

Je suis vraiment bloqué, pouvez-vous m'aider svp ?

Bien à vous.