📄 uddi_v2.h
字号:
*//**@fn uddi2__save_USCOREservice::uddi2__save_USCOREservice(struct soap *soap, uddi2__businessService &businessService)@brief@param[in] soap gSOAP context@param[in] businessService business serviceCreates an instance of the save_USCOREservice class using the specifiedservice.*//**@fn uddi2__save_USCOREservice::uddi2__save_USCOREservice(struct soap *soap, std::vector<uddi2__businessService*> businessServices)@brief@param[in] soap gSOAP context@param[in] businessServices collection of business servicesCreates an instance of the save_USCOREservice class using the specifiedservices.*//**@fn uddi2__serviceDetail *uddi2__save_USCOREservice::send(const char *endpoint, char *authInfo)@brief@param[in] endpoint URL of the UDDI server@param[in] authInfo authorization token provided by the UDDI server@return A pointer to a uddi2__serviceDetail object or NULL on errorSend a request to a UDDI server to post service information on the server.*///////////////////////////////////////////////////////////////////////////////////// uddi2:save_tModel///////////////////////////////////////////////////////////////////////////////////**@class uddi2__save_USCOREtModel@briefRepresents a request to post tModel information on a UDDI server.See @url http://uddi.org/pubs/ProgrammersAPI_v2.htm#_Toc25137745*//**@fn uddi2__save_USCOREtModel::uddi2__save_USCOREtModel(struct soap *soap)@brief@param[in] soap gSOAP contextCreates an instance of the save_USCOREtModel class.*//**@fn uddi2__save_USCOREtModel::uddi2__save_USCOREtModel(struct soap *soap, uddi2__tModel &tModel)@brief@param[in] soap gSOAP context@param[in] tModel a tModelCreates an instance of the save_USCOREtModel class using the specifiedtModel.*//**@fn uddi2__save_USCOREtModel::uddi2__save_USCOREtModel(struct soap *soap, std::vector<uddi2__tModel*> tModels)@brief@param[in] soap gSOAP context@param[in] tModels collection of tModelsCreates an instance of the save_USCOREtModel class using the specifiedtModels.*//**@fn uddi2__tModelDetail *uddi2__save_USCOREtModel::send(const char *endpoint, char *authInfo)@brief@param[in] endpoint URL of the UDDI server@param[in] authInfo authorization token provided by the UDDI server@return A pointer to a uddi2__tModelDetail object or NULL on errorSend a request to a UDDI server to post tModel information on the server.*///////////////////////////////////////////////////////////////////////////////////// uddi2:set_publisherAssertions///////////////////////////////////////////////////////////////////////////////////**@class uddi2__set_USCOREpublisherAssertions@briefRepresents a request to modify the existing publisher assertions for anindividual publisher.See @url http://uddi.org/pubs/ProgrammersAPI_v2.htm#_Toc25137746*//**@fn uddi2__set_USCOREpublisherAssertions::uddi2__set_USCOREpublisherAssertions(struct soap *soap)@brief@param[in] soap gSOAP contextCreates an instance of the set_USCOREpublisherAssertions class.*//**@fn uddi2__set_USCOREpublisherAssertions::uddi2__set_USCOREpublisherAssertions(struct soap *soap, std::vector<uddi2__publisherAssertion*> publisherAssertions)@brief@param[in] soap gSOAP context@param[in] publisherAssertions collection of publisher assertionsCreates an instance of the set_USCOREpublisherAssertions class using thespecified collection of publisher assertions.*//**@fn uddi2__publisherAssertions *uddi2__set_USCOREpublisherAssertions::send(const char *endpoint, char *authInfo)@brief@param[in] endpoint URL of the UDDI server@param[in] authInfo authorization token provided by the UDDI server@return A pointer to a uddi2__publisherAssertions object or NULL on errorSend a request to a UDDI server to post tModel information on the server.*///////////////////////////////////////////////////////////////////////////////////// Code Examples///////////////////////////////////////////////////////////////////////////////////**@page example1 Code Example 1: Finding a serviceThis example shows you how to find Web services. In this case, the examplefinds Web services with names that begin with the word "magic".@code#include "inqH.h"int main(int argc, char **argv){ char *search_string = "magic"; if (argc > 1) search_string = argv[1]; // Create a gSOAP context struct soap *soap = soap_new(); // Create an object to find a business uddi2__find_USCOREservice fs(soap, search_string); // Send the request uddi2__serviceList *sl = fs.send("http://uddi.xmethods.net/inquire"); // Check if result is OK if (!sl) soap_print_fault(soap, stderr); // If OK, report the service name(s) and unique identification keys else if (sl->serviceInfos) { std::cout << "Search results on " << search_string << ":" << std::endl << std::endl; for (std::vector<uddi2__serviceInfo*>::const_iterator si = sl->serviceInfos->serviceInfo.begin(); si != sl->serviceInfos->serviceInfo.end(); ++si) { // Report serviceKey and businessKey std::cout << "serviceKey=" << (*si)->serviceKey << std::endl << "businessKey=" << (*si)->businessKey << std::endl; // Report names for (std::vector<uddi2__name*>::const_iterator n = (*si)->name.begin(); n != (*si)->name.end(); ++n) std::cout << "name=" << (*n)->__item << std::endl; std::cout << std::endl; } } // Remove deserialized objects soap_destroy(soap); // Remove temporary data soap_end(soap); // Detach and free context soap_done(soap); free(soap); return 0;}@endcodeTo compile:- wsdl2h -tuddi2-typemap.dat inquire_v2.wsdl- soapcpp2 -I.. -pinq inquire_v2.h- g++ -DWITH_NONAMESPACES -I.. -o example1 example1.cpp inquire_v2.cpp inqC.cpp inqClient.cpp ../stdsoap2.cpp*//**@page example2 Code Example 2: Finding a businessThis example shows you how to find a business from a UDDI server.@code#include "inqH.h"int main(int argc, char **argv){ char *search_string = "xmethods"; if (argc > 1) search_string = argv[1]; // Create a gSOAP context struct soap *soap = soap_new(); // Create an object to find a business uddi2__find_USCOREbusiness fb(soap, search_string); // Send the request uddi2__businessList *bl = fb.send("http://uddi.xmethods.net/inquire"); // Check if result is OK if (!bl) soap_print_fault(soap, stderr); // If OK, report the business name(s) and unique identification keys else if (bl->businessInfos) { std::cout << "Search results on " << search_string << ":" << std::endl << std::endl; for (std::vector<uddi2__businessInfo*>::const_iterator bi = bl->businessInfos->businessInfo.begin(); bi != bl->businessInfos->businessInfo.end(); ++bi) { // Report businessKey std::cout << "businessKey=" << (*bi)->businessKey << std::endl; // Report names for (std::vector<uddi2__name*>::const_iterator n = (*bi)->name.begin(); n != (*bi)->name.end(); ++n) std::cout << "name=" << (*n)->__item << std::endl; std::cout << std::endl; } } // Remove deserialized objects soap_destroy(soap); // Remove temporary data soap_end(soap); // Detach and free context soap_done(soap); free(soap); return 0;}@endcodeTo compile:- wsdl2h -tuddi2-typemap.dat inquire_v2.wsdl- soapcpp2 -I.. -pinq inquire_v2.h- g++ -DWITH_NONAMESPACES -I.. -o example2 example2.cpp inquire_v2.cpp inqC.cpp inqClient.cpp ../stdsoap2.cpp*//**@page example3 Code Example 3: Publishing a WSDL and service on XMethodsThis example shows you how to publish a Web service. In this case, the exampletemplate code obtains an authorization token, saves the tModel with the WSDLURL in the server, and saves the business service information in the server.@code#include "pubH.h"const char *server = "https://uddi.xmethods.net/publish";const char *userid = "..."; // user ID to access UDDI serverconst char *passwd = "..."; // password to access UDDI serverint main(int argc, char **argv){ // Create a gSOAP context struct soap *soap = soap_new(); // Setup SSL context (optional) to verify server's credentials if (soap_ssl_client_context(soap, SOAP_SSL_DEFAULT, NULL, NULL, "cacerts.pem", NULL, NULL)) { soap_print_fault(soap, stderr); exit(1); } // Step 1: Get an authorization token from the UDDI server uddi2__get_USCOREauthToken get_authToken(soap, userid, passwd); uddi2__authToken *authToken = get_authToken.send(server); // Check if authorized if (!authToken) { soap_print_fault(soap, stderr); exit(1); } // Authorization info provided by server for this session char *authInfo = authToken->authInfo; // Step 2: Create a tModel for the WSDL to be published uddi2__tModel tModel; tModel.soap_default(soap); // Create the tModel and service name tModel.name = soap_new_uddi2__name(soap, -1); tModel.name->__item = "..."; tModel.name->xml__lang_ = "en"; // Create XMethods description elements (see http://www.xmethods.net/ve2/UDDI.po) uddi2__description *description = soap_new_uddi2__description(soap, 6); description[0].__item = "SHORT DESCRIPTION: ..."; description[0].xml__lang_ = "en"; description[1].__item = "SHORT DESCRIPTION: ..."; description[1].xml__lang_ = "en"; description[2].__item = "USAGE NOTES: ..."; description[2].xml__lang_ = "en"; description[3].__item = "HOMEPAGE URL: ..."; description[3].xml__lang_ = "en"; description[4].__item = "CONTACT EMAIL: ..."; description[4].xml__lang_ = "en"; description[5].__item = "IMPLEMENTATION: ..."; description[5].xml__lang_ = "en"; // Add the four description elements to the tModel tModel.description.push_back(description + 0); tModel.description.push_back(description + 1); tModel.description.push_back(description + 2); tModel.description.push_back(description + 4); // Add an overviewDoc element with description and overviewURL tModel.overviewDoc = soap_new_uddi2__overviewDoc(soap, -1); tModel.overviewDoc->soap_default(soap); tModel.overviewDoc->description.push_back(soap_new_uddi2__description(soap, -1)); tModel.overviewDoc->description[0]->__item = "WSDL source document"; tModel.overviewDoc->description[0]->xml__lang_ = "en"; tModel.overviewDoc->overviewURL = "http://.../my.wsdl#bindingName"; // Omit identifier bag tModel.identifierBag = NULL; // Add a category with a WSDL-specific keyedReference tModel.categoryBag = soap_new_uddi2__categoryBag(soap, -1); tModel.categoryBag->soap_default(soap); tModel.categoryBag->keyedReference.push_back(soap_new_uddi2__keyedReference(soap, -1)); tModel.categoryBag->keyedReference[0]->tModelKey = "..."; tModel.categoryBag->keyedReference[0]->keyName = "uddi-org:types"; tModel.categoryBag->keyedReference[0]->keyValue = "wsdlSpec"; tModel.authorizedName = "..."; tModel.operator_ = "..."; tModel.tModelKey = "..."; // Save the tModel uddi2__save_USCOREtModel save_tModel(soap, tModel); uddi2__tModelDetail *tModelDetail = save_tModel.send(server, authInfo); // Step 3: Create a new service to be published uddi2__businessService service; service.soap_default(soap); // Service name is the tModel name (XMethods) service.name.push_back(tModel.name); // Add two description elements to the service service.description.push_back(description + 4); service.description.push_back(description + 5); // Create binding template uddi2__bindingTemplate bindingTemplate; bindingTemplate.soap_default(soap); bindingTemplate.tModelInstanceDetails = soap_new_uddi2__tModelInstanceDetails(soap, -1); bindingTemplate.tModelInstanceDetails->tModelInstanceInfo.push_back(soap_new_uddi2__tModelInstanceInfo(soap, -1)); bindingTemplate.tModelInstanceDetails->tModelInstanceInfo[0]->instanceDetails = NULL; bindingTemplate.tModelInstanceDetails->tModelInstanceInfo[0]->tModelKey = tModel.tModelKey; bindingTemplate.accessPoint = soap_new_uddi2__accessPoint(soap, -1); bindingTemplate.accessPoint->__item = "..."; bindingTemplate.accessPoint->URLType = uddi2__URLType__http; bindingTemplate.hostingRedirector = NULL; bindingTemplate.serviceKey = "..."; bindingTemplate.bindingKey = "..."; // Add binding Template to service service.bindingTemplates = soap_new_uddi2__bindingTemplates(soap, -1); service.bindingTemplates->soap_default(soap); service.bindingTemplates->bindingTemplate.push_back(&bindingTemplate); service.categoryBag = NULL; service.serviceKey = "..."; service.businessKey = "..."; // Save the service uddi2__save_USCOREservice save_service(soap, service); uddi2__serviceDetail *serviceDetail = save_service.send(server, authInfo); // Step 4: Discard authorization token uddi2__discard_USCOREauthToken discard_authToken(soap, authInfo); uddi2__dispositionReport *dispositionReport = discard_authToken.send(server); // Remove deserialized objects soap_destroy(soap);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -