RetroZilla/extensions/webservices/uddi/uddi.html
2015-10-20 23:03:22 -04:00

312 lines
14 KiB
HTML

<html>
<head>
<title>UDDI Test Page</title>
<script src="UDDIEncode.js"></script>
<script src="UDDIDecode.js"></script>
<script src="UDDITypes.js"></script>
<script>
var proxy = new UDDIInquiry();
proxy.operatorSite = "http://www-3.ibm.com:80/services/uddi/inquiryapi";
// variables for reuse:
// when set the variables contain data for the Amazon entry in the IBM
// UDDI registry
var busKey = "BFB9DC23-ADEC-4F73-BD5F-5545ABAEAA1B"; // Amazon business key
var findQuals = new FindQualifiers(); // can be empty
var keyRef = new KeyedReference();
keyRef.tModelKey = "UUID:C5DA9443-D058-4EDE-9DB1-4F1D5DEB805C"; // required Amazon tModelKey
keyRef.keyName = ""; // optional
keyRef.keyValue = ""; // optional
var identBag = new IdentifierBag();
identBag.keyedReferences = [keyRef]; // required array literal
var catBag = new CategoryBag();
catBag.keyedReferences = [keyRef]; // required array literal
var maxRows = 10;
var name = "Amazon";
var names = ["Amazon", "book"]; // array literal
var serviceKey="uuid:41213238-1B33-40F4-8756-C89CC3125ECC"; // Amazon serviceKey
var tmBag = new TModelBag();
tmBag.tModelKeys = ["UUID:C5DA9443-D058-4EDE-9DB1-4F1D5DEB805C"]; // required Amazon tModelKey - array literal
// ----------------------------------------------------------------------
// test the findBinding API call ----------------------------------------
// ----------------------------------------------------------------------
function doFindBinding() {
var tmBag = new TModelBag();
tmBag.tModelKeys = [document.forms[0].elements["tModelKey"].value]; // required Amazon tModelKey - array literal
// findBinding(aServiceKey, aMaxRows?, aFindQualifiers?, aTModelBag)
var bindingDetail = proxy.findBinding(document.forms[0].elements["serviceKey"].value,
document.forms[0].elements["maxRows"].value,
findQuals,
tmBag);
if (bindingDetail)
if (bindingDetail.bindingTemplates == null)
alert("find_binding succeeded\n No bindingTemplates reported");
else
alert("find_binding succeeded, found bindingTemplate:\n [bindingKey:" + bindingDetail.bindingTemplates[0].bindingKey) + "]";
else
alert("find_binding failed\n No bindingDetail returned");
updateTextArea();
updateTextAreaWithObject(bindingDetail);
}
// ----------------------------------------------------------------------
// test the findBusiness API call ---------------------------------------
// ----------------------------------------------------------------------
function doFindBusiness() {
var names = [document.forms[0].elements["name1"].value,
document.forms[0].elements["name2"].value];
//findBusiness(aMaxRows?, aFindQualifiers?, aName?, aIdentifierBag?, aCategoryBag?, aTModelBag?, aDiscoveryURLs?)
var businessList = proxy.findBusiness(document.forms[0].elements["maxRows"].value,
null, // findQuals,
names,
null,
null,
null,
null);
if (businessList)
if (businessList.businessInfos == null)
alert("find_business succeeded\n No businessInfos");
else
alert("find_business succeeded\n" + businessList.businessInfos[0].serviceInfos[0].serviceKey);
else
alert("find_business failed\n No businessList returned");
updateTextArea();
}
// ----------------------------------------------------------------------
// test the findRelatedBusinesses API call ------------------------------
// ----------------------------------------------------------------------
function doFindRelBuses() {
var keyRef = new KeyedReference();
keyRef.tModelKey = document.forms[0].elements["tModelKey"].value; // required
keyRef.keyName = ""; // optional
keyRef.keyValue = ""; // optional
// findRelatedBusinesses(aMaxRows?, aFindQualifiers?, aBusinessKey, aKeyedReference?)
var relBusList = proxy.findRelatedBusinesses(document.forms[0].elements["maxRows"].value,
null, // findQuals,
document.forms[0].elements["businessKey"].value,
null); // keyRef
if (relBusList)
if (relBusList.relatedBusinessInfos == null)
alert("find_relatedBusinesses succeeded\n No businesses found for\n" + relBusList.businessKey);
else
alert("find_relatedBusinesses succeeded\n Business found!\n" + relBusList.relatedBusinessInfos[0].businessKey);
else
alert("find_relatedBusinesses failed\n No RelatedBusinessList returned");
updateTextArea();
}
// ----------------------------------------------------------------------
// test the findService API call ----------------------------------------
// ----------------------------------------------------------------------
function doFindService() {
// findService(aBusinessKey?, aMaxRows?, aFindQualifiers?, aName?, aCategoryBag?, aTModelBag?)
var serviceList = proxy.findService(document.forms[0].elements["businessKey"].value,
document.forms[0].elements["maxRows"].value,
null,
null,
null,
null);
if (serviceList)
if (serviceList.serviceInfos == null)
alert("find_service succeeded\n No service info found.");
else
alert("find_service succeeded\n Found Service Info!\n" + serviceList.serviceInfos[0].businessKey);
else
alert("find_service failed");
updateTextArea();
}
// ----------------------------------------------------------------------
// test the findTModel API call -----------------------------------------
// ----------------------------------------------------------------------
function doFindTModel() {
// findTModel : function (aMaxRows?, aFindQualifiers?, aName?, aIdentifierBag?, aCategoryBag?)
var tModelList = proxy.findTModel(document.forms[0].elements["maxRows"].value,
null,
document.forms[0].elements["name1"].value,
null,
null);
if (tModelList)
if (tModelList.tModelInfos == null)
alert("find_tModel succeeded\n No tModelInfo found.");
else
alert("find_tModel succeeded\n Found tModelInfo!\n" + tModelList.tModelInfos[0].tModelKey);
else
alert("find_tModel failed");
updateTextArea();
}
// ----------------------------------------------------------------------
// test the getBindingDetail API call -----------------------------------
// ----------------------------------------------------------------------
function doGetBindingDetail() {
// getBindingDetail : function (aBindingKey)
var bindingDetail = proxy.getBindingDetail(document.forms[0].elements["bindingKey"].value);
if (bindingDetail)
if (bindingDetail.bindingTemplates == null)
alert("get_bindingDetail succeeded\n No bindingTemplates reported");
else
alert("get_bindingDetail succeeded\n Found bindingTemplates!" + bindingDetail.bindingTemplates[0].bindingKey);
else
alert("get_bindingDetail failed\n No bindingDetail returned");
updateTextArea();
}
// ----------------------------------------------------------------------
// test the getBusinessDetail API call -----------------------------------
// ----------------------------------------------------------------------
function doGetBusinessDetail() {
// getBusinessDetail : function (aBusinessKey)
var businessDetail = proxy.getBusinessDetail(document.forms[0].elements["businessKey"].value);
if (businessDetail)
if (businessDetail.businessEntities == null)
alert("get_businessDetail succeeded\n No businessEntities reported");
else
alert("get_businessDetail succeeded\n Found businessEntities! " + businessDetail.businessEntities[0].businessKey);
else
alert("get_businessDetail failed\n No businessDetail returned");
updateTextArea();
}
// ----------------------------------------------------------------------
// test the getBusinessDetailExt API call -----------------------------------
// ----------------------------------------------------------------------
function doGetBusinessDetailExt() {
// getBusinessDetailExt : function (aBusinessKey)
var businessDetailExt = proxy.getBusinessDetailExt(document.forms[0].elements["businessKey"].value);
if (businessDetailExt)
if (businessDetailExt.businessEntityExts == null)
alert("get_businessDetailExt succeeded\n No businessEntities reported");
else
alert("get_businessDetailExt succeeded\n Found businessEntities! " + businessDetailExt.businessEntityExts[0].businessEntity.businessKey);
else
alert("get_businessDetailExt failed\n No businessDetail returned");
updateTextArea();
}
// ----------------------------------------------------------------------
// test the getServiceDetail API call -----------------------------------
// ----------------------------------------------------------------------
function doGetServiceDetail() {
// getServiceDetail : function (aServiceKey)
var serviceDetail = proxy.getServiceDetail(document.forms[0].elements["serviceKey"].value);
if (serviceDetail)
if (serviceDetail.businessServices == null)
alert("get_serviceDetail succeeded\n No businessServices reported");
else
alert("get_serviceDetail succeeded\n Found businessEntities! " + serviceDetail.businessServices[0].serviceKey);
else
alert("get_serviceDetail failed\n No serviceDetail returned");
updateTextArea();
}
// ----------------------------------------------------------------------
// test the getTModelDetail API call -----------------------------------
// ----------------------------------------------------------------------
function doGetTModelDetail() {
// getTModelDetail : function (aTModelKey)
var tModelDetail = proxy.getTModelDetail(document.forms[0].elements["tModelKey"].value);
if (tModelDetail)
if (tModelDetail.tModels == null)
alert("get_tModelDetail succeeded\n No tModels reported");
else
alert("get_tModelDetail succeeded\n Found tModels! " + tModelDetail.tModels[0].name);
else
alert("get_tModelDetail failed\n No tModelDetail returned");
updateTextArea();
}
function updateTextArea() {
var serializer = new XMLSerializer();
document.forms[0].elements["desc"].value = serializer.serializeToString(proxy.mXMLHttpRequest.responseXML) + "\n\n";
}
function updateTextAreaWithObject(aUDDIObject) {
updateTextArea();
if (aUDDIObject instanceof BindingDetail) {
document.forms[0].elements["desc"].value += aUDDIObject;
}
}
</script>
</head>
<body>
<h3>UDDI Tests</h3>
<form action="#" onsubmit="return false;">
<p>UDDI Inquiry data:<br />
businessKey:<input type="text" name="businessKey" value="BFB9DC23-ADEC-4F73-BD5F-5545ABAEAA1B"><br />
tModelKey:<input type="text" name="tModelKey" value="uuid:C5DA9443-D058-4EDE-9DB1-4F1D5DEB805C"><br />
serviceKey:<input type="text" name="serviceKey" value="41213238-1B33-40F4-8756-C89CC3125ECC"><br />
bindingKey:<input type="text" name="bindingKey" value="2DEA808F-1791-4933-A45D-82A4A87BA900"><br />
name1:<input type="text" name="name1" value="Amazon"><br />
name2:<input type="text" name="name2" value="book"><br />
maxRows:<input type="text" name="maxRows" value="10"><br />
</p>
<input type="button" value="find_binding" onclick="doFindBinding();">
<input type="button" value="find_business" onclick="doFindBusiness();">
<input type="button" value="find_relatedBusinesses" onclick="doFindRelBuses();">
<input type="button" value="find_service" onclick="doFindService();">
<input type="button" value="find_tModel" onclick="doFindTModel();">
<input type="button" value="get_bindingDetail" onclick="doGetBindingDetail();">
<input type="button" value="get_businessDetail" onclick="doGetBusinessDetail();">
<input type="button" value="get_businessDetailExt" onclick="doGetBusinessDetailExt();">
<input type="button" value="get_serviceDetail" onclick="doGetServiceDetail();">
<input type="button" value="get_tModelDetail" onclick="doGetTModelDetail();">
<p>
Operator Site:
<br />
<input type="text" name="registry" value="http://www-3.ibm.com:80/services/uddi/inquiryapi">
</p>
<p>
keyword:
<input type="text" name="keyword" value="Amazon">
</p>
<p>
business key:
<input type="text" name="keyword" value="Amazon">
</p>
<p>
service key:
<input type="text" name="keyword" value="Amazon">
</p>
<p>
<input type="button" value="Inquire" onclick="doInquiry();">
</p>
<p>
Registry Response
<br />
<textarea rows="30" cols="100" name="desc" value=""></textarea>
</p>
</form>
</body>
</html>