Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/server/MetaDataServiceImpl.java @ 812:70b728a9f4e8
Meta data service: Create correct request document now.
flys-client/trunk@2468 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 08 Aug 2011 14:49:14 +0000 |
parents | 8fa303586f14 |
children | bd56dc762e7f |
comparison
equal
deleted
inserted
replaced
811:8fa303586f14 | 812:70b728a9f4e8 |
---|---|
34 String locale, | 34 String locale, |
35 String artifactId, | 35 String artifactId, |
36 String userId | 36 String userId |
37 ) throws ServerException | 37 ) throws ServerException |
38 { | 38 { |
39 System.out.println("MetaDataService.getDistanceInfo"); | 39 System.out.println("MetaDataService.getMetaData"); |
40 | 40 |
41 Document doc = XMLUtils.newDocument(); | 41 Document doc = XMLUtils.newDocument(); |
42 | 42 |
43 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( | 43 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( |
44 doc, | 44 doc, |
45 ArtifactNamespaceContext.NAMESPACE_URI, | 45 ArtifactNamespaceContext.NAMESPACE_URI, |
46 ArtifactNamespaceContext.NAMESPACE_PREFIX); | 46 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
47 | 47 |
48 Element meta = ec.create("meta"); | |
48 | 49 |
49 if (artifactId != null) { | 50 if (artifactId != null) { |
50 Element artifactEl = ec.create("artifact-id"); | 51 Element artifactEl = ec.create("artifact-id"); |
51 artifactEl.setAttribute("value", artifactId); | 52 artifactEl.setAttribute("value", artifactId); |
52 doc.appendChild(artifactEl); | 53 meta.appendChild(artifactEl); |
53 } | 54 } |
54 | 55 |
55 if (userId != null) { | 56 if (userId != null) { |
56 Element userEl = ec.create("user-id"); | 57 Element userEl = ec.create("user-id"); |
57 userEl.setAttribute("value", userId); | 58 userEl.setAttribute("value", userId); |
58 doc.appendChild(userEl); | 59 meta.appendChild(userEl); |
59 } | 60 } |
61 | |
62 doc.appendChild(meta); | |
60 | 63 |
61 HttpClient client = new HttpClientImpl(url, locale); | 64 HttpClient client = new HttpClientImpl(url, locale); |
62 | 65 |
63 try { | 66 try { |
64 Converter converter = new Converter(); | 67 Converter converter = new Converter(); |
65 return converter.convert(client.callService(url, "metadata", doc)); | 68 return converter.convert(client.callService(url, "metadata", doc)); |
66 } | 69 } |
67 catch (ConnectionException ce) { | 70 catch (ConnectionException ce) { |
68 System.err.println(ce.getLocalizedMessage()); | 71 ce.printStackTrace(); |
69 } | 72 } |
70 | 73 |
71 throw new ServerException(ERROR_NO_META_DATA_FOUND); | 74 throw new ServerException(ERROR_NO_META_DATA_FOUND); |
72 } | 75 } |
73 } | 76 } |