Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1654 lines
45 KiB

  1. using System;
  2. using UDDI;
  3. using System.Data;
  4. using System.Collections;
  5. using System.Collections.Specialized;
  6. using System.ComponentModel;
  7. using System.Data.SqlClient;
  8. using System.Xml.Serialization;
  9. using UDDI.API.Binding;
  10. using UDDI.Replication;
  11. using UDDI.API.ServiceType;
  12. using UDDI.Diagnostics;
  13. namespace UDDI.API.Service
  14. {
  15. /// ********************************************************************
  16. /// class BusinessService
  17. /// --------------------------------------------------------------------
  18. /// <summary>
  19. /// </summary>
  20. /// ********************************************************************
  21. ///
  22. [XmlRootAttribute( "businessService", Namespace=UDDI.API.Constants.Namespace )]
  23. public class BusinessService : EntityBase
  24. {
  25. //
  26. // Attribute: serviceKey
  27. //
  28. [XmlAttribute("serviceKey")]
  29. public string ServiceKey = "";
  30. //
  31. // Attribute: businessKey
  32. //
  33. [XmlAttribute("businessKey")]
  34. public string BusinessKey = "";
  35. //
  36. // Element: name
  37. //
  38. private NameCollection names;
  39. [XmlElement("name")]
  40. public NameCollection Names
  41. {
  42. get
  43. {
  44. if( null == names )
  45. names = new NameCollection();
  46. return names;
  47. }
  48. set { names = value; }
  49. }
  50. //
  51. // Element: description
  52. //
  53. private DescriptionCollection descriptions;
  54. [XmlElement("description")]
  55. public DescriptionCollection Descriptions
  56. {
  57. get
  58. {
  59. if( null == descriptions )
  60. descriptions = new DescriptionCollection();
  61. return descriptions;
  62. }
  63. set { descriptions = value; }
  64. }
  65. //
  66. // Element: bindingTemplates
  67. //
  68. [ XmlIgnore ]
  69. public BindingTemplateCollection BindingTemplates = new BindingTemplateCollection();
  70. [ XmlArray( "bindingTemplates" ), XmlArrayItem( "bindingTemplate" ) ]
  71. public BindingTemplate[] BindingTemplatesSerialize
  72. {
  73. get
  74. {
  75. //
  76. // Don't return an empty BindingTemplates collection if we are not using v1.0.
  77. //
  78. if( true == Utility.CollectionEmpty( BindingTemplates ) &&
  79. 1 != Context.ApiVersionMajor)
  80. {
  81. return null;
  82. }
  83. else
  84. {
  85. return BindingTemplates.ToArray();
  86. }
  87. }
  88. set
  89. {
  90. BindingTemplates.Clear();
  91. BindingTemplates.CopyTo( value );
  92. }
  93. }
  94. //
  95. // Element: categoryBag
  96. //
  97. [ XmlIgnore ]
  98. public KeyedReferenceCollection CategoryBag = new KeyedReferenceCollection();
  99. [ XmlArray( "categoryBag" ), XmlArrayItem( "keyedReference" ) ]
  100. public KeyedReference[] CategoryBagSerialize
  101. {
  102. get
  103. {
  104. if( Utility.CollectionEmpty( CategoryBag ) )
  105. return null;
  106. return CategoryBag.ToArray();
  107. }
  108. set
  109. {
  110. CategoryBag.Clear();
  111. CategoryBag.CopyTo( value );
  112. }
  113. }
  114. [XmlIgnore]
  115. public override UDDI.EntityType EntityType
  116. {
  117. get { return EntityType.BusinessService; }
  118. }
  119. [XmlIgnore]
  120. public override string EntityKey
  121. {
  122. get { return ServiceKey; }
  123. }
  124. /// ****************************************************************
  125. /// public BusinessService [constructor]
  126. /// ----------------------------------------------------------------
  127. /// <summary>
  128. /// </summary>
  129. /// ****************************************************************
  130. ///
  131. public BusinessService()
  132. {
  133. }
  134. /// ****************************************************************
  135. /// public BusinessService [constructor]
  136. /// ----------------------------------------------------------------
  137. /// <summary>
  138. /// </summary>
  139. /// ----------------------------------------------------------------
  140. /// <param name="serviceKey">
  141. /// </param>
  142. /// ****************************************************************
  143. ///
  144. public BusinessService( string serviceKey )
  145. {
  146. ServiceKey = serviceKey;
  147. }
  148. public BusinessService( string serviceKey, string businessKey )
  149. {
  150. ServiceKey = serviceKey;
  151. BusinessKey = businessKey;
  152. }
  153. /// ****************************************************************
  154. /// public Delete
  155. /// ----------------------------------------------------------------
  156. /// <summary>
  157. /// </summary>
  158. /// ****************************************************************
  159. ///
  160. public override void Delete()
  161. {
  162. SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor();
  163. sp.ProcedureName = "net_businessService_delete";
  164. sp.Parameters.Add( "@PUID", SqlDbType.NVarChar, UDDI.Constants.Lengths.UserID );
  165. sp.Parameters.Add( "@serviceKey", SqlDbType.UniqueIdentifier );
  166. sp.Parameters.Add( "@contextID", SqlDbType.UniqueIdentifier );
  167. sp.Parameters.SetGuid( "@contextID", Context.ContextID );
  168. sp.Parameters.SetString( "@PUID", Context.User.ID );
  169. sp.Parameters.SetGuidFromString( "@serviceKey", ServiceKey );
  170. sp.ExecuteNonQuery();
  171. //
  172. // Save the change log entry.
  173. //
  174. if( Context.LogChangeRecords )
  175. {
  176. ChangeRecord changeRecord = new ChangeRecord();
  177. changeRecord.Payload = new ChangeRecordDelete( EntityType.BusinessService, ServiceKey );
  178. changeRecord.Log();
  179. }
  180. }
  181. /// ****************************************************************
  182. /// public Get
  183. /// ----------------------------------------------------------------
  184. /// <summary>
  185. /// </summary>
  186. /// ****************************************************************
  187. ///
  188. public override void Get()
  189. {
  190. Debug.Enter();
  191. SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor( "net_businessService_get_batch" );
  192. sp.Parameters.Add( "@serviceKey", SqlDbType.UniqueIdentifier );
  193. sp.Parameters.Add( "@businessKey", SqlDbType.UniqueIdentifier, ParameterDirection.Output );
  194. sp.Parameters.SetGuidFromString( "@serviceKey", ServiceKey );
  195. SqlDataReaderAccessor reader = null;
  196. try
  197. {
  198. //
  199. // net_businessEntity_get will return the objects contained in a business in the following order:
  200. //
  201. // - descriptions
  202. // - names
  203. // - binding templates
  204. // - category bags
  205. reader = sp.ExecuteReader();
  206. //
  207. // Read the descriptions
  208. //
  209. Descriptions.Read( reader );
  210. //
  211. // Read the names
  212. //
  213. if( true == reader.NextResult() )
  214. {
  215. Names.Read( reader );
  216. }
  217. //
  218. // Read the binding templates
  219. //
  220. if( true == reader.NextResult() )
  221. {
  222. BindingTemplates.Read( reader );
  223. }
  224. //
  225. // Read the category bags
  226. //
  227. if( true == reader.NextResult() )
  228. {
  229. CategoryBag.Read( reader );
  230. }
  231. }
  232. finally
  233. {
  234. if( null != reader )
  235. {
  236. reader.Close();
  237. }
  238. }
  239. //
  240. // These calls will make separate sproc calls, so we have to close our reader first.
  241. //
  242. BindingTemplates.Populate();
  243. //
  244. // Output parameters
  245. //
  246. BusinessKey = sp.Parameters.GetGuidString( "@businessKey" );
  247. #if never
  248. SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor( "net_businessService_get" );
  249. sp.Parameters.Add( "@serviceKey", SqlDbType.UniqueIdentifier );
  250. sp.Parameters.Add( "@businessKey", SqlDbType.UniqueIdentifier, ParameterDirection.Output );
  251. sp.Parameters.SetGuidFromString( "@serviceKey", ServiceKey );
  252. sp.ExecuteNonQuery();
  253. BusinessKey = sp.Parameters.GetGuidString( "@businessKey" );
  254. //
  255. // Get all contained objects.
  256. //
  257. Descriptions.Get( ServiceKey, EntityType.BusinessService );
  258. Names.Get( ServiceKey, EntityType.BusinessService );
  259. BindingTemplates.Get( ServiceKey );
  260. CategoryBag.Get( ServiceKey, EntityType.BusinessService, KeyedReferenceType.CategoryBag );
  261. #endif
  262. QueryLog.Write( QueryType.Get, EntityType.BusinessService );
  263. Debug.Leave();
  264. }
  265. /// ****************************************************************
  266. /// internal InnerSave
  267. /// ----------------------------------------------------------------
  268. /// <summary>
  269. /// </summary>
  270. /// ----------------------------------------------------------------
  271. /// <param name="businessKey">
  272. /// </param>
  273. /// ****************************************************************
  274. ///
  275. internal void InnerSave( string businessKey )
  276. {
  277. Debug.Enter();
  278. if( IsServiceProjection( businessKey ) )
  279. {
  280. //
  281. // Make sure that service projections are enabled.
  282. //
  283. if( 0 == Config.GetInt( "Service.ServiceProjectionEnable", 1 ) )
  284. {
  285. // throw new UDDIException( UDDI.ErrorType.E_fatalError, "Service projections are not enabled" );
  286. throw new UDDIException( UDDI.ErrorType.E_fatalError, "UDDI_ERROR_SERVICE_PROJECTIONS_NOT_ENABLED" );
  287. }
  288. #if never
  289. Debug.Verify(
  290. !Utility.StringEmpty( ServiceKey ),
  291. "A valid serviceKey must be specified when saving a service projection" );
  292. #endif
  293. Debug.Verify(
  294. !Utility.StringEmpty( ServiceKey ),
  295. "UDDI_ERROR_INVALID_SERVICE_PROJECTION_KEY" );
  296. try
  297. {
  298. //
  299. // Save the service projection.
  300. //
  301. SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor( "net_serviceProjection_save" );
  302. sp.Parameters.Add( "@serviceKey", SqlDbType.UniqueIdentifier );
  303. sp.Parameters.Add( "@businessKey", SqlDbType.UniqueIdentifier );
  304. sp.Parameters.Add( "@lastChange", SqlDbType.BigInt );
  305. sp.Parameters.SetGuidFromString( "@serviceKey", ServiceKey );
  306. sp.Parameters.SetGuidFromString( "@businessKey", businessKey );
  307. sp.Parameters.SetLong( "@lastChange", DateTime.UtcNow.Ticks );
  308. sp.ExecuteNonQuery();
  309. //
  310. // Get all of the containing objects for this service; we'll return this information. Do this
  311. // in a try and ignore any exceptions because the projected service may not exist. It is not an
  312. // error to project to a non-existing service.
  313. //
  314. try
  315. {
  316. //
  317. // Clear out collections first. There might be data in these collections if the request
  318. // contained information about the service.
  319. //
  320. Names.Clear();
  321. Descriptions.Clear();
  322. BindingTemplates.Clear();
  323. CategoryBag.Clear();
  324. Get();
  325. }
  326. catch
  327. {
  328. //
  329. // Intentionally left blank.
  330. //
  331. }
  332. }
  333. catch( SqlException sqlException )
  334. {
  335. //
  336. // As per IN 60, we have to process service projection change records that refer to broken services.
  337. //
  338. if( sqlException.Number - UDDI.Constants.ErrorTypeSQLOffset == ( int ) ErrorType.E_invalidKeyPassed &&
  339. sqlException.Message.IndexOf( "serviceKey" ) >= 0 &&
  340. Context.ContextType == ContextType.Replication )
  341. {
  342. SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor( "net_serviceProjection_repl_save" );
  343. sp.Parameters.Add( "@serviceKey", SqlDbType.UniqueIdentifier );
  344. sp.Parameters.Add( "@businessKey", SqlDbType.UniqueIdentifier );
  345. sp.Parameters.Add( "@businessKey2", SqlDbType.UniqueIdentifier );
  346. sp.Parameters.Add( "@lastChange", SqlDbType.BigInt );
  347. sp.Parameters.SetGuidFromString( "@serviceKey", ServiceKey );
  348. sp.Parameters.SetGuidFromString( "@businessKey", businessKey );
  349. sp.Parameters.SetGuidFromString( "@businessKey2", BusinessKey );
  350. sp.Parameters.SetLong( "@lastChange", DateTime.UtcNow.Ticks );
  351. sp.ExecuteNonQuery();
  352. //
  353. // Set our exception source
  354. //
  355. Context.ExceptionSource = ExceptionSource.BrokenServiceProjection;
  356. }
  357. else
  358. {
  359. Context.ExceptionSource = ExceptionSource.Other;
  360. }
  361. //
  362. // Re-throw the exception so replication can properly log it.
  363. //
  364. throw sqlException;
  365. }
  366. }
  367. else
  368. {
  369. //
  370. // If we are not saving a service projection, then we want to still validate our names collection before
  371. // saving our service, since the schema has made <name> optional in order to accomodate service projections.
  372. //
  373. Names.Validate();
  374. //
  375. // Save the contained business service.
  376. //
  377. BusinessKey = businessKey;
  378. if( Utility.StringEmpty( ServiceKey ) )
  379. ServiceKey = Guid.NewGuid().ToString();
  380. SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor( "net_businessService_save" );
  381. sp.Parameters.Add( "@PUID", SqlDbType.NVarChar, UDDI.Constants.Lengths.UserID );
  382. sp.Parameters.Add( "@serviceKey", SqlDbType.UniqueIdentifier );
  383. sp.Parameters.Add( "@businessKey", SqlDbType.UniqueIdentifier );
  384. sp.Parameters.Add( "@generic", SqlDbType.VarChar, UDDI.Constants.Lengths.generic );
  385. sp.Parameters.Add( "@contextID", SqlDbType.UniqueIdentifier );
  386. sp.Parameters.Add( "@lastChange", SqlDbType.BigInt );
  387. sp.Parameters.SetString( "@PUID", Context.User.ID );
  388. sp.Parameters.SetGuidFromString( "@serviceKey", ServiceKey );
  389. sp.Parameters.SetGuidFromString( "@businessKey", BusinessKey );
  390. sp.Parameters.SetString( "@generic", Constants.Version );
  391. sp.Parameters.SetGuid( "@contextID", Context.ContextID );
  392. sp.Parameters.SetLong( "@lastChange", DateTime.UtcNow.Ticks );
  393. sp.ExecuteNonQuery();
  394. //
  395. // Save all contained objects
  396. //
  397. Names.Save( ServiceKey, EntityType.BusinessService );
  398. Descriptions.Save( ServiceKey, EntityType.BusinessService );
  399. BindingTemplates.Save( ServiceKey );
  400. CategoryBag.Save( ServiceKey, EntityType.BusinessService, KeyedReferenceType.CategoryBag );
  401. }
  402. Debug.Leave();
  403. }
  404. /// ****************************************************************
  405. /// internal Validate
  406. /// ----------------------------------------------------------------
  407. /// <summary>
  408. /// </summary>
  409. /// ****************************************************************
  410. ///
  411. internal void Validate( string businessEntityBusinessKey )
  412. {
  413. Debug.Enter();
  414. //
  415. // We don't want to do this if our save was a service projection because in that case
  416. // the caller of this operation may or may not be the publisher of the service being
  417. // projected.
  418. //
  419. // If we are doing a service projection, then the business key will be the value of another businessEntity and
  420. // the serviceKey will be the value of the service in that entity that we want to project.
  421. //
  422. // Only do this check if this service is not a service projection.
  423. //
  424. if( false == IsServiceProjection( businessEntityBusinessKey ) )
  425. {
  426. //
  427. // We are not doing a service projection, so make sure the caller is the person who published
  428. // this service.
  429. //
  430. SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor( "net_businessService_validate" );
  431. sp.Parameters.Add( "@PUID", SqlDbType.NVarChar, UDDI.Constants.Lengths.UserID );
  432. sp.Parameters.Add( "@serviceKey", SqlDbType.UniqueIdentifier );
  433. sp.Parameters.Add( "@businessKey", SqlDbType.UniqueIdentifier );
  434. sp.Parameters.Add( "@flag", SqlDbType.Int );
  435. sp.Parameters.SetString( "@PUID", Context.User.ID );
  436. sp.Parameters.SetGuidFromString( "@serviceKey", ServiceKey );
  437. sp.Parameters.SetGuidFromString( "@businessKey", BusinessKey );
  438. if( Context.User.AllowPreassignedKeys )
  439. sp.Parameters.SetInt( "@flag", 1 );
  440. else
  441. sp.Parameters.SetInt( "@flag", 0 );
  442. //
  443. // The sproc will throw an exception if anything goes wrong
  444. //
  445. sp.ExecuteNonQuery();
  446. //
  447. // Validate all contained objects.
  448. //
  449. Names.Validate();
  450. Descriptions.Validate();
  451. BindingTemplates.Validate();
  452. CategoryBag.Validate( ServiceKey, KeyedReferenceType.CategoryBag );
  453. }
  454. else
  455. {
  456. //
  457. // Make sure that service projections are enabled.
  458. //
  459. if( 0 == Config.GetInt( "Service.ServiceProjectionEnable", 1 ) )
  460. {
  461. // throw new UDDIException( UDDI.ErrorType.E_fatalError, "Service projections are not enabled" );
  462. throw new UDDIException( UDDI.ErrorType.E_fatalError, "UDDI_ERROR_SERVICE_PROJECTIONS_NOT_ENABLED" );
  463. }
  464. //
  465. // Validation for a service projection is different than a regular service.
  466. //
  467. //
  468. // First check to see that we are using the version 2 API, service projections
  469. // are not supported in version 1.
  470. if( Context.ApiVersionMajor == 1 )
  471. {
  472. // throw new UDDIException( ErrorType.E_userMismatch, "Service projections are not supported using the version 1.0 API. Use version 2.0 or higher." );
  473. throw new UDDIException( UDDI.ErrorType.E_fatalError, "UDDI_ERROR_SERVICE_PROJECTIONS_NOT_ENABLED_FOR_VERSION" );
  474. }
  475. //
  476. // We need to check that the service being projected really belongs to the business key that was specified. It's ok
  477. // if the service does not exist, but it cannot belong to someone else (like us).
  478. //
  479. SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor( "net_serviceProjection_validate" );
  480. sp.Parameters.Add( "@serviceKey", SqlDbType.UniqueIdentifier );
  481. sp.Parameters.Add( "@businessKey", SqlDbType.UniqueIdentifier );
  482. sp.Parameters.SetGuidFromString( "@serviceKey", ServiceKey );
  483. sp.Parameters.SetGuidFromString( "@businessKey", BusinessKey );
  484. //
  485. // The sproc will throw an exception if anything goes wrong
  486. //
  487. try
  488. {
  489. sp.ExecuteNonQuery();
  490. }
  491. catch( System.Data.SqlClient.SqlException se )
  492. {
  493. switch ( se.Number - UDDI.Constants.ErrorTypeSQLOffset )
  494. {
  495. case (int) ErrorType.E_invalidKeyPassed :
  496. //
  497. // E_invalidKey: parent businessKey of service projection is not true owner
  498. //
  499. if( Context.ContextType == ContextType.Replication )
  500. {
  501. //
  502. //We are going to allow this under replication but write a warning
  503. //
  504. string message = "Service projection saved with invalid businessKey. serviceKey = " + ServiceKey.ToString() + "; businessKey = " + BusinessKey.ToString();
  505. Debug.Write( UDDI.Diagnostics.SeverityType.Warning, UDDI.Diagnostics.CategoryType.Data, message );
  506. }
  507. else
  508. {
  509. //
  510. // re-throw error if not running in replication
  511. //
  512. throw se;
  513. }
  514. break;
  515. default:
  516. throw se;
  517. }
  518. }
  519. catch( Exception e )
  520. {
  521. throw e;
  522. }
  523. }
  524. Debug.Leave();
  525. }
  526. /// ****************************************************************
  527. /// public Save
  528. /// ----------------------------------------------------------------
  529. /// <summary>
  530. /// </summary>
  531. /// ****************************************************************
  532. ///
  533. public override void Save()
  534. {
  535. Validate( this.BusinessKey );
  536. InnerSave( this.BusinessKey );
  537. //
  538. // Save the change log entry.
  539. //
  540. if( Context.LogChangeRecords )
  541. {
  542. //
  543. // If we used a V1 API message, make sure to add in language codes for the names. We will
  544. // then take these names out after we save the change record.
  545. //
  546. if( 1 == Context.ApiVersionMajor )
  547. {
  548. foreach( Name name in Names )
  549. {
  550. name.IsoLangCode = Context.User.IsoLangCode;
  551. }
  552. }
  553. ChangeRecord changeRecord = new ChangeRecord();
  554. changeRecord.Payload = new ChangeRecordNewData( this );
  555. changeRecord.Log();
  556. //
  557. // Take out language names if we are using V1.
  558. //
  559. if( 1 == Context.ApiVersionMajor )
  560. {
  561. foreach( Name name in Names )
  562. {
  563. name.IsoLangCode = null;
  564. }
  565. }
  566. }
  567. }
  568. //
  569. // TODO: is this the best way to determine that this is a service project?
  570. //
  571. private bool IsServiceProjection( string businessEntityBusinessKey )
  572. {
  573. //
  574. // If the business key in the service does not match the key
  575. // of the business entity saving it, this is a service
  576. // projection.
  577. //
  578. if( !Utility.StringEmpty( BusinessKey )
  579. && 0 != String.Compare( BusinessKey, businessEntityBusinessKey, true ) )
  580. {
  581. return true;
  582. }
  583. else
  584. {
  585. return false;
  586. }
  587. }
  588. }
  589. public class BusinessServiceCollection : CollectionBase
  590. {
  591. public BusinessService this[int index]
  592. {
  593. get { return (BusinessService)List[index]; }
  594. set { List[index] = value; }
  595. }
  596. internal void Validate( string businessKey )
  597. {
  598. foreach( BusinessService service in this )
  599. {
  600. service.Validate( businessKey );
  601. }
  602. }
  603. public void Save( string businessKey )
  604. {
  605. //
  606. // Implement IN92 restriction which states:
  607. // "A service must not contain a service and a service projection to this service. As a result, a service
  608. // cannot be moved to a BE that already has a projection to that service. Regardless of the order of operation,
  609. // a service and a service projection can never appear under the same business. Implementations are required to
  610. // reject and return an E_fatalError during a save_business operation. Should a changeRecord be processed via
  611. // the replication stream with a business containing a service and a service projection to that same service,
  612. // this occurrence will result in the processing node throwing an error and halting replication."
  613. //
  614. for( int i=0; i < this.Count; i++ )
  615. {
  616. if( !Utility.StringEmpty( this[ i ].BusinessKey ) && 0 != String.Compare( this[ i ].BusinessKey, businessKey, true ) )
  617. {
  618. //
  619. // Current service is a service projection
  620. // Check all the other services to see if the same service is being saved elsewhere
  621. //
  622. for( int j=0; j < this.Count; j++ )
  623. {
  624. if( j == i )
  625. {
  626. continue;
  627. }
  628. if( 0 == String.Compare( this[ j ].ServiceKey, this[ i ].ServiceKey, true )
  629. && ( !Utility.StringEmpty( this[ j ].BusinessKey ) && 0 == String.Compare( this[ j ].BusinessKey, businessKey, true ) ) )
  630. {
  631. //
  632. // The serviceKey of a projection has been used a second time in the body of a save
  633. // This second use is not a service project itself, and should therefore be rejected
  634. //
  635. //throw new UDDIException( UDDI.ErrorType.E_fatalError, "The serviceKey associated with a service projection cannot be referenced in a subsequent serviceDetail that is not itself a service projection. serviceKey = " + this[ i ].ServiceKey );
  636. throw new UDDIException( UDDI.ErrorType.E_fatalError, "UDDI_ERROR_INVALID_SERVICEKEY_FOR_PROJECTION", this[ i ].ServiceKey );
  637. }
  638. }
  639. }
  640. }
  641. foreach( BusinessService service in this )
  642. {
  643. service.InnerSave( businessKey );
  644. }
  645. }
  646. public void Get( string businessKey )
  647. {
  648. //
  649. // Retrieve the core information for this business
  650. //
  651. SqlStoredProcedureAccessor cmd = new SqlStoredProcedureAccessor( "net_businessEntity_businessServices_get" );
  652. //
  653. // Add parameters and set values
  654. //
  655. cmd.Parameters.Add( "@businessKey", SqlDbType.UniqueIdentifier );
  656. cmd.Parameters.SetGuidFromString( "@businessKey", businessKey );
  657. //
  658. // Execute query to retreive services for this businesskey
  659. //
  660. SqlDataReaderAccessor reader = cmd.ExecuteReader();
  661. try
  662. {
  663. Read( reader );
  664. #if never
  665. while( rdr.Read() )
  666. {
  667. //
  668. // Add a BusinessService object to the collection. We'll populate it
  669. // with the serviceKey (column 0) and a businessKey (column 1). The
  670. // businessKey will only have a meaningful value if this BusinessService is
  671. // a service projection, otherwise it will be null. We need this value now
  672. // because we might not be able to get any other information for this BusinessService
  673. // if it is a projection of a non-existant BusinessService.
  674. //
  675. if( false == rdr.IsDBNull ( 1 ) )
  676. {
  677. Add( rdr.GetGuid( 0 ).ToString(), rdr.GetGuid( 1 ).ToString() );
  678. }
  679. else
  680. {
  681. Add( rdr.GetGuid( 0 ).ToString(), null );
  682. }
  683. }
  684. #endif
  685. }
  686. finally
  687. {
  688. reader.Close();
  689. }
  690. Populate();
  691. #if never
  692. foreach( BusinessService service in this )
  693. {
  694. //
  695. // Get will throw an exception if this service is a service projection for service that no longer
  696. // exists. If that's the case, we'll eat the exception since we already have businessKey and serviceKey,
  697. // which is the only data that we need for this type of service projection.
  698. //
  699. try
  700. {
  701. service.Get();
  702. }
  703. catch( SqlException sqlException )
  704. {
  705. //
  706. // If we don't have a valid businessKey for this service, then the key really was invalid, so rethrow the
  707. // exception.
  708. //
  709. if( null == service.BusinessKey )
  710. {
  711. throw sqlException;
  712. }
  713. }
  714. }
  715. #endif
  716. }
  717. public void Read( SqlDataReaderAccessor reader )
  718. {
  719. while( reader.Read() )
  720. {
  721. //
  722. // Add a BusinessService object to the collection. We'll populate it
  723. // with the serviceKey (column 0) and a businessKey (column 1). The
  724. // businessKey will only have a meaningful value if this BusinessService is
  725. // a service projection, otherwise it will be null. We need this value now
  726. // because we might not be able to get any other information for this BusinessService
  727. // if it is a projection of a non-existant BusinessService.
  728. //
  729. if( false == reader.IsDBNull ( 1 ) )
  730. {
  731. Add( reader.GetGuidString( 0 ), reader.GetGuidString( 1 ) );
  732. }
  733. else
  734. {
  735. Add( reader.GetGuidString( 0 ), null );
  736. }
  737. }
  738. }
  739. public void Populate()
  740. {
  741. foreach( BusinessService service in this )
  742. {
  743. //
  744. // Get will throw an exception if this service is a service projection for service that no longer
  745. // exists. If that's the case, we'll eat the exception since we already have businessKey and serviceKey,
  746. // which is the only data that we need for this type of service projection.
  747. //
  748. try
  749. {
  750. service.Get();
  751. }
  752. catch( SqlException sqlException )
  753. {
  754. //
  755. // If we don't have a valid businessKey for this service, then the key really was invalid, so rethrow the
  756. // exception.
  757. //
  758. if( null == service.BusinessKey )
  759. {
  760. throw sqlException;
  761. }
  762. }
  763. }
  764. }
  765. public int Add()
  766. {
  767. return List.Add( new BusinessService() );
  768. }
  769. public int Add(BusinessService value)
  770. {
  771. return List.Add(value);
  772. }
  773. public int Add( string serviceKey, string businessKey )
  774. {
  775. return List.Add( new BusinessService( serviceKey, businessKey ) );
  776. }
  777. public int Add( string serviceKey )
  778. {
  779. return List.Add( new BusinessService( serviceKey ) );
  780. }
  781. public void Insert(int index, BusinessService value)
  782. {
  783. List.Insert(index, value);
  784. }
  785. public int IndexOf(BusinessService value)
  786. {
  787. return List.IndexOf(value);
  788. }
  789. public bool Contains(BusinessService value)
  790. {
  791. return List.Contains(value);
  792. }
  793. public void Remove(BusinessService value)
  794. {
  795. List.Remove(value);
  796. }
  797. public void CopyTo( BusinessService[] array )
  798. {
  799. foreach( BusinessService service in array )
  800. Add( service );
  801. }
  802. public BusinessService[] ToArray()
  803. {
  804. return (BusinessService[])InnerList.ToArray( typeof( BusinessService ) );
  805. }
  806. public void Sort()
  807. {
  808. InnerList.Sort( new BusinessServiceComparer() );
  809. }
  810. internal class BusinessServiceComparer : IComparer
  811. {
  812. public int Compare( object x, object y )
  813. {
  814. BusinessService entity1 = (BusinessService)x;
  815. BusinessService entity2 = (BusinessService)y;
  816. //
  817. // Service projections might not have names
  818. //
  819. if( 0 == entity1.Names.Count && 0 == entity2.Names.Count )
  820. {
  821. return 0;
  822. }
  823. else if ( 0 == entity1.Names.Count )
  824. {
  825. return -1;
  826. }
  827. else if ( 0 == entity2.Names.Count )
  828. {
  829. return 1;
  830. }
  831. else
  832. {
  833. return string.Compare( entity1.Names[ 0 ].Value, entity2.Names[ 0 ].Value, true );
  834. }
  835. }
  836. }
  837. }
  838. public class ServiceInfoCollection : CollectionBase
  839. {
  840. public void Get( string businessKey )
  841. {
  842. SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor( "net_businessEntity_businessServices_get" );
  843. sp.Parameters.Add( "@businessKey", SqlDbType.UniqueIdentifier );
  844. sp.Parameters.SetGuidFromString( "@businessKey", businessKey );
  845. SqlDataReaderAccessor reader = sp.ExecuteReader();
  846. try
  847. {
  848. Read( reader );
  849. }
  850. finally
  851. {
  852. reader.Close();
  853. }
  854. Populate();
  855. #if never
  856. SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor( "net_businessEntity_businessServices_get" );
  857. sp.Parameters.Add( "@businessKey", SqlDbType.UniqueIdentifier );
  858. sp.Parameters.SetGuidFromString( "@businessKey", businessKey );
  859. SqlDataReaderAccessor reader = sp.ExecuteReader();
  860. try
  861. {
  862. while( reader.Read() )
  863. {
  864. //
  865. // Add a ServiceInfo object to the collection. We'll populate it
  866. // with the serviceKey (column 0) and a businessKey (column 1). The
  867. // businessKey will only have a meaningful value if the BusinessService this ServiceInfo refers
  868. // to is a service projection, otherwise it will be null. We need this value now
  869. // because we might not be able to get any other information for this BusinessService
  870. // if it is a projection of a non-existant BusinessService.
  871. //
  872. Add( reader.GetGuidString( 0 ) , reader.GetGuidString( 1 ) );
  873. }
  874. }
  875. finally
  876. {
  877. reader.Close();
  878. }
  879. //
  880. // Get the details for each service info.
  881. //
  882. foreach( ServiceInfo serviceInfo in this )
  883. {
  884. //
  885. // Get will throw an exception if this service is a service projection for service that no longer
  886. // exists. If that's the case, we'll eat the exception since we already have businessKey and serviceKey,
  887. // which is the only data that we need for this type of service projection.
  888. //
  889. try
  890. {
  891. serviceInfo.Get();
  892. }
  893. catch( SqlException sqlException )
  894. {
  895. //
  896. // If we don't have a valid businessKey for this service, then the key really was invalid, so rethrow the
  897. // exception.
  898. //
  899. if( null == serviceInfo.BusinessKey )
  900. {
  901. throw sqlException;
  902. }
  903. }
  904. }
  905. #endif
  906. }
  907. public void Read( SqlDataReaderAccessor reader )
  908. {
  909. while( reader.Read() )
  910. {
  911. //
  912. // Add a ServiceInfo object to the collection. We'll populate it
  913. // with the serviceKey (column 0) and a businessKey (column 1). The
  914. // businessKey will only have a meaningful value if the BusinessService this ServiceInfo refers
  915. // to is a service projection, otherwise it will be null. We need this value now
  916. // because we might not be able to get any other information for this BusinessService
  917. // if it is a projection of a non-existant BusinessService.
  918. //
  919. if( false == reader.IsDBNull ( 1 ) )
  920. {
  921. Add( reader.GetGuidString( 0 ), reader.GetGuidString( 1 ) );
  922. }
  923. else
  924. {
  925. Add( reader.GetGuidString( 0 ), null );
  926. }
  927. }
  928. }
  929. public void Populate()
  930. {
  931. //
  932. // Get the details for each service info.
  933. //
  934. foreach( ServiceInfo serviceInfo in this )
  935. {
  936. //
  937. // Get will throw an exception if this service is a service projection for service that no longer
  938. // exists. If that's the case, we'll eat the exception since we already have businessKey and serviceKey,
  939. // which is the only data that we need for this type of service projection.
  940. //
  941. try
  942. {
  943. serviceInfo.Get();
  944. }
  945. catch( SqlException sqlException )
  946. {
  947. //
  948. // If we don't have a valid businessKey for this service, then the key really was invalid, so rethrow the
  949. // exception.
  950. //
  951. if( null == serviceInfo.BusinessKey )
  952. {
  953. throw sqlException;
  954. }
  955. }
  956. }
  957. }
  958. public ServiceInfo this[ int index ]
  959. {
  960. get { return (ServiceInfo)List[ index ]; }
  961. set { List[ index ] = value; }
  962. }
  963. public int Add()
  964. {
  965. return List.Add( new ServiceInfo() );
  966. }
  967. public int Add( string serviceKey, string businessKey )
  968. {
  969. return List.Add( new ServiceInfo( serviceKey, businessKey ) );
  970. }
  971. public int Add( ServiceInfo serviceInfo )
  972. {
  973. return List.Add( serviceInfo );
  974. }
  975. public void Insert( int index, ServiceInfo serviceInfo )
  976. {
  977. List.Insert( index, serviceInfo );
  978. }
  979. public int IndexOf( ServiceInfo serviceInfo )
  980. {
  981. return List.IndexOf( serviceInfo );
  982. }
  983. public bool Contains( ServiceInfo serviceInfo )
  984. {
  985. return List.Contains( serviceInfo );
  986. }
  987. public void Remove( ServiceInfo serviceInfo )
  988. {
  989. List.Remove( serviceInfo );
  990. }
  991. public void CopyTo( ServiceInfo[] array, int index )
  992. {
  993. List.CopyTo( array, index );
  994. }
  995. public void Sort()
  996. {
  997. InnerList.Sort( new ServiceInfoComparer() );
  998. }
  999. internal class ServiceInfoComparer : IComparer
  1000. {
  1001. public int Compare( object x, object y )
  1002. {
  1003. ServiceInfo entity1 = (ServiceInfo)x;
  1004. ServiceInfo entity2 = (ServiceInfo)y;
  1005. //
  1006. // Service projections might not have names
  1007. //
  1008. if( 0 == entity1.Names.Count && 0 == entity2.Names.Count )
  1009. {
  1010. return 0;
  1011. }
  1012. else if ( 0 == entity1.Names.Count )
  1013. {
  1014. return -1;
  1015. }
  1016. else if ( 0 == entity2.Names.Count )
  1017. {
  1018. return 1;
  1019. }
  1020. else
  1021. {
  1022. return string.Compare( entity1.Names[ 0 ].Value, entity2.Names[ 0 ].Value, true );
  1023. }
  1024. }
  1025. }
  1026. }
  1027. public class ServiceInfo
  1028. {
  1029. //
  1030. // Attribute: serviceKey
  1031. //
  1032. [XmlAttribute("serviceKey")]
  1033. public string ServiceKey;
  1034. //
  1035. // Attribute: businessKey
  1036. //
  1037. [XmlAttribute("businessKey")]
  1038. public string BusinessKey;
  1039. //
  1040. // Element: name
  1041. //
  1042. [XmlElement("name")]
  1043. public NameCollection Names = new NameCollection();
  1044. public ServiceInfo()
  1045. {
  1046. }
  1047. public ServiceInfo( string serviceKey, string businessKey )
  1048. {
  1049. ServiceKey = serviceKey;
  1050. BusinessKey = businessKey;
  1051. }
  1052. public void Get()
  1053. {
  1054. SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor( "net_serviceInfo_get_batch" );
  1055. sp.Parameters.Add( "@serviceKey", SqlDbType.UniqueIdentifier );
  1056. sp.Parameters.Add( "@businessKey", SqlDbType.UniqueIdentifier, ParameterDirection.Output );
  1057. sp.Parameters.SetGuidFromString( "@serviceKey", ServiceKey );
  1058. SqlDataReaderAccessor reader = null;
  1059. try
  1060. {
  1061. //
  1062. // net_serviceInfo_get_batch will return the objects contained in a business in the following order:
  1063. //
  1064. // - names
  1065. reader = sp.ExecuteReader();
  1066. //
  1067. // Read the names
  1068. //
  1069. Names.Read( reader );
  1070. }
  1071. finally
  1072. {
  1073. if( null != reader )
  1074. {
  1075. reader.Close();
  1076. }
  1077. }
  1078. //
  1079. // Output parameters
  1080. //
  1081. BusinessKey = sp.Parameters.GetGuidString( "@businessKey" );
  1082. #if never
  1083. SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor( "net_businessService_get" );
  1084. sp.Parameters.Add( "@serviceKey", SqlDbType.UniqueIdentifier );
  1085. sp.Parameters.Add( "@businessKey", SqlDbType.UniqueIdentifier, ParameterDirection.Output );
  1086. sp.Parameters.SetGuidFromString( "@serviceKey", ServiceKey );
  1087. sp.ExecuteNonQuery();
  1088. BusinessKey = sp.Parameters.GetGuidString( "@businessKey" );
  1089. //
  1090. // Get all contained objects.
  1091. //
  1092. Names.Get( ServiceKey, EntityType.BusinessService );
  1093. #endif
  1094. }
  1095. }
  1096. /// ****************************************************************
  1097. /// class DeleteService
  1098. /// ----------------------------------------------------------------
  1099. /// <summary>
  1100. /// The DeleteService class contains data and methods associated
  1101. /// with the delete_service message. It is typically populated
  1102. /// via deserialization by the .NET runtime as part of the
  1103. /// message processing interface.
  1104. ///
  1105. /// As part of the publisher API, this message implements
  1106. /// IAuthenticateable. This allows the enclosed authInfo to be
  1107. /// authorized prior to processing
  1108. /// </summary>
  1109. /// ****************************************************************
  1110. ///
  1111. [XmlRootAttribute( "delete_service", Namespace=UDDI.API.Constants.Namespace )]
  1112. public class DeleteService : IAuthenticateable, IMessage
  1113. {
  1114. //
  1115. // Attribute: generic
  1116. //
  1117. private string generic;
  1118. [XmlAttribute("generic")]
  1119. public string Generic
  1120. {
  1121. get { return generic; }
  1122. set { generic = value; }
  1123. }
  1124. //
  1125. // Element: authInfo
  1126. //
  1127. private string authInfo;
  1128. [XmlElement("authInfo")]
  1129. public string AuthInfo
  1130. {
  1131. get { return authInfo; }
  1132. set { authInfo = value; }
  1133. }
  1134. //
  1135. // Element: serviceKey
  1136. //
  1137. [XmlElement("serviceKey")]
  1138. public StringCollection ServiceKeys;
  1139. public void Delete()
  1140. {
  1141. foreach( string key in ServiceKeys )
  1142. {
  1143. BusinessService bs = new BusinessService( key );
  1144. bs.Delete();
  1145. }
  1146. }
  1147. }
  1148. [XmlRootAttribute("find_service", Namespace=UDDI.API.Constants.Namespace)]
  1149. public class FindService : IMessage
  1150. {
  1151. //
  1152. // Attribute: generic
  1153. //
  1154. private string generic;
  1155. [XmlAttribute("generic")]
  1156. public string Generic
  1157. {
  1158. get { return generic; }
  1159. set { generic = value; }
  1160. }
  1161. //
  1162. // Attribute: maxRows
  1163. //
  1164. private int maxRows = -1;
  1165. [XmlAttribute( "maxRows" ), DefaultValue( -1 )]
  1166. public int MaxRows
  1167. {
  1168. get { return maxRows; }
  1169. set
  1170. {
  1171. if( value < 0 )
  1172. {
  1173. // throw new UDDIException( ErrorType.E_fatalError, "maxRows must not be less than 0" );
  1174. throw new UDDIException( ErrorType.E_fatalError, "UDDI_ERROR_MAXROW_CANNOT_BE_LESS_THAN_0" );
  1175. }
  1176. maxRows = value;
  1177. }
  1178. }
  1179. [XmlAttribute("businessKey")]
  1180. public string BusinessKey;
  1181. [XmlArray("findQualifiers"), XmlArrayItem("findQualifier")]
  1182. public FindQualifierCollection FindQualifiers;
  1183. [XmlElement("name")]
  1184. public NameCollection Names = new NameCollection();
  1185. [XmlArray("categoryBag"), XmlArrayItem( "keyedReference" )]
  1186. public KeyedReferenceCollection CategoryBag;
  1187. [XmlArray("tModelBag"), XmlArrayItem("tModelKey")]
  1188. public StringCollection TModelBag;
  1189. public ServiceList Find()
  1190. {
  1191. ServiceList serviceList = new ServiceList();
  1192. QueryLog.Write( QueryType.Find, EntityType.BusinessService );
  1193. //
  1194. // Validate find parameters.
  1195. //
  1196. if( !Utility.StringEmpty( BusinessKey ) )
  1197. Utility.IsValidKey( EntityType.BusinessEntity, BusinessKey );
  1198. //
  1199. // Process each find constraint.
  1200. //
  1201. FindBuilder find = new FindBuilder( EntityType.BusinessService, FindQualifiers, BusinessKey );
  1202. //
  1203. // If no search arguments are given, search the whole thing. The arguments below are optional.
  1204. //
  1205. if( !Utility.CollectionEmpty( Names ) )
  1206. {
  1207. Names.ValidateForFind();
  1208. }
  1209. else
  1210. {
  1211. #if never
  1212. Debug.Verify( find.CaseSensitiveMatch == false && find.ExactNameMatch == false,
  1213. "Cannot specifiy find qualifiers on names without specifying names", ErrorType.E_unsupported );
  1214. #endif
  1215. Debug.Verify( find.CaseSensitiveMatch == false && find.ExactNameMatch == false,
  1216. "UDDI_ERROR_NO_NAME_ON_FIND_QUALIFIER",
  1217. ErrorType.E_unsupported );
  1218. }
  1219. //
  1220. // TODO: Override may be better for these calls to KeyedReference.Validate because no parent key is used
  1221. //
  1222. if( !Utility.CollectionEmpty( CategoryBag ) )
  1223. CategoryBag.Validate( "", KeyedReferenceType.CategoryBag );
  1224. try
  1225. {
  1226. int rows = 1;
  1227. //
  1228. // First validate all the keys, this will make sure any invalid keys are 'caught' beforehand.
  1229. //
  1230. foreach( string tModelKey in TModelBag )
  1231. {
  1232. Utility.IsValidKey( EntityType.TModel, tModelKey );
  1233. }
  1234. //
  1235. // Find entities with matching parent key.
  1236. //
  1237. if( !Utility.StringEmpty( BusinessKey ) )
  1238. rows = find.FindByParentKey( BusinessKey );
  1239. //
  1240. // Find entities with matching category bag items.
  1241. //
  1242. if( rows > 0 && !Utility.CollectionEmpty( CategoryBag ) )
  1243. rows = find.FindByKeyedReferences( KeyedReferenceType.CategoryBag, CategoryBag );
  1244. //
  1245. // Find entities with matching TModel bag items.
  1246. //
  1247. if( rows > 0 && !Utility.CollectionEmpty( TModelBag ) )
  1248. rows = find.FindByTModelBag( TModelBag );
  1249. //
  1250. // Find entities with matching names
  1251. //
  1252. if( rows > 0 && !Utility.CollectionEmpty( Names ) )
  1253. rows = find.FindByNames( Names );
  1254. //
  1255. // Process the find result set.
  1256. //
  1257. if( 0 == rows )
  1258. {
  1259. //
  1260. // Cleanup any temporary tables.
  1261. //
  1262. find.Abort();
  1263. }
  1264. else if( 0 == MaxRows )
  1265. {
  1266. serviceList.Truncated = Truncated.True;
  1267. return serviceList;
  1268. }
  1269. else
  1270. {
  1271. //
  1272. // Read in the find results.
  1273. //
  1274. SqlDataReaderAccessor reader;
  1275. SqlStoredProcedureAccessor sp;
  1276. sp = find.RetrieveResults( MaxRows );
  1277. reader = sp.ExecuteReader();
  1278. try
  1279. {
  1280. while( reader.Read() )
  1281. {
  1282. serviceList.ServiceInfos.Add(
  1283. reader.GetGuidString( "entityKey" ),
  1284. reader.GetGuidString( "parentEntityKey" ) );
  1285. }
  1286. }
  1287. finally
  1288. {
  1289. reader.Close();
  1290. }
  1291. if( sp.Parameters.GetBool( "@truncated" ) )
  1292. serviceList.Truncated = Truncated.True;
  1293. else
  1294. serviceList.Truncated = Truncated.False;
  1295. foreach( ServiceInfo serviceInfo in serviceList.ServiceInfos )
  1296. serviceInfo.Get();
  1297. }
  1298. }
  1299. catch( Exception )
  1300. {
  1301. find.Abort();
  1302. throw;
  1303. }
  1304. return serviceList;
  1305. }
  1306. }
  1307. /// ********************************************************************
  1308. /// public class GetServiceDetail
  1309. /// --------------------------------------------------------------------
  1310. /// <summary>
  1311. /// </summary>
  1312. /// ********************************************************************
  1313. ///
  1314. [XmlRootAttribute( "get_serviceDetail", Namespace=UDDI.API.Constants.Namespace )]
  1315. public class GetServiceDetail : IMessage
  1316. {
  1317. //
  1318. // Attribute: generic
  1319. //
  1320. private string generic;
  1321. [XmlAttribute("generic")]
  1322. public string Generic
  1323. {
  1324. get { return generic; }
  1325. set { generic = value; }
  1326. }
  1327. //
  1328. // Element: serviceKey
  1329. //
  1330. [XmlElement("serviceKey")]
  1331. public StringCollection ServiceKeys;
  1332. public GetServiceDetail()
  1333. {
  1334. }
  1335. }
  1336. /// ********************************************************************
  1337. /// public class SaveService
  1338. /// --------------------------------------------------------------------
  1339. /// <summary>
  1340. /// </summary>
  1341. /// ********************************************************************
  1342. ///
  1343. [XmlRootAttribute( "save_service", Namespace=UDDI.API.Constants.Namespace )]
  1344. public class SaveService : IAuthenticateable, IMessage
  1345. {
  1346. //
  1347. // Attribute: generic
  1348. //
  1349. private string generic;
  1350. [XmlAttribute("generic")]
  1351. public string Generic
  1352. {
  1353. get { return generic; }
  1354. set { generic = value; }
  1355. }
  1356. //
  1357. // Element: authInfo
  1358. //
  1359. private string authInfo;
  1360. [XmlElement("authInfo")]
  1361. public string AuthInfo
  1362. {
  1363. get { return authInfo; }
  1364. set { authInfo = value; }
  1365. }
  1366. //
  1367. // Element: businessService
  1368. //
  1369. [XmlElement("businessService")]
  1370. public BusinessServiceCollection BusinessServices;
  1371. /// ****************************************************************
  1372. /// public Save
  1373. /// ----------------------------------------------------------------
  1374. /// <summary>
  1375. /// </summary>
  1376. /// ****************************************************************
  1377. ///
  1378. public void Save()
  1379. {
  1380. foreach( BusinessService BusinessService in BusinessServices )
  1381. BusinessService.Save();
  1382. }
  1383. }
  1384. [XmlRootAttribute("serviceDetail", Namespace=UDDI.API.Constants.Namespace)]
  1385. public class ServiceDetail
  1386. {
  1387. [XmlAttribute("generic")]
  1388. public string Generic = UDDI.API.Constants.Version;
  1389. [XmlAttribute("operator")]
  1390. public string Operator = Config.GetString( "Operator" );
  1391. [XmlAttribute("truncated")]
  1392. public Truncated Truncated;
  1393. [XmlElement("businessService")]
  1394. public BusinessServiceCollection BusinessServices = new BusinessServiceCollection();
  1395. public void Get( StringCollection serviceKeys )
  1396. {
  1397. foreach( string key in serviceKeys )
  1398. {
  1399. int n = BusinessServices.Add( key );
  1400. BusinessServices[ n ].Get();
  1401. }
  1402. }
  1403. }
  1404. [XmlRootAttribute("serviceList", Namespace=UDDI.API.Constants.Namespace)]
  1405. public class ServiceList
  1406. {
  1407. //
  1408. // Attribute: generic
  1409. //
  1410. [XmlAttribute("generic")]
  1411. public string Generic = UDDI.API.Constants.Version;
  1412. //
  1413. // Attribute: operator
  1414. //
  1415. [XmlAttribute("operator")]
  1416. public string Operator = Config.GetString( "Operator" );
  1417. //
  1418. // Attribute: truncated
  1419. //
  1420. [XmlAttribute("truncated")]
  1421. public Truncated Truncated;
  1422. //
  1423. // Element: serviceInfos
  1424. //
  1425. private ServiceInfoCollection serviceInfos;
  1426. [ XmlArray( "serviceInfos" ), XmlArrayItem( "serviceInfo" ) ]
  1427. public ServiceInfoCollection ServiceInfos
  1428. {
  1429. get
  1430. {
  1431. if( null == serviceInfos )
  1432. serviceInfos = new ServiceInfoCollection();
  1433. return serviceInfos;
  1434. }
  1435. set { serviceInfos = value; }
  1436. }
  1437. }
  1438. }