C:\uddi\inspireit\uddi\examples\UDDIV2toV3Example.java

1    package inspireit.uddi.examples; 
2     
3    import java.net.*; 
4     
5    import inspireit.uddi.base.*; 
6    import inspireit.uddi.response.*; 
7    import inspireit.uddi.request.*; 
8    import inspireit.uddi.io.serialize.*; 
9     
10   /** 
11    * This example shows how some UDDI V2 information collected from an UDDI 
12    * registry call can be turned into UDDI V3-compliant format. For a more 
13    * basic example of use of the serialization feature of the library, read the 
14    * UDDISerializerExample example. In order to better understand how key 
15    * manipulation works, read also the UDDIKeyExample example. It is recommended 
16    * to have a look at the FindBusinessExample example before running this 
17    * example. 
18    * 
19    * @author Bertrand Fontaine, INSPIRE IT 
20    */ 
21   public class UDDIV2toV3Example { 
22    
23       public UDDIV2toV3Example(String queryURL) throws Exception { 
24           // query an UDDI V2-compliant UDDI registry for a business entity starting with "I" 
25           UDDIProfile profile = new UDDIProfile(); 
26           profile.setQueryURL(new URL(queryURL)); 
27           profile.setVersion(UDDIConstants.UDDI_V2); 
28    
29           UDDIQuerier querier = UDDIQuerier.getQuerier(profile); 
30           BusinessList businessList = querier.findBusiness(new Name("I%"), null, 1); 
31    
32           // create an UDDI V2 serializer and output the XML representation on the standard output 
33           UDDISerializer v2Serializer = UDDISerializer.createSerializer(UDDIConstants.UDDI_V2); 
34           System.out.println("UDDI V2 representation of the businessList:"); 
35           v2Serializer.serialize(businessList, System.out); 
36           System.out.println(); 
37           System.out.println(); 
38    
39           // create an UDDI V3 serializer and output the XML representation on the standard output 
40           UDDISerializer v3Serializer = UDDISerializer.createSerializer(UDDIConstants.UDDI_V3); 
41           System.out.println("UDDI V3 representation of the businessList:"); 
42           v3Serializer.serialize(businessList, System.out); 
43       } 
44    
45       public static void main(String args[]) throws Exception { 
46           if (args.length != 1) { 
47               System.out.println("UDDIV2toV3Example usage: java UDDIV2toV3Example <queryURL>"); 
48               System.exit(0); 
49           } 
50    
51           new UDDIV2toV3Example(args[0]); 
52           return; 
53       } 
54   } 
55