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 15. The queryBindingTModels method
private static void queryBindingTModels(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();
    int size = v.size();
    TModelInfo tModelInfo = (TModelInfo) (v.elementAt(0));
    manufacturerPortTypeTModelKey = tModelInfo.getTModelKey();

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

    TModelList bindingTModelList = query.query_binding_tModel(manufacturerPortTypeTModelKey);
    tModelInfos = bindingTModelList.getTModelInfos();
    v = tModelInfos.getTModelInfoVector();
    size = v.size();
    System.out.println("The following bindings of the ManufacturerPortType portType tModel were found:");
    for (int i = 0; i < size; i++) {
        tModelInfo = (TModelInfo) (v.elementAt(i));
        String tModelKey = tModelInfo.getTModelKey();
        System.out.println(tModelKey);
    }

    System.out.println("\nQuerying the WS-I conformant binding tModels for the ManufacturerPortType portType (this query is 
not described in the TN...)\n");

    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);
    bindingTModelList = query.query_binding_tModel(
        manufacturerPortTypeTModelKey, categoryBag);
    tModelInfos = bindingTModelList.getTModelInfos();
    v = tModelInfos.getTModelInfoVector();
    size = v.size();
    System.out.println("The following WS-I conformant bindings of the ManufacturerPortType portType tModel were found:");
    for (int i = 0; i < size; i++) {
        tModelInfo = (TModelInfo) (v.elementAt(i));
        String tModelKey = tModelInfo.getTModelKey();
        System.out.println(tModelKey);
    }
}

Return to article