Bonjour, voilà je suis pas un pro du Java et un gros débutant dans Axis SOAP et cie...
Voilà, j'ai installé un gros logiciel de gestion de licence pour ma boîte (FLEXnet Operations Module 8.2 par Macrovision), c'est une application webbased en java avec une BD oracle.
En bref cette application a pour but de générer des fichiers de licences pour la protection des logiciels de ma boîte, pour celà cette application gère des produits (les soft de ma boites), des entitlements (les commandes de softs des clients) et bien-sûr les fichiers de licences (activation/génération).
On peut utiliser l'appli directement via l'UI, ou lui fournir les informations qu'elle veut (issu d'un quelconque ERP) par le principe des Services Web.
Pour celà, elle fournit quasiment tous les outils et utilise Axis. Il ne me reste plus qu'a créer les .java lui donnant les infos, en plus de celà, l'appli est fournie avec tout un tas de programmes exemples.
Je suis donc parti la-dessus, avec le plus simple la création d'une feature (brique de base d'un soft dans l'appli).
Dans le principe, de ce que j'en ai compris, le .java créé un .xml, le service web le lit, l'intègre à la BD et envoi une réponse en xml, et là j'ai une erreure sur la réponse.
voici le java :
_________________________________________________________________
_________________________________________________________________
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 import com.macrovision.flexnet.operations.webservices.ClientSecurityCredentials; import com.macrovision.flexnet.operations.webservices.CreateFeatureRequestType; import com.macrovision.flexnet.operations.webservices.CreateFeatureResponseType; import com.macrovision.flexnet.operations.webservices.CreatedFeatureDataListType; import com.macrovision.flexnet.operations.webservices.CreatedFeatureDataType; import com.macrovision.flexnet.operations.webservices.FailedFeatureDataListType; import com.macrovision.flexnet.operations.webservices.FailedFeatureDataType; import com.macrovision.flexnet.operations.webservices.FeatureDataType; import com.macrovision.flexnet.operations.webservices.ProductPackagingServiceInterface; import com.macrovision.flexnet.operations.webservices.ProductPackagingServiceLocator; import com.macrovision.flexnet.operations.webservices.StatusType; import com.macrovision.flexnet.operations.webservices.VersionFormatType; public class CreateFeatureTest { public static void main(String[] args) { // Service end point where webservice is running String serviceEndPoint = "http://localhost:8888/flexnet/services/ProductPackagingService"; ProductPackagingServiceInterface service = null; // Instantiate locator ProductPackagingServiceLocator locator = new ProductPackagingServiceLocator(); try { // Get the handle to EntitlementService service = locator.getProductPackagingService(new java.net.URL(serviceEndPoint)); CreateFeatureRequestType request = new CreateFeatureRequestType(); FeatureDataType fType = new FeatureDataType(); fType.setFeatureName("FeatTestInterface1"); fType.setVersion("1.0"); fType.setDescription("Feature de Test pour Interfaces via WebService"); fType.setVersionFormat(VersionFormatType.FIXED); FeatureDataType fType1 = new FeatureDataType(); fType1.setFeatureName("FeatTestInterface2"); fType1.setVersion("2.0"); fType1.setDescription("Feature de Test pour Interfaces via WebService"); fType1.setVersionFormat(VersionFormatType.FIXED); FeatureDataType[] fArray = new FeatureDataType[2]; fArray[0] = fType; fArray[1] = fType1; request.setFeature(fArray); ClientSecurityCredentials credentials = new ClientSecurityCredentials(service); credentials.setUsername("admin"); credentials.setPassword("admin"); //System.out.println("test"); CreateFeatureResponseType response = service.createFeature(request); System.out.println("erreur->" + response.getStatusInfo().getStatus().toString()); // Check the status in the response if (response.getStatusInfo().getStatus().toString().equals(StatusType.SUCCESS.toString())) { System.out.println("Features Created successfully "); CreatedFeatureDataListType fListType = response.getResponseData(); CreatedFeatureDataType[] features = fListType.getCreatedFeature(); for(int x=0; x< features.length ; x++) { String referenceRecord = features[x].getRecordRefNo(); String uniqueId = features[x].getUniqueId(); System.out.println("Record Reference ->" + referenceRecord + " UniqueId of Created Feature ->" + uniqueId); } }else { System.out.println("Update line item failed"); System.out.println("Reason for Failure -> " + response.getStatusInfo().getReason()); FailedFeatureDataListType failedData = response.getFailedData(); FailedFeatureDataType[] failedArray = failedData.getFailedFeature(); for (int ii = 0; failedArray != null && ii < failedArray.length; ii++) System.out.println("Create Feature failed due to reason :" + failedArray[ii].getReason()); } } catch(Exception e) { e.printStackTrace(); } } }
et l'erreur que me renvoi Axis dans la console:
_________________________________________________________________
_________________________________________________________________
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 AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException faultSubcode: faultString: java.lang.NullPointerException faultActor: faultNode: faultDetail: {http://xml.apache.org/axis/}stackTrace: java.lang.NullPointerException at java.util.Hashtable.put(Unknown Source) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.setProperty(Unknown Source) at org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:246) at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:538) at org.apache.axis.Message.getSOAPEnvelope(Message.java:376) at org.apache.axis.client.Call.invokeEngine(Call.java:2583) at org.apache.axis.client.Call.invoke(Call.java:2553) at org.apache.axis.client.Call.invoke(Call.java:2248) at org.apache.axis.client.Call.invoke(Call.java:2171) at org.apache.axis.client.Call.invoke(Call.java:1691) at com.macrovision.flexnet.operations.webservices.ProductPackagingServiceBindingStub.createFeature(ProductPackagingServiceBindingStub.java:2296) at CreateFeatureTest.main(CreateFeatureTest.java:54) java.lang.NullPointerException at org.apache.axis.AxisFault.makeFault(AxisFault.java:129) at org.apache.axis.client.Call.invoke(Call.java:2251) at org.apache.axis.client.Call.invoke(Call.java:2171) at org.apache.axis.client.Call.invoke(Call.java:1691) at com.macrovision.flexnet.operations.webservices.ProductPackagingServiceBindingStub.createFeature(ProductPackagingServiceBindingStub.java:2296) at CreateFeatureTest.main(CreateFeatureTest.java:54) Caused by: java.lang.NullPointerException at java.util.Hashtable.put(Unknown Source) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.setProperty(Unknown Source) at org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:246) at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:538) at org.apache.axis.Message.getSOAPEnvelope(Message.java:376) at org.apache.axis.client.Call.invokeEngine(Call.java:2583) at org.apache.axis.client.Call.invoke(Call.java:2553) at org.apache.axis.client.Call.invoke(Call.java:2248) ... 4 more
En rouge gras la ligne qui créé l'erreur, en effet, le programme s'arrête à cet endroit là et me donne ce joli message incompréhensible pour mes pauvres connaissances....
Le programme marche presque puisque les features sont bien créées dans l'appli, le bug vient juste quand le java demande la réponse du service web!
celà parle-t-il a quelqu'un?
Partager