|
C:\uddi\inspireit\uddi\examples\UDDISerializerExample.java
|
1 package inspireit.uddi.examples;
2
3 import inspireit.uddi.*;
4 import inspireit.uddi.io.serialize.*;
5 import inspireit.uddi.base.*;
6
7 /**
8 * This example shows how to serialize any UDDI element according to the
9 * UDDI V3, V2 or V1 specification. For a more complex example of use of the
10 * serialization feature of the library, read also the UDDIV2toV3Example
11 * example.
12 *
13 * @author Bertrand Fontaine, <a href="http://www.inspireit.biz" target="INSPIREIT">INSPIRE IT</a>
14 */
15 public class UDDISerializerExample {
16
17 public UDDISerializerExample() throws Exception {
18 // create some sample business entity information
19 EMail email = new EMail("bertrand.fontaine@inspireit.biz");
20
21 Contact contact = new Contact("Bertrand Fontaine");
22 contact.addEMail(email);
23
24 BusinessEntity businessEntity = new BusinessEntity(new Name("INSPIRE IT"));
25 businessEntity.addContact(contact);
26
27 // create an UDDI V3.0 serializer
28 UDDISerializer serializer = UDDISerializer.createSerializer(UDDIConstants.UDDI_V3);
29
30 // serialize the businessEntity to the standard output
31 System.out.println("Serialized businessEntity:");
32 serializer.serialize(businessEntity, System.out);
33 System.out.println();
34 System.out.println();
35
36 // or any other UDDI element
37 System.out.println("Serialized contact:");
38 serializer.serialize(contact, System.out);
39 System.out.println();
40 System.out.println();
41
42 System.out.println("Serialized E-mail:");
43 serializer.serialize(email, System.out);
44 }
45
46 public static void main(String args[]) throws Exception {
47 new UDDISerializerExample();
48 return;
49 }
50
51
52
53 }
54