dropping the uddi support into webservices so it doesn't get lost.
This commit is contained in:
jgaunt%netscape.com 2003-07-21 18:03:42 +00:00
Родитель 789a814cdb
Коммит 0d2b704ff6
5 изменённых файлов: 2843 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,35 @@
The contents of this directory constitute the UDDI support of mozilla.
Currently the UDDI Inquiry API is completely implemented, but not tested. In
addition it is neccessary to add these files to a chrome resource somewhere in
order to make the calls. During development I had these file in the
mozilla/extensions/webservices/build/src directory and included the js files
in a jar.mn in the same directory.
The implementation is merely calls to the native SOAP layer, but there are
enough types involved that we felt it would be helpful to have an abstraction.
So we came up with a similar concept to what we did with SOAP, namely to have
a UDDICall object that served as a proxy and did the SOAP calls underneath
the covers.
The final goal of this implementation was to have the UDDI support actually
be a js component. This would eliminate the need to have the js files and the
test html page be loaded in a chrome url. Didn't get far enough to get that
work started.
Things left to do:
- add encoders for the return types. currently the return types just have
decoders. The encoders are desired for outputting the return types as
text strings.
- create a js component
- test the implementation to make sure all the fields in the js objects are
actually getting populated as they should. This is mainly focused at the
decoding of the objects (which is why we need the first task handled.
- take the js code in the uddi.html file and create a seperate library that
includes those methods for testing purposes.
- transform the uddi.html file into a full coverage UDDI testing page that
will not only allow for the testing of methods, but will populate fields
with the return values. (think test automation too!)
john gaunt
redfive@acm.org
7/21/2003

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,556 @@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the UDDI Inquiry API
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Harish Dhurvasula <harishd@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
//
// Global JS console helper functions
//
var gConsoleService = Components.classes['@mozilla.org/consoleservice;1'].getService(Components.interfaces.nsIConsoleService);
function logUDDIError(aMessage, aSourceName, aSourceLine)
{
var errorObject = Components.classes['@mozilla.org/scripterror;1'].createInstance(Components.interfaces.nsIScriptError);
if (gConsoleService && errorObject) {
errorObject.init(aMessage, aSourceName, aSourceLine, 0, 0, 0, "UDDI SOAP");
gConsoleService.logMessage(errorObject);
}
}
function logUDDIWarning(aMessage, aSourceName, aSourceLine, aFlag)
{
var errorObject = Components.classes['@mozilla.org/scripterror;1'].createInstance(Components.interfaces.nsIScriptError);
if (gConsoleService && errorObject) {
errorObject.init(aMessage, aSourceName, aSourceLine, 0, 0, 1, "UDDI SOAP");
gConsoleService.logMessage(errorObject);
}
}
function logUDDIMessage(aMessage)
{
if (gConsoleService)
gConsoleService.logStringMessage(aMessage);
}
//
// UDDI Inquiry proxy class
//
const kEnvelopeBegin = "<?xml version='1.0' encoding='utf-8'?><Envelope xmlns='http://schemas.xmlsoap.org/soap/envelope/'><Body>";
const kEnvelopeEnd = "</Body></Envelope>";
function UDDIInquiry()
{
this.mXMLHttpRequest = new XMLHttpRequest();
this.decoder = new UDDIDecoder();
this.encoder = new UDDIEncoder();
}
UDDIInquiry.prototype =
{
operatorSite : null,
mXMLHttpRequest : null,
serializer : null,
decoder : null,
encoder : null,
findBinding : function (aServiceKey, aMaxRows, aFindQualifiers, aTModelBag)
{
var msg = this.encoder.encodeFindBinding(aServiceKey, aMaxRows, aFindQualifiers, aTModelBag);
this.sendRequest(msg);
return this.decoder.decodeBindingDetail(this.mXMLHttpRequest.responseXML);
},
findBusiness : function (aMaxRows, aFindQualifiers, aName, aIdentifierBag, aCategoryBag, aTModelBag, aDiscoveryURLs)
{
var msg = this.encoder.encodeFindBusiness(aName, aFindQualifiers, aIdentifierBag, aCategoryBag, aTModelBag, aDiscoveryURLs, aMaxRows);
this.sendRequest(msg);
return this.decoder.decodeBusinessList(this.mXMLHttpRequest.responseXML);
},
findRelatedBusinesses : function (aMaxRows, aFindQualifiers, aBusinessKey, aKeyedReference)
{
var msg = this.encoder.encodeFindRelatedBussinesses(aMaxRows, aFindQualifiers, aBusinessKey, aKeyedReference);
this.sendRequest(msg);
return this.decoder.decodeRelatedBusinessesList(this.mXMLHttpRequest.responseXML);
},
findService : function (aBusinessKey, aMaxRows, aFindQualifiers, aName, aCategoryBag, aTModelBag)
{
var msg = this.encoder.encodeFindService(aName, aFindQualifiers, aCategoryBag, aTModelBag, aMaxRows, aBusinessKey);
this.sendRequest(msg);
return this.decoder.decodeServiceList(this.mXMLHttpRequest.responseXML);
},
findTModel : function (aMaxRows, aFindQualifiers, aName, aIdentifierBag, aCategoryBag)
{
var msg = this.encoder.encodeFindTModel(aMaxRows, aFindQualifiers, aName, aIdentifierBag, aCategoryBag);
this.sendRequest(msg);
return this.decoder.decodeTModelList(this.mXMLHttpRequest.responseXML);
},
getBindingDetail : function (aBindingKey)
{
var msg = this.encoder.encodeGetBindingDetail(aBindingKey);
this.sendRequest(msg);
return this.decoder.decodeBindingDetail(this.mXMLHttpRequest.responseXML);
},
getBusinessDetail : function (aBusinessKey)
{
var msg = this.encoder.encodeGetBusinessDetail(aBusinessKey);
this.sendRequest(msg);
return this.decoder.decodeBusinessDetail(this.mXMLHttpRequest.responseXML);
},
getBusinessDetailExt : function (aBusinessKey)
{
var msg = this.encoder.encodeGetBusinessDetailExt(aBusinessKey);
this.sendRequest(msg);
return this.decoder.decodeBusinessDetailExt(this.mXMLHttpRequest.responseXML);
},
getServiceDetail : function (aServiceKey)
{
var msg = this.encoder.encodeGetServiceDetail(aServiceKey);
this.sendRequest(msg);
return this.decoder.decodeServiceDetail(this.mXMLHttpRequest.responseXML);
},
getTModelDetail : function (aTModelKey)
{
var msg = this.encoder.encodeGetTModelDetail(aTModelKey);
this.sendRequest(msg);
return this.decoder.decodeTModelDetail(this.mXMLHttpRequest.responseXML);
},
sendRequest : function (aMessage)
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
this.mXMLHttpRequest.open("POST", this.operatorSite, false);
this.mXMLHttpRequest.setRequestHeader("Content-Type","text/xml; charset=\"utf-8\"");
this.mXMLHttpRequest.setRequestHeader("SOAPAction","\"\"");
this.mXMLHttpRequest.overrideMimeType("text/xml");
this.mXMLHttpRequest.send(aMessage);
},
// for debugging purposes
getResponseMessage : function ()
{
if (!this.serializer)
this.serializer = new XMLSerializer();
return this.serializer.serializeToString(this.mXMLHttpRequest.responseXML);
}
}; // end of class UDDIInquiry
function UDDIEncoder() {
}
UDDIEncoder.prototype =
{
//-----------------------------------------------------------------------------
// Encoding of UDDI Inquiry API find_XX calls - WSDL/alpha order
//-----------------------------------------------------------------------------
encodeFindBinding : function (aServiceKey, aMaxRows, aFindQualifiers, aTModelBag)
{
// check required elements and types
if ((!aServiceKey) ||
(!aTModelBag || !(aTModelBag instanceof TModelBag)) ||
(aFindQualifiers && !(aFindQualifiers instanceof FindQualifiers))) {
logUDDIError("Bad Arguements to UDDIInquiry.findBinding()", "UDDIEncode.js", "EncodeFindBinding()");
return null;
}
var rv = kEnvelopeBegin;
rv += "<find_binding xmlns=\"urn:uddi-org:api_v2\" generic=\"2.0\" ";
rv += "serviceKey=\"" + aServiceKey + "\" ";
if (aMaxRows)
rv += "maxRows=\"" + aMaxRows + "\" ";
rv += ">";
if (aFindQualifiers)
rv += this.encodeFindQualifiers(aFindQualifiers);
if (aTModelBag)
rv += this.encodeTModelBag(aTModelBag);
rv += "</find_binding>";
rv += kEnvelopeEnd;
return rv;
},
encodeFindBusiness : function (aName, aFindQualifiers, aIdentifierBag, aCategoryBag, aTModelBag, aDiscoveryURLs, aMaxRows)
{
// check types, no required elements
if ((aFindQualifiers && !(aFindQualifiers instanceof FindQualifiers)) ||
(aIdentifierBag && !(aIdentifierBag instanceof IdentifierBag)) ||
(aCategoryBag && !(aCategoryBag instanceof CategoryBag)) ||
(aTModelBag && !(aTModelBag instanceof TModelBag))) {
logUDDIError("Bad Arguements to UDDIInquiry.findBinding()", "UDDIEncode.js", "EncodeFindBinding()");
return null; // report error;
}
var rv = kEnvelopeBegin;
rv += "<find_business xmlns=\"urn:uddi-org:api_v2\" generic=\"2.0\" ";
if (aMaxRows)
rv += "maxRows=\"" + aMaxRows + "\" ";
rv += ">";
if (aFindQualifiers)
rv += this.encodeFindQualifiers(aFindQualifiers);
if (aName)
rv += this.encodeName(aName);
if (aIdentifierBag)
rv += this.encodeIdentifierBag(aIdentifierBag);
if (aCategoryBag)
rv += this.encodeCategoryBag(aCategoryBag);
if (aTModelBag)
rv += this.encodeTModelBag(aTModelBag);
if (aDiscoveryURLs)
rv += this.encodeDiscoveryURLs(aDiscoveryURLs);
rv += "</find_business>";
rv += kEnvelopeEnd;
return rv;
},
encodeFindRelatedBussinesses : function (aMaxRows, aFindQualifiers, aBusinessKey, aKeyedReference)
{
// check required elements and types
if (!aBusinessKey ||
(aFindQualifiers && !(aFindQualifiers instanceof FindQualifiers)) ||
(aKeyedReference && !(aKeyedReference instanceof KeyedReference))) {
logUDDIError("Bad Arguements to UDDIInquiry.findBinding()", "UDDIEncode.js", "EncodeFindBinding()");
return null; // XXX report error;
}
var rv = kEnvelopeBegin;
rv += "<find_relatedBusinesses xmlns=\"urn:uddi-org:api_v2\" generic=\"2.0\" ";
if (aMaxRows)
rv += "maxRows=\"" + aMaxRows + "\" ";
rv += ">";
if (aFindQualifiers)
rv += this.encodeFindQualifiers(aFindQualifiers);
rv += "<businessKey>" + aBusinessKey + "</businessKey>";
if (aKeyedReference)
rv += this.encodeKeyedReference(aKeyedReference);
rv += "</find_relatedBusinesses>";
rv += kEnvelopeEnd;
return rv;
},
encodeFindService : function (aName, aFindQualifiers, aCategoryBag, aTModelBag, aMaxRows, aBusinessKey)
{
if ((aFindQualifiers && !(aFindQualifiers instanceof FindQualifiers)) ||
(aCategoryBag && !(aCategoryBag instanceof CategoryBag)) ||
(aTModelBag && !(aTModelBag instanceof TModelBag))) {
logUDDIError("Bad Arguements to UDDIInquiry.findBinding()", "UDDIEncode.js", "EncodeFindBinding()");
return null; // report error;
}
var rv = kEnvelopeBegin;
rv += "<find_service xmlns=\"urn:uddi-org:api_v2\" generic=\"2.0\" ";
if (aMaxRows)
rv += "maxRows=\"" + aMaxRows + "\" ";
if (aBusinessKey)
rv += "businessKey=\"" + aBusinessKey + "\" ";
rv += ">";
if (aFindQualifiers)
rv += this.encodeFindQualifiers(aFindQualifiers);
if (aName)
rv += "<name>" + aName + "</name>";
if (aCategoryBag)
rv += this.encodeCategoryBag(aCategoryBag);
if (aTModelBag)
rv += this.encodeTModelBag(aTModelBag);
rv += "</find_service>";
rv += kEnvelopeEnd;
return rv;
},
encodeFindTModel : function (aMaxRows, aFindQualifiers, aName, aIdentifierBag, aCategoryBag)
{
if ((aFindQualifiers && !(aFindQualifiers instanceof FindQualifiers)) ||
(aIdentifierBag && !(aIdentifierBag instanceof IdentifierBag)) ||
(aCategoryBag && !(aCategoryBag instanceof CategoryBag))) {
logUDDIError("Bad Arguements to UDDIInquiry.findBinding()", "UDDIEncode.js", "EncodeFindBinding()");
return null; // report error;
}
var rv = kEnvelopeBegin;
rv += "<find_tModel xmlns=\"urn:uddi-org:api_v2\" generic=\"2.0\" ";
if (aMaxRows)
rv += "maxRows=\"" + aMaxRows + "\" ";
rv += ">";
if (aFindQualifiers)
rv += this.encodeFindQualifiers(aFindQualifiers);
if (aName)
rv += "<name>" + aName + "</name>";
if (aIdentifierBag)
rv += this.encodeIdentifierBag(aIdentifierBag);
if (aCategoryBag)
rv += this.encodeCategoryBag(aCategoryBag);
rv += "</find_tModel>";
rv += kEnvelopeEnd;
return rv;
},
//-----------------------------------------------------------------------------
// Encoding of Inquiry UDDI API get_XX calls - alpha order
//-----------------------------------------------------------------------------
encodeGetBindingDetail : function (aBindingKey)
{
var rv = kEnvelopeBegin;
rv += "<get_bindingDetail xmlns=\"urn:uddi-org:api_v2\" generic=\"2.0\" >";
rv += "<bindingKey>" + aBindingKey + "</bindingKey>";
rv += "</get_bindingDetail>";
rv += kEnvelopeEnd;
return rv;
},
encodeGetBusinessDetail : function (aBusinessKey)
{
var rv = kEnvelopeBegin;
rv += "<get_businessDetail xmlns=\"urn:uddi-org:api_v2\" generic=\"2.0\" >";
rv += "<businessKey>" + aBusinessKey + "</businessKey>";
rv += "</get_businessDetail>";
rv += kEnvelopeEnd;
return rv;
},
encodeGetBusinessDetailExt : function (aBusinessKey)
{
var rv = kEnvelopeBegin;
rv += "<get_businessDetailExt xmlns=\"urn:uddi-org:api_v2\" generic=\"2.0\" >";
rv += "<businessKey>" + aBusinessKey + "</businessKey>";
rv += "</get_businessDetailExt>";
rv += kEnvelopeEnd;
return rv;
},
encodeGetServiceDetail : function (aServiceKey)
{
var rv = kEnvelopeBegin;
rv += "<get_serviceDetail xmlns=\"urn:uddi-org:api_v2\" generic=\"2.0\" >";
rv += "<serviceKey>" + aServiceKey + "</serviceKey>";
rv += "</get_serviceDetail>";
rv += kEnvelopeEnd;
return rv;
},
encodeGetTModelDetail : function (aTModelKey)
{
var rv = kEnvelopeBegin;
rv += "<get_tModelDetail xmlns=\"urn:uddi-org:api_v2\" generic=\"2.0\" >";
rv += "<tModelKey>" + aTModelKey + "</tModelKey>";
rv += "</get_tModelDetail>";
rv += kEnvelopeEnd;
return rv;
},
//-----------------------------------------------------------------------------
// Encoding of UDDI Spec types used as Inquiry call arguements - alpha sort
//-----------------------------------------------------------------------------
/* */
encodeCategoryBag : function (aCategoryBag)
{
var rv = "";
if (aCategoryBag) {
var krobjs = aCategoryBag.keyedReferences;
var length = krobjs.length;
if (length > 0) {
rv = "<categoryBag>";
rv += this.encodeKeyedReferences(krobjs);
rv += "</categoryBag>";
}
}
return rv;
},
/* */
encodeDiscoveryURLs : function (aDiscoveryURLs)
{
var rv = "";
if (aDiscoveryURLs) {
var durlobjs = aDiscoveryURLs;
var length = durlobjs.length;
if (length > 0) {
rv = "<discoveryURLs>";
for (var i = 0; i < length; i++) {
var durl = durlobjs[i];
if (durl && !(durl instanceof DiscoveryURL)) {
logUDDIError("Bad DiscoveryURLs arguement", "UDDIEncode.js", "encodeDiscoveryURLS()");
return null; // XXX report error
}
rv += "<discoveryURL useType=\"" + durl.useType + ">";
rv += durl.stringValue;
rv += "</discoveryURL>";
}
rv += "</discoveryURLs>";
}
}
return rv;
},
/* */
encodeFindQualifiers : function (aFindQualifiers)
{
var rv = "";
if (aFindQualifiers) {
rv = "<findQualifiers>"; // can be empty
if (aFindQualifiers.findQualifers != null) {
var fqstrs = aFindQualifiers.findQualifiers;
var length = fqstrs.length;
if (length > 0) {
for (var i = 0; i < length; i++)
rv += "<findQualifier>" + fqstrs[i] + "</findQualifier>";
}
}
rv += "</findQualifiers>";
}
return rv;
},
/* */
encodeIdentifierBag : function (aIdentifierBag)
{
var rv = "";
if (aIdentifierBag) {
var krobjs = aIdentifierBag.keyedReferences;
var length = krobjs.length;
if (length > 0) {
rv = "<identifierBag>";
rv += this.encodeKeyedReferences(krobjs);
rv += "</identifierBag>";
}
}
return rv;
},
/* */
encodeKeyedReference : function (aKeyedReference)
{
if (aKeyedReference &&
(!(aKeyedReference instanceof KeyedReference) ||
!aKeyedReference.keyValue)) {
logUDDIError("Bad Arguements to UDDIInquiry.findBinding()", "UDDIEncode.js", "EncodeFindBinding()");
return ""; // XXX report error -- do we want to type check on ALL encode methods?
}
var rv = "<keyedReference ";
if (aKeyedReference.tModelKey)
rv += "tModelKey=\"" + aKeyedReference.tModelKey + "\" ";
if (aKeyedReference.keyName)
rv += "keyName=\"" + aKeyedReference.keyName + "\" ";
if (aKeyedReference.keyValue)
rv += "keyValue=\"" + aKeyedReference.keyValue + "\" ";
rv += "/>";
},
// XXX just creates an array, move to caller?
/* */
encodeKeyedReferences : function (aKeyedReferences)
{
var rv = "";
if (aKeyedReferences) {
var length = aKeyedReferences.length;
for (var i = 0; i < length; i++) {
rv += this.encodeKeyedReference(aKeyedReference);
}
}
return rv;
},
/* */
encodeName : function (aName)
{
var rv = "";
if (typeof aName == "string")
rv = "<name>" + aName + "</name>";
else if (aName.constructor == Array) {
var length = aName.length;
for (var i = 0; i < length; i++) {
rv += "<name>" + aName[i] + "</name>";
}
}
else {
logUDDIError("Bad Arguements to UDDIInquiry.findBinding()", "UDDIEncode.js", "EncodeFindBinding()");
// XXX report error
}
return rv;
},
/* */
encodeTModelBag : function (aTModelBag)
{
var rv = "";
if (aTModelBag) {
var tmkstrs = aTModelBag.tModelKeys;
var length = tmkstrs.length;
if (length > 0) {
rv = "<tModelBag>";
for (var i = 0; i < length; i++) {
rv += "<tModelKey>" + tmkstrs[i] + "</tModelKey>";
}
rv += "</tModelBag>";
}
}
return rv;
}
}; // end of class UDDIEncoder

