Bonjour,

J'essaye vainement d'appeler un WebService depuis une application Java sans succès.

J'obtient l'erreur suivante au moment de la creation du service :
Error processing WSDL document: \njavax.xml.rpc.ServiceException: Cannot find service: {http://www.openuri.org/}BouchonWs
J'ai essaye sans le "http://www.openuri.org/" dans l'appel (en mettant "") sans plus de succès.

Merci d'avance.

Voici le code de mon appel :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
    try {  
      String urlWSDL = "http://127.0.0.1:9100/path/BouchonWs.wsdl";
      Service  service = new Service(urlWSDL, new QName("http://www.openuri.org/", "BouchonWs"));      
 
      QName portname = new QName("http://www.openuri.org/","BouchonWsSoap");
      QName operation = new QName("http://www.w3.org/2001/XMLSchema","getTest");
      Call     call    = (Call) service.createCall(portname, operation);
 
      String ret = (String) call.invoke( new Object[] {"test" } );
 
      System.out.println("Sent 'Hello!', got '" + ret + "'");
    } catch (Exception e) {
       System.err.println(e.toString());
    }
Et voici le 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
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
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:conv="http://www.openuri.org/2002/04/soap/conversation/" xmlns:cw="http://www.openuri.org/2002/04/wsdl/conversation/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:jms="http://www.openuri.org/2002/04/wsdl/jms/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s0="http://www.openuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" targetNamespace="http://www.openuri.org/">
  <types>
    <s:schema elementFormDefault="qualified" targetNamespace="http://www.openuri.org/" xmlns:s="http://www.w3.org/2001/XMLSchema">
      <s:element name="getTest">
        <s:complexType>
          <s:sequence>
            <s:element name="strEntry" type="s:string" minOccurs="0"/>
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="getTestResponse">
        <s:complexType>
          <s:sequence>
            <s:element name="getTestResult" type="s:string" minOccurs="0"/>
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="string" nillable="true" type="s:string"/>
    </s:schema>
 
  </types>
  <message name="getTestSoapIn">
    <part name="parameters" element="s0:getTest"/>
  </message>
  <message name="getTestSoapOut">
    <part name="parameters" element="s0:getTestResponse"/>
  </message>
  <message name="getTestHttpGetIn">
    <part name="strEntry" type="s:string"/>
  </message>
  <message name="getTestHttpGetOut">
    <part name="Body" element="s0:string"/>
  </message>
  <message name="getTestHttpPostIn">
    <part name="strEntry" type="s:string"/>
  </message>
  <message name="getTestHttpPostOut">
    <part name="Body" element="s0:string"/>
  </message>
  <portType name="BouchonWsSoap">
    <operation name="getTest">
      <input message="s0:getTestSoapIn"/>
      <output message="s0:getTestSoapOut"/>
    </operation>
  </portType>
  <portType name="BouchonWsHttpGet">
    <operation name="getTest">
      <input message="s0:getTestHttpGetIn"/>
      <output message="s0:getTestHttpGetOut"/>
    </operation>
  </portType>
  <portType name="BouchonWsHttpPost">
    <operation name="getTest">
      <input message="s0:getTestHttpPostIn"/>
      <output message="s0:getTestHttpPostOut"/>
    </operation>
  </portType>
  <binding name="BouchonWsSoap" type="s0:BouchonWsSoap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
    <operation name="getTest">
      <soap:operation soapAction="http://www.openuri.org/getTest" style="document"/>
      <input>
        <soap:body use="literal"/>
      </input>
      <output>
        <soap:body use="literal"/>
      </output>
    </operation>
  </binding>
  <binding name="BouchonWsHttpGet" type="s0:BouchonWsHttpGet">
    <http:binding verb="GET"/>
    <operation name="getTest">
      <http:operation location="/getTest"/>
      <input>
        <http:urlEncoded/>
      </input>
      <output>
        <mime:mimeXml part="Body"/>
      </output>
    </operation>
  </binding>
  <binding name="BouchonWsHttpPost" type="s0:BouchonWsHttpPost">
    <http:binding verb="POST"/>
    <operation name="getTest">
      <http:operation location="/getTest"/>
      <input>
        <mime:content type="application/x-www-form-urlencoded"/>
      </input>
      <output>
        <mime:mimeXml part="Body"/>
      </output>
    </operation>
  </binding>
  <service name="BouchonWs">
    <port name="BouchonWsSoap" binding="s0:BouchonWsSoap">
      <soap:address location="http://localhost:9100/WSBOUCHON/webServices/BouchonWs.jws"/>
    </port>
    <port name="BouchonWsHttpGet" binding="s0:BouchonWsHttpGet">
      <http:address location="http://localhost:9100/WSBOUCHON/webServices/BouchonWs.jws"/>
    </port>
    <port name="BouchonWsHttpPost" binding="s0:BouchonWsHttpPost">
      <http:address location="http://localhost:9100/WSBOUCHON/webServices/BouchonWs.jws"/>
    </port>
  </service>
</definitions>