Changes for page SOAP-based Service

Last modified by uru on 2023/07/11 10:33

From version 2.1
edited by uru
on 2013/11/27 01:42
Change comment: There is no comment for this version
To version 3.1
edited by uru
on 2013/11/27 01:59
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,0 +1,67 @@
1 +One of the goals of KWebS is to provide the KIELER layout to a broader range of users by hiding its java nature behind a web service. As the server uses a SOAP web service, it describes the user interface in a platform independent way using the Web Service Description Language (WSDL). You can use this contract to automatically generate the code necessary to access the operations provided by KWebS. For example, if you have a java based project, you can use the tool wsimport:
2 +
3 +(% style="margin-left: 30.0px;" %)
4 +(% class="nolink" %)[[http:~~/~~/layout.rtsys.informatik.uni-kiel.de:9442/layout?wsdl>>url:http://layout.rtsys.informatik.uni-kiel.de:9442/layout?wsdl||shape="rect"]]{{code language="none"}}wsimport -p my.kwebs.client -keep {{/code}}
5 +
6 +Normally, {{code language="none"}}wsimport{{/code}} will derive the package where it puts the generated classes into from the XML name space declared in the contract, but this will in general not fit to your needs. You can declare a different package with the **-p** option, in the given example the classes will be generated to the package {{code language="none"}}my.kwebs.client{{/code}}. The {{code language="none"}}-keep{{/code}} option tells {{code language="none"}}wsimport{{/code}} not to delete the generated java sources after it has compiled them to class files. As a last option, {{code language="none"}}wsimport{{/code}} requires the contract from which it shall generate the code. This may be a file on your local computer, or as an alternative, {{code language="none"}}wsimport{{/code}} can download it from the internet. The public demo service of KWebS is located at **[[http:~~/~~/layout.rtsys.informatik.uni-kiel.de:9442/layout>>url:http://layout.rtsys.informatik.uni-kiel.de:9442/layout||shape="rect"]]**, and you can access its contract by adding {{code language="none"}}?wsdl{{/code}} to this location.
7 +
8 +After code generation, you have a bunch of java source and class files. They contain the code necessary for invoking the service-based layout. The most important classes are {{code language="none"}}LayoutService{{/code}} and {{code language="none"}}LayoutServicePort{{/code}}. You need them to create a //proxy// to the service:
9 +
10 +{{code theme="Eclipse" language="java"}}
11 +package my.kwebs.client;
12 +
13 +import java.net.URL;
14 +import javax.xml.namespace.QName;
15 +
16 +public class KWebSClient {
17 +
18 + // The endpoint address the service is bound to
19 + private static final String SERVICE_URL
20 + = "http://layout.rtsys.informatik.uni-kiel.de:9442/layout";
21 +
22 + // The qualified name of the service interface
23 + private static final String SERVICE_QNAME
24 + = "http://layout.rtsys.informatik.uni-kiel.de/layout";
25 +
26 + // The name of the service
27 + private static final String SERVICE_NAME
28 + = "LayoutService";
29 +
30 + /**
31 + * Entry point of the client application
32 + */
33 + public static void main(final String args[]) {
34 +
35 + try {
36 +
37 + // Connect to the service
38 + LayoutService layoutService = new LayoutService(
39 + new URL(SERVICE_URL + "?wsdl"),
40 + new QName(SERVICE_QNAME, SERVICE_NAME)
41 + );
42 +
43 + // Create a proxy to access its operations
44 + LayoutServicePort layoutServicePort = layoutService.getLayoutServicePort();
45 +
46 + // Create the serial notation of the source graph
47 + String graph = ...
48 +
49 + // Call the "graphLayout" operation of the service. As result you get the
50 + // serial notation of the layouted graph in the same serial notation as
51 + // you used for invoking the layout.
52 + String layout = layoutServicePort.graphLayout(
53 + graph, // the source model
54 + "de.cau.cs.kieler.kgraph", // we use the KGraph format
55 + null, // we want the result in KGraph format
56 + null // we don't declare any options
57 + );
58 +
59 + // Handle exceptions here
60 + } catch (final Exception e) {
61 + e.printStackTrace();
62 + }
63 +
64 + }
65 +
66 +}
67 +{{/code}}
Confluence.Code.ConfluencePageClass[0]
Id
... ... @@ -1,1 +1,1 @@
1 -8651288
1 +8651290
URL
... ... @@ -1,1 +1,1 @@
1 -https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/KIELER/pages/8651288/SOAP-based Service
1 +https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/KIELER/pages/8651290/SOAP-based Service