Skip to main content

A new approach to UDDI and WSDL, Part 5

Query from Java using the new OASIS UDDI WSDL Technical Note

Return to article


Listing 16. The queryBindingTemplates method
private static void queryBindingTemplates(Query query)
        throws TransportException, UDDIException {
    String manufacturerPortTypeTModelKey = null;

    // First we need the key of the ManufacturerPortType tModel

    TModelList tModelList = query.query_portType_tModel(
        "http://www.ws-i.org/SampleApplications/SupplyChainManagement/2002-10/Manufacturer.wsdl",
        "ManufacturerPortType");
    TModelInfos tModelInfos = tModelList.getTModelInfos();
    	Vector v = tModelInfos.getTModelInfoVector();
    TModelInfo tModelInfo = (TModelInfo) (v.elementAt(0));
    manufacturerPortTypeTModelKey = tModelInfo.getTModelKey();

    System.out.println("\nQuerying the implementations of the ManufacturerPortType portType tModel (example of 
query described in section 3.3.3 of the TN...)\n");

    BindingDetail bindingDetail = query.query_bindingTemplate(manufacturerPortTypeTModelKey);
    v = bindingDetail.getBindingTemplateVector();
    int size = v.size();
    for (int i = 0; i < size; i++) {
        BindingTemplate bindingTemplate = (BindingTemplate) (v.elementAt(i));
        String bindingKey = bindingTemplate.getBindingKey();
        System.out.println("bindingKey is " + bindingKey);
    }

    System.out.println("\nQuerying the implementations of the binding tModel for the ManufacturerPortType portType tModel (example of 
query described in section 3.3.4 of the TN...)\n");

    // Now we need the key of the binding tModel tModel
    
    String manufacturerBindingTModelKey = null;

    CategoryBag categoryBag = new CategoryBag();
    KeyedReference wsiKeyedReference = new KeyedReference(
        "ws-I_conformance:BasicProfile1.0",
        "http://ws-i.org/profiles/basic/1.0",
        "uuid:65719168-72c6-3f29-8c20-62defb0961c0");
    categoryBag.add(wsiKeyedReference);
    TModelList bindingTModelList = query.query_binding_tModel(manufacturerPortTypeTModelKey, categoryBag);
    tModelInfos = bindingTModelList.getTModelInfos();
    v = tModelInfos.getTModelInfoVector();
    tModelInfo = (TModelInfo) (v.elementAt(0));
    manufacturerBindingTModelKey = tModelInfo.getTModelKey();

    BindingDetail bindingDetail2 = query.query_bindingTemplate(manufacturerBindingTModelKey);
    v = bindingDetail2.getBindingTemplateVector();
    size = v.size();
    for (int i = 0; i < size; i++) {
        BindingTemplate bindingTemplate = (BindingTemplate) (v.elementAt(i));
        String bindingKey = bindingTemplate.getBindingKey();
        System.out.println("bindingKey is " + bindingKey);
    }

    System.out.println("\nQuerying the SOAP implementations of the ManufacturerPortType portType tModel (example of 
query described in section 3.3.5 of the TN...)\n");

    BindingDetail bindingDetail3 = query.query_bindingTemplate(
        manufacturerPortTypeTModelKey, SOAP_PROTOCOL_TMODELKEY, null);

    v = bindingDetail3.getBindingTemplateVector();
    size = v.size();
    for (int i = 0; i < size; i++) {
        BindingTemplate bindingTemplate = (BindingTemplate) (v.elementAt(i));
        String bindingKey = bindingTemplate.getBindingKey();
        System.out.println("bindingKey is " + bindingKey);
    }

    System.out.println("\nQuerying the SOAP/HTTP implementations of the ManufacturerPortType portType tModel (example of 
query described in section 3.3.6 of the TN...)\n");

    BindingDetail bindingDetail4 = query.query_bindingTemplate(
        manufacturerPortTypeTModelKey, SOAP_PROTOCOL_TMODELKEY,
        HTTP_TRANSPORT_TMODELKEY);

    v = bindingDetail4.getBindingTemplateVector();
    size = v.size();
    for (int i = 0; i < size; i++) {
        BindingTemplate bindingTemplate = (BindingTemplate) (v.elementAt(i));
        String bindingKey = bindingTemplate.getBindingKey();
        System.out.println("bindingKey is " + bindingKey);
    }
}

Return to article