Bonjour tout le monde,
Je commence à peine les webservices, et j'ai pu faire quelques petites choses pour le moment qui marchent.
Mais je suis confronté à un problème.
Une de mes classe (qui s'appelle Category) contient un array d'une autre classe (qui s'appelle CategoryInfo) déclaré comme "public CategoryInfo[] data";
Je pense donc que j'ai un problème lors de l'envoi de cet array. Mes autres webservices eux fonctionnent bien, mais aucun n'utilise d'array pour le moment.
Voici mon wsdl :
Voici maintenant l'erreur qui m'est renvoyée :
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 <deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"> <service name="SqlGenerator" provider="java:RPC"> <parameter name="className" value="webservices.sql.generator.SqlGenerator"/> <parameter name="allowedMethods" value="*"/> <beanMapping qname="myNS:Directory" xmlns:myNS="urn:SqlGenerator" languageSpecificType="java:objects.Directory"/> <beanMapping qname="myNS:Category" xmlns:myNS="urn:Category" languageSpecificType="java:objects.Category"/> <beanMapping qname="myNS:CategoryInfo" xmlns:myNS="urn:CategoryInfo" languageSpecificType="java:objects.CategoryInfo"/> <arrayMapping qname="ns:ArrayOfCategoryInfo" xmlns:ns="urn:CategoryInfo" languageSpecificType="java:objects.CategoryInfo[]" serializer="org.apache.axis.encoding.ser.ArraySerializerFactory" deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory" innerType="ns2:CategoryInfo" xmlns:ns2="urn:CategoryInfo" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </service> </deployment>
Et enfin, mon message soap :
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 error : AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException faultSubcode: faultString: org.xml.sax.SAXException: Invalid element in objects.Category - ownerId faultActor: faultNode: faultDetail: {http://xml.apache.org/axis/}hostname:laptop org.xml.sax.SAXException: Invalid element in objects.Category - ownerId at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222) at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129) at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source) at javax.xml.parsers.SAXParser.parse(Unknown Source) at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227) at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696) at org.apache.axis.Message.getSOAPEnvelope(Message.java:435) at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62) at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206) at org.apache.axis.client.Call.invokeEngine(Call.java:2784) at org.apache.axis.client.Call.invoke(Call.java:2767) at org.apache.axis.client.Call.invoke(Call.java:2443) at org.apache.axis.client.Call.invoke(Call.java:2366) at org.apache.axis.client.Call.invoke(Call.java:1812) at webservices.TestClient.testAddCategory(TestClient.java:262) at webservices.TestClient.main(TestClient.java:284)
J'ai remarqué dans le message SOAP qu'il ne créé pas de CategoryInfo[] mais des Category[].
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 <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <ns1:insert soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://webservices.sql.generator.SqlGenerator"> <arg1 href="#id0"/> </ns1:insert> <multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:Category" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="urn:Category"> <data soapenc:arrayType="ns2:Category[2]" xsi:type="soapenc:Array"> <data href="#id1"/> <data href="#id2"/> </data> <id href="#id3"/> <name xsi:type="soapenc:string">Musique2</name> <shared href="#id4"/> <userid href="#id5"/> </multiRef> <multiRef id="id4" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">0</multiRef> <multiRef id="id1" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns3:Category" xmlns:ns3="urn:Category" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"> <name xsi:type="soapenc:string">Nom</name> <ownerId href="#id6"/> <type xsi:type="soapenc:string">Text</type> <userid href="#id7"/> </multiRef> <multiRef id="id2" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns4:Category" xmlns:ns4="urn:Category" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"> <name xsi:type="soapenc:string">Value</name> <ownerId href="#id8"/> <type xsi:type="soapenc:string">Doc</type> <userid href="#id9"/> </multiRef> <multiRef id="id3" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">0</multiRef> <multiRef id="id5" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">3</multiRef> <multiRef id="id7" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">0</multiRef> <multiRef id="id6" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">0</multiRef> <multiRef id="id8" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">0</multiRef> <multiRef id="id9" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">0</multiRef> </soapenv:Body> </soapenv:Envelope>
Quelqu'un aurait il une idée svp ?
Merci d'avance![]()
Partager