Просмотреть файл

@ -0,0 +1,597 @@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the UDDI Inquiry API
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2003
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Harish Dhurvasula <harishd@netscape.com>
* John Gaunt <jgaunt@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
////
//
// Type Definitions for UDDI Inquiry and Publish (eventually) calls.
//
// KEY:
// shortcut-array: means that there is an actual element of the name of the
// field that contains only an array of objects of the specified type.
// To reduce the number of classes the container class has been removed.
// optional: this field does not need to be set
// required: this field must be set
// attribute: this field is represented by an attribute on the element
// unbounded: there can be multiple elements of this type contained in the
// parent element.
// ----------------------------------------------------------------------------
// UDDI Inquiry Request Message types - alpha sort
// ----------------------------------------------------------------------------
/* encoder */
function Find_Binding() { }
Find_Binding.prototype =
{
findQualifiers : null, // [optional] - shortcut-array of FindQualifier object (can be empty)
tModelBag : null, // [required]
generic : null, // [required, attribute]
maxRows : null, // [optional, attribute]
serviceKey : null, // [required, attribute]
}
/* encoder */
function Find_Business() { }
Find_Business.prototype =
{
findQualifiers : null, // [optional] - shortcut-array of FindQualifier object (can be empty)
names : null, // [optional, unbounded] - array of Name objects
identifierBag : null, // [optional]
categoryBag : null, // [optional]
tModelBag : null, // [optional]
discoveryURLs : null, // [optional, unbounded] - shortcut-array of DiscoveryURL objects (if present, cannot be empty)
generic : null, // [required, attribute]
maxRows : null, // [optional, attribute]
}
/* encoder */
function Find_RelatedBusinesses() { }
Find_RelatedBusinesses.prototype =
{
findQualifiers : null, // [optional] - shortcut-array of FindQualifier object (can be empty)
businessKey : null, // [required] - string
keyedReference : null, // [optional]
generic : null, // [required, attribute]
maxRows : null, // [optional, attribute]
}
/* encoder */
function Find_Service() { }
Find_Service.prototype =
{
findQualifiers : null, // [optional] - shortcut-array of FindQualifier object (can be empty)
names : null, // [optional, unbounded] - array of Name objects
categoryBag : null, // [optional]
tModelBag : null, // [optional]
generic : null, // [required, attribute]
maxRows : null, // [optional, attribute]
businessKey : null, // [optional, attribute]
}
/* encoder */
function Find_TModel() { }
Find_TModel.prototype =
{
findQualifiers : null, // [optional] - shortcut-array of FindQualifier object (can be empty)
name : null, // [optional]
identifierBag : null, // [optional]
categoryBag : null, // [optional]
generic : null, // [required, attribute]
maxRows : null, // [optional, attribute]
}
/* encoder */
function Get_BindingDetail() { }
Get_BindingDetail.prototype =
{
bindingKeys : null, // [required, unbounded] - array of bindingKey strings
generic : null, // [required, attribute]
}
/* encoder */
function Get_BusinessDetail() { }
Get_BusinessDetail.prototype =
{
businessKeys : null, // [required, unbounded] - array of businessKey strings
generic : null, // [required, attribute]
}
/* encoder */
function Get_BusinessDetailExt() { }
Get_BusinessDetailExt.prototype =
{
businessKeys : null, // [required, unbounded] - array of businessKey strings
generic : null, // [required, attribute]
}
/* encoder */
function Get_ServiceDetail() { }
Get_ServiceDetail.prototype =
{
serviceKeys : null, // [required, unbounded] - array of serviceKey strings
generic : null, // [required, attribute]
}
/* encoder */
function Get_TModelDetail() { }
Get_TModelDetail.prototype =
{
tModelKeys : null, // [required, unbounded] - array of tModelKey strings
generic : null, // [required, attribute]
}
// ----------------------------------------------------------------------------
// UDDI Inquiry Response Message types - alpha sort
// ----------------------------------------------------------------------------
/* decoder */
function BindingDetail() { }
BindingDetail.prototype =
{
bindingTemplates : null, // [optional, unbounded] - array of BindingTemplate objects
generic : null, // [required, attribute]
operator : null, // [required, attribute]
truncated : null, // [optional, attribute]
toString : function () {
return "BindingDetail[generic: " + this.generic + " operator: " + this.operator + " truncated: " + this.truncated + "]";
}
};
/* decoder */
function BusinessDetail() { }
BusinessDetail.prototype =
{
businessEntities : null, // [optional, unbounded] - array of BusinessEntity objects
generic : null, // [required, attribute]
operator : null, // [required, attribute]
truncated : null, // [optional, attribute]
};
/* decoder */
function BusinessDetailExt() { }
BusinessDetailExt.prototype =
{
businessEntityExts : null, // [required, unbounded] - array of BusinessEntityExt objects
generic : null, // [required, attribute]
operator : null, // [required, attribute]
truncated : null, // [optional, attribute]
}
/* decoder */
function BusinessList() { }
BusinessList.prototype =
{
businessInfos : null, // [required, unbounded] - shortcut-array of BusinessInfo objects (can be empty)
generic : null, // [required, attribute]
operator : null, // [required, attribute]
truncated : null, // [optional, attribute]
};
/* decoder */
function RelatedBusinessesList() { }
RelatedBusinessesList.prototype =
{
businessKey : null, // [required] - string
relatedBusinessInfos : null, // [required, unbounded] - shortcut-array of RelatedBusinessInfo objects (can be empty)
generic : null, // [required, attribute]
operator : null, // [required, attribute]
truncated : null, // [optional, attribute]
};
/* decoder */
function ServiceDetail() { }
ServiceDetail.prototype =
{
businessServices : null, // [optional, unbounded] - array of BusinessService objects
generic : null, // [required, attribute]
operator : null, // [required, attribute]
truncated : null, // [optional, attribute]
};
/* decoder */
function ServiceList() { }
ServiceList.prototype =
{
serviceInfos : null, // [required, unbounded] - shortcut-array of ServiceInfo objects (can be empty)
generic : null, // [required, attribute]
operator : null, // [required, attribute]
truncated : null, // [optional, attribute]
};
/* decoder */
function TModelDetail() { }
TModelDetail.prototype =
{
tModels : null, // [required, unbounded] - array of TModel objects
generic : null, // [required, attribute]
operator : null, // [required, attribute]
truncated : null, // [optional, attribute]
};
/* decoder */
function TModelList() { }
TModelList.prototype =
{
tModelInfos : null, // [required, unbounded] - shortcut-array of TModelInfo objects (can be empty)
generic : null, // [required, attribute]
operator : null, // [required, attribute]
truncated : null, // [optional, attribute]
}
// ----------------------------------------------------------------------------
// UDDI Inquiry Registry Content types - alpha sort
// ----------------------------------------------------------------------------
// XXX make one last pass through the content type definitions to clean up
// note the shortcut arrays and which ones can be empty!!
/* decoder */
function AccessPoint() { }
AccessPoint.prototype =
{
stringValue : null, // [required] - string
urlType : null, // [required, attribute] - restricted to certain values (mailto, http, etc.)
};
/* decoder */
function Address() { }
Address.prototype =
{
addressLines : null, // [optional] - array of AddressLine objects
useType : null, // [optional, attribute]
sortCode : null, // [optional, attribute]
tModelKey : null, // [optional, attribute]
};
/* decoder */
function AddressLine() { }
AddressLine.prototype =
{
stringValue : null, // [required] - string
keyName : null, // [optional, attribute]
KeyValue : null, // [optional, attribute]
};
/* decoder */
function BindingTemplate() { }
BindingTemplate.prototype =
{
descriptions : null, // [optional, unbounded] - array of Description objects
accessPoint : null, // [required, choice]
hostingRedirector : null, // [required, choice]
tModelInstanceDetails : null, // [required] - shortcut-array of TModelInstanceInfo objects (can be empty)
serviceKey : null, // [optional, attribute]
bindingKey : null, // [required, attribute]
};
/* bindingTemplates - just an array */
/* decoder */
function BusinessEntity() { }
BusinessEntity.prototype =
{
discoveryURLs : null, // [optional] - shortcut-array of DiscoveryURL objects (can not be empty)
names : null, // [required, unbounded] - array of Name objects
descriptions : null, // [optional, unbounded] - array of Description objects
contacts : null, // [optional] - shortcut - array of Contact objects (can not be empty)
businessServices : null, // [optional] - shortcut-array of BusinessService objects (can be empty)
identifierBag : null, // [optional]
categoryBag : null, // [optional]
businessKey : null, // [required, attribute]
operator : null, // [optional, attribute]
authorizedName : null, // [optional, attribute]
};
/* decoder */
function BusinessEntityExt() { }
BusinessEntityExt.prototype =
{
businessEntity : null, // [required]
extensions : null, // [optional, unbounded] - array of XML elements
}
/* decoder */
function BusinessInfo() { }
BusinessInfo.prototype =
{
names : null, // [required, unbounded] - array of Name Objects
descriptions : null, // [optional, unbounded] - array of Description objects
serviceInfos : null, // [required] - shortcut-array of ServiceInfo objects (can be empty)
businessKey : null, // [required, attribute]
};
/* businessInfos - just an array */
/* decoder */
function BusinessService() { }
BusinessService.prototype =
{
names : null, // [optional, unbounded] - array of Name objects
descriptions : null, // [optional, unbounded] - array of Description object
bindingTemplates : null, // [optional] - array of BindingTemplate objects (can be empty)
categoryBag : null, // [optional]
serviceKey : null, // [required, attribute]
businessKey : null, // [optional, attribute]
};
/* businessServices - just an array */
/* encoder, decoder*/
function CategoryBag() { }
/* encoder */
CategoryBag.prototype =
{
keyedReferences : null, // [required, unbounded] - array of KeyedReference objects
};
/* decoder */
function Contact() { }
Contact.prototype =
{
descriptions : null, // [optional, unbounded] - array of Description objects
personName : null, // [required] - string
phones : null, // [optional, unbounded] - array of Phone objects
emails : null, // [optional, unbounded] - array of email address strings
addressses : null, // [optional, unbounded] - array of Address objects
useType : null, // [optional, attribute]
};
/* contacts - just an array */
/* decoder */
function Description() { }
Description.prototype =
{
stringValue : null, // [required]
lang : null, // [optional, attribute]
};
/* encoder, decoder */
function DiscoveryURL() { }
DiscoveryURL.prototype =
{
stringValue : null, // [required]
useType : null, // [required, attribute]
};
/* discoveryURLS - just an array */
/* decoder */
function Email() { }
Email.prototype =
{
stringValue : null, // [required]
useType : null, // [optional, attribute]
}
/* findQualifier - just a string */
// XXX this can go, change to an array of strings in the owning object
/* encoder */
function FindQualifiers() { }
FindQualifiers.prototype =
{
findQualifiers : null, // [optional, unbounded] - array of findQualifer strings
};
/* decoder */
function HostingRedirector() { }
HostingRedirector.prototype =
{
bindingKey : null, // [required, attribute] - string
};
/* encoder, decoder */
function IdentifierBag() { }
IdentifierBag.prototype =
{
keyedReferences : null, // [required, unbounded] - array of KeyedReference objects
};
/* decoder */
function InstanceDetails() { }
InstanceDetails.prototype =
{
descriptions : null, // [optional, unbounded] - array of Description objects
overviewDoc : null, // [optional]
instanceParms : null, // [optional] - string
};
/* encoder, decoder */
function KeyedReference() { }
KeyedReference.prototype =
{
tModelKey : null, // [optional, attribute] - string
keyName : null, // [optional, attribute] - string
keyValue : null, // [required, attribute] - string
};
/* encoder, decoder */
function Name() { }
Name.prototype =
{
stringValue : null, // [required]
lang : null, // [optional, attribute] - string
}
/* decoder */
function OverviewDoc() { }
OverviewDoc.prototype =
{
descriptions : null, // [optional, unbounded] - array of Description objects
overviewURL : null, // [optional] - string
};
/* decoder */
function Phone() { }
Phone.prototype =
{
stringValue : null, // [required]
useType : null, // [optional, attribute]
}
/* decoder */
function RelatedBusinessInfo() { }
RelatedBusinessInfo.prototype =
{
businessKey : null, // [required] - string
names : null, // [required, unbounded] - array of Name objects (*defnd above*)
descriptions : null, // [optional, unbounded] - array of Description objects (*defnd above*)
sharedRelationships : null, // [required, max=2] - array of SharedRelationships objects. XXXjg required?
};
/* relatedBusinessInfos - just an array */
/* decoder */
function ServiceInfo() { }
ServiceInfo.prototype =
{
names : null, // [optional, unbounded] - array of Name Objects
businessKey : null, // [required, attribute] - string
serviceKey : null, // [required, attribute] - string
};
/* serviceInfos - just an array */
/* decoder */
function SharedRelationships() { }
SharedRelationships.prototype =
{
keyedReferences : null, // [required, unbounded] - array of KeyedReference objects
direction : null, // [required, attribute] - string, limited to [toKey | fromKey]
};
/* decoder */
function TModel() { }
TModel.prototype =
{
name : null, // [required]
descriptions : null, // [optional, unbounded]
overviewDoc : null, // [optional]
identifierBag : null, // [optional]
categoryBag : null, // [optional]
tModelKey : null, // [required, attribute]
operator : null, // [optional, attribute]
authorizedName : null, // [optional, attribute]
}
// XXX this can go, change to an array of tModelKey strings in the owning object
/* encoder */
function TModelBag() { }
TModelBag.prototype =
{
tModelKeys : null, // [required, unbounded] - array of tModelKey strings
};
/* decoder */
function TModelInfo() { }
TModelInfo.prototype =
{
name : null, // [required]
tModelKey : null, // [required, attribute]
};
/* tModelInfos - just an array of tModelInfo objects */
/* tModelInstanceDetails - just an array of tModelInstanceInfo objects */
/* decoder */
function TModelInstanceInfo() { }
TModelInstanceInfo.prototype =
{
descriptions : null, // [optional, unbounded] - array of Description objects
instanceDetails : null, // [optional]
tModelKey : null, // [required, attribute] - string
};
// ----------------------------------------------------------------------------
// END OF FILE
// ----------------------------------------------------------------------------

Просмотреть файл

@ -0,0 +1,311 @@
<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>