Bonsoir à tous,

je sèche depuis un petit moment sur un problème récurent au niveau de la consommation de mon WS. La méthode que j'ai suivie pour l'implémenter :
- Définition d'une classe JAVA de service

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
 
    public Long getPages();
    public Item[] getItems(Long page);
- Génération du WEB Service associé avec axis, le tout sous netbeans

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
 
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:axis2="http://impl/services/conception/edu/" xmlns:ns1="http://impl/services/conception/edu/xsd" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:ns0="http://domain.conception.edu/xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://impl/services/conception/edu/">
    <wsdl:types>
        <xs:schema xmlns:ax21="http://domain.conception.edu/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://domain.conception.edu/xsd">
            <xs:complexType name="Item">
                <xs:sequence>
                    <xs:element maxOccurs="unbounded" minOccurs="0" name="features" nillable="true" type="xs:string"/>
                    <xs:element minOccurs="0" name="id" nillable="true" type="xs:string"/>
                    <xs:element minOccurs="0" name="image" nillable="true" type="xs:string"/>
                    <xs:element minOccurs="0" name="price" nillable="true" type="xs:string"/>
                    <xs:element minOccurs="0" name="salesRank" type="xs:float"/>
                    <xs:element minOccurs="0" name="stock" type="xs:int"/>
                    <xs:element minOccurs="0" name="title" nillable="true" type="xs:string"/>
                </xs:sequence>
            </xs:complexType>
        </xs:schema>
        <xs:schema xmlns:ns="http://impl/services/conception/edu/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://impl/services/conception/edu/xsd">
            <xs:element name="getItems">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element minOccurs="0" name="page" type="xs:long"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="getItemsResponse">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ns0:Item"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="getPagesResponse">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element minOccurs="0" name="return" type="xs:long"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:schema>
    </wsdl:types>
    <wsdl:message name="getPagesRequest"/>
    <wsdl:message name="getPagesResponse">
        <wsdl:part name="parameters" element="ns1:getPagesResponse"/>
    </wsdl:message>
    <wsdl:message name="getItemsRequest">
        <wsdl:part name="parameters" element="ns1:getItems"/>
    </wsdl:message>
    <wsdl:message name="getItemsResponse">
        <wsdl:part name="parameters" element="ns1:getItemsResponse"/>
    </wsdl:message>
    <wsdl:portType name="ItemFacadeImplPortType">
        <wsdl:operation name="getPages">
            <wsdl:input message="axis2:getPagesRequest" wsaw:Action="urn:getPages"/>
            <wsdl:output message="axis2:getPagesResponse" wsaw:Action="urn:getPagesResponse"/>
        </wsdl:operation>
        <wsdl:operation name="getItems">
            <wsdl:input message="axis2:getItemsRequest" wsaw:Action="urn:getItems"/>
            <wsdl:output message="axis2:getItemsResponse" wsaw:Action="urn:getItemsResponse"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="ItemFacadeImplSOAP11Binding" type="axis2:ItemFacadeImplPortType">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
        <wsdl:operation name="getPages">
            <soap:operation soapAction="urn:getPages" style="document"/>
            <wsdl:input>
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="getItems">
            <soap:operation soapAction="urn:getItems" style="document"/>
            <wsdl:input>
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:binding name="ItemFacadeImplSOAP12Binding" type="axis2:ItemFacadeImplPortType">
        <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
        <wsdl:operation name="getPages">
            <soap12:operation soapAction="urn:getPages" style="document"/>
            <wsdl:input>
                <soap12:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap12:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="getItems">
            <soap12:operation soapAction="urn:getItems" style="document"/>
            <wsdl:input>
                <soap12:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap12:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:binding name="ItemFacadeImplHttpBinding" type="axis2:ItemFacadeImplPortType">
        <http:binding verb="POST"/>
        <wsdl:operation name="getPages">
            <http:operation location="ItemFacadeImpl/getPages"/>
            <wsdl:input>
                <mime:content type="text/xml" part="getPages"/>
            </wsdl:input>
            <wsdl:output>
                <mime:content type="text/xml" part="getPages"/>
            </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="getItems">
            <http:operation location="ItemFacadeImpl/getItems"/>
            <wsdl:input>
                <mime:content type="text/xml" part="getItems"/>
            </wsdl:input>
            <wsdl:output>
                <mime:content type="text/xml" part="getItems"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="ItemFacadeImpl">
        <wsdl:port name="ItemFacadeImplSOAP11port_http" binding="axis2:ItemFacadeImplSOAP11Binding">
            <soap:address location="http://localhost:8080/axis2/services/ItemFacadeImpl"/>
        </wsdl:port>
        <wsdl:port name="ItemFacadeImplSOAP12port_http" binding="axis2:ItemFacadeImplSOAP12Binding">
            <soap12:address location="http://localhost:8080/axis2/services/ItemFacadeImpl"/>
        </wsdl:port>
        <wsdl:port name="ItemFacadeImplHttpport" binding="axis2:ItemFacadeImplHttpBinding">
            <http:address location="http://localhost:8080/axis2/services/ItemFacadeImpl"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>
J'ai écris un petit client qui appel les méthodes. Aucun problème tant que je n'utilise pas de paramètre : getItems(Long page) déclenche un exception parce que le paramètre est toujours null !

Que ce soit mon client ou l'outil de test du webservice de netbeans, Axis génère toujours 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
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
 
[ERROR] Exception occurred while trying to invoke service method getItems
java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:194)
	at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:102)
	at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
	at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:114)
	at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:173)
	at org.apache.axis2.transport.http.util.RESTUtil.invokeAxisEngine(RESTUtil.java:135)
	at org.apache.axis2.transport.http.util.RESTUtil.processURLRequest(RESTUtil.java:130)
	at org.apache.axis2.transport.http.HTTPWorker.service(HTTPWorker.java:245)
	at org.apache.axis2.transport.http.server.AxisHttpService.doService(AxisHttpService.java:281)
	at org.apache.axis2.transport.http.server.AxisHttpService.handleRequest(AxisHttpService.java:187)
	at org.apache.axis2.transport.http.server.HttpServiceProcessor.run(HttpServiceProcessor.java:82)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.RuntimeException
	at edu.conception.services.impl.ItemFacadeImpl.getItems(ItemFacadeImpl.java:102)
	... 18 more
Caused by: java.lang.NullPointerException
	at edu.conception.services.impl.ItemFacadeImpl.getItems(ItemFacadeImpl.java:65)
	... 18 more
[ERROR] Exception occurred while trying to invoke service method getItems
org.apache.axis2.AxisFault: Exception occurred while trying to invoke service method getItems
	at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:158)
	at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
	at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:114)
	at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:173)
	at org.apache.axis2.transport.http.util.RESTUtil.invokeAxisEngine(RESTUtil.java:135)
	at org.apache.axis2.transport.http.util.RESTUtil.processURLRequest(RESTUtil.java:130)
	at org.apache.axis2.transport.http.HTTPWorker.service(HTTPWorker.java:245)
	at org.apache.axis2.transport.http.server.AxisHttpService.doService(AxisHttpService.java:281)
	at org.apache.axis2.transport.http.server.AxisHttpService.handleRequest(AxisHttpService.java:187)
	at org.apache.axis2.transport.http.server.HttpServiceProcessor.run(HttpServiceProcessor.java:82)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:194)
	at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:102)
	... 12 more
Caused by: java.lang.RuntimeException
	at edu.conception.services.impl.ItemFacadeImpl.getItems(ItemFacadeImpl.java:102)
	... 18 more
Caused by: java.lang.NullPointerException
	at edu.conception.services.impl.ItemFacadeImpl.getItems(ItemFacadeImpl.java:65)
	... 18 more
Si quelqu'un pouvait éclairer ma lenterne...