Team Fortress 2 Source Code as on 22/4/2020
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.

1012 lines
29 KiB

  1. /*
  2. File: WSMethodInvocation.h
  3. Contains: WebServicesCore Method Invocation API
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (c) 2002 by Apple Computer, Inc., all rights reserved
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://developer.apple.com/bugreporter/
  9. */
  10. #ifndef __MIXEDMODE__
  11. #include <MixedMode.h>
  12. #endif
  13. #ifndef __CFSTRING__
  14. #include <CFString.h>
  15. #endif
  16. #ifndef __CFURL__
  17. #include <CFURL.h>
  18. #endif
  19. #ifndef __CFRUNLOOP__
  20. #include <CFRunLoop.h>
  21. #endif
  22. #ifndef __CFXMLPARSER__
  23. #include <CFXMLParser.h>
  24. #endif
  25. #ifndef __CFXMLNODE__
  26. #include <CFXMLNode.h>
  27. #endif
  28. /*
  29. WebServicesCore
  30. */
  31. /*
  32. WebServicesCore error codes
  33. */
  34. #if PRAGMA_ONCE
  35. #pragma once
  36. #endif
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40. #if PRAGMA_IMPORT
  41. #pragma import on
  42. #endif
  43. #if PRAGMA_STRUCT_ALIGN
  44. #pragma options align=mac68k
  45. #elif PRAGMA_STRUCT_PACKPUSH
  46. #pragma pack(push, 2)
  47. #elif PRAGMA_STRUCT_PACK
  48. #pragma pack(2)
  49. #endif
  50. #if PRAGMA_ENUM_ALWAYSINT
  51. #if defined(__fourbyteints__) && !__fourbyteints__
  52. #define __WSMETHODINVOCATION__RESTORE_TWOBYTEINTS
  53. #pragma fourbyteints on
  54. #endif
  55. #pragma enumsalwaysint on
  56. #elif PRAGMA_ENUM_OPTIONS
  57. #pragma option enum=int
  58. #elif PRAGMA_ENUM_PACK
  59. #if __option(pack_enums)
  60. #define __WSMETHODINVOCATION__RESTORE_PACKED_ENUMS
  61. #pragma options(!pack_enums)
  62. #endif
  63. #endif
  64. enum {
  65. errWSInternalError = -65793L, /* An internal framework error */
  66. errWSTransportError = -65794L, /* A network error occured */
  67. errWSParseError = -65795L, /* The server response wasn't valid XML */
  68. errWSTimeoutError = -65796L /* The invocation timed out */
  69. };
  70. /*
  71. * WSTypeID
  72. *
  73. * Discussion:
  74. * Internally, WebServicesCore uses the following enumeration when
  75. * serializing between CoreFoundation and XML types. Because CFTypes
  76. * are defined at runtime, it isn't always possible to produce a
  77. * static mapping to a particular CFTypeRef. This enum and
  78. * associated API allows for static determination of the expected
  79. * serialization.
  80. */
  81. enum WSTypeID {
  82. /*
  83. * No mapping is known for this type
  84. */
  85. eWSUnknownType = 0,
  86. /*
  87. * CFNullRef
  88. */
  89. eWSNullType = 1,
  90. /*
  91. * CFBooleanRef
  92. */
  93. eWSBooleanType = 2,
  94. /*
  95. * CFNumberRef for 8, 16, 32 bit integers
  96. */
  97. eWSIntegerType = 3,
  98. /*
  99. * CFNumberRef for long double real numbers
  100. */
  101. eWSDoubleType = 4,
  102. /*
  103. * CFStringRef
  104. */
  105. eWSStringType = 5,
  106. /*
  107. * CFDateRef
  108. */
  109. eWSDateType = 6,
  110. /*
  111. * CFDataRef
  112. */
  113. eWSDataType = 7,
  114. /*
  115. * CFArrayRef
  116. */
  117. eWSArrayType = 8,
  118. /*
  119. * CFDictionaryRef
  120. */
  121. eWSDictionaryType = 9
  122. };
  123. typedef enum WSTypeID WSTypeID;
  124. /*
  125. * WSGetWSTypeIDFromCFType()
  126. *
  127. * Discussion:
  128. * Returns the WSTypeID associated with CFTypeRef. There is not a
  129. * one to one mapping between CFTypeID and WSTypesID therefore an
  130. * actual instance of a CFType must be passed.
  131. *
  132. * Parameters:
  133. *
  134. * ref:
  135. * a CFTypeRef object
  136. *
  137. * Result:
  138. * the WSTypeID used in serializing the object. If no WSTypeID
  139. * matches, eWSUnknownType is returned.
  140. *
  141. * Availability:
  142. * Non-Carbon CFM: not available
  143. * CarbonLib: not available
  144. * Mac OS X: in version 10.2 and later
  145. */
  146. EXTERN_API_C( WSTypeID )
  147. WSGetWSTypeIDFromCFType(CFTypeRef ref);
  148. /*
  149. * WSGetCFTypeIDFromWSTypeID()
  150. *
  151. * Discussion:
  152. * Returns the CFTypeID that is associated with a given WSTypeID.
  153. * CFTypeIDs are only valid during a particular instance of a
  154. * process and should not be used as static values.
  155. *
  156. * Parameters:
  157. *
  158. * typeID:
  159. * a WSTypeID constant
  160. *
  161. * Result:
  162. * a CFTypeID, or 0 if not found
  163. *
  164. * Availability:
  165. * Non-Carbon CFM: not available
  166. * CarbonLib: not available
  167. * Mac OS X: in version 10.2 and later
  168. */
  169. EXTERN_API_C( CFTypeID )
  170. WSGetCFTypeIDFromWSTypeID(WSTypeID typeID);
  171. typedef CALLBACK_API( void *, WSClientContextRetainCallBackProcPtr )(void * info);
  172. typedef CALLBACK_API( void , WSClientContextReleaseCallBackProcPtr )(void * info);
  173. typedef CALLBACK_API( CFStringRef , WSClientContextCopyDescriptionCallBackProcPtr )(void * info);
  174. /*
  175. * WSClientContext
  176. *
  177. * Discussion:
  178. * Several calls in WebServicesCore take a callback with an optional
  179. * context pointer. The context is copied and the info pointer
  180. * retained. When the callback is made, the info pointer is passed
  181. * to the callback.
  182. */
  183. struct WSClientContext {
  184. /*
  185. * set to zero (0)
  186. */
  187. CFIndex version;
  188. /*
  189. * info pointer to be passed to the callback
  190. */
  191. void * info;
  192. /*
  193. * callback made on the info pointer. This field may be NULL.
  194. */
  195. WSClientContextRetainCallBackProcPtr retain;
  196. /*
  197. * callback made on the info pointer. This field may be NULL.
  198. */
  199. WSClientContextReleaseCallBackProcPtr release;
  200. /*
  201. * callback made on the info pointer. This field may be NULL.
  202. */
  203. WSClientContextCopyDescriptionCallBackProcPtr copyDescription;
  204. };
  205. typedef struct WSClientContext WSClientContext;
  206. /*
  207. Web Service protocol types. These constant strings specify the type
  208. of web service method invocation created. These are passed to
  209. WSMethodInvocationCreate.
  210. For information on these service types, see:
  211. XML-RPC: <http://www.xml-rpc.com/spec/>
  212. SOAP 1.1: <http://www.w3.org/TR/SOAP/>
  213. SOAP 1.2: <http://www.w3.org/2002/ws/>
  214. */
  215. extern CFStringRef kWSXMLRPCProtocol;
  216. extern CFStringRef kWSSOAP1999Protocol;
  217. extern CFStringRef kWSSOAP2001Protocol;
  218. /*
  219. Dictionary entry if the invocation result is not a fault. This is
  220. always available in method responses, although for SOAP messages,
  221. it may be more correctly to query the result dictionary for the
  222. specific field you're interested in. What this really means is
  223. that the dictionary returned by the invocation may contain more
  224. than one value, wherein the result data is duplicated several
  225. times. If you don't know what to ask for to dump the reply, you
  226. can ask for this key. If you do know what you want, you should
  227. request that field expliclty.
  228. You can also specify the name of the reply parameter in the
  229. invocation using kWSMethodInvocationResultParameterName. This will
  230. add an alias for the given name to the result dictionary such that
  231. kWSMethodInvocationResult will always return the correct
  232. parameter. (This won't work for multi-value returns, however.)
  233. */
  234. extern CFStringRef kWSMethodInvocationResult;
  235. /*
  236. Dictionary entries if the result is a fault
  237. */
  238. extern CFStringRef kWSFaultString; /* a CFString */
  239. extern CFStringRef kWSFaultCode; /* a CFNumber */
  240. extern CFStringRef kWSFaultExtra; /* a CFString or CFDictionary, or NULL */
  241. /*
  242. If the result is a fault, and if the value of kWSFaultString in
  243. the reply dictionary is kWSNetworkStreamFaultString, then
  244. kWSFaultExtra will be a dictionary indicating the network error
  245. and kWSFaultCode is ignored in this case. See
  246. <CoreFoundation/CFStream.h> for details on what the domain and
  247. error numbers mean.
  248. */
  249. extern CFStringRef kWSNetworkStreamFaultString;
  250. extern CFStringRef kWSStreamErrorMessage; /* A CFString (for debug purposes only) */
  251. extern CFStringRef kWSStreamErrorDomain; /* A CFNumberRef */
  252. extern CFStringRef kWSStreamErrorError; /* A CFNumberRef */
  253. /*
  254. For HTTP[S] based invocations, you can specify a CFHTTPMessageRef
  255. as a property which will be used instead of creating a new
  256. outgoing message. The CFHTTPMessageRef can contain header, proxy
  257. and authentication information. The body of the message will be
  258. ignored and replaced with the outgoing, serialized invocation.
  259. After the invocation has executed, you can retrieve a copy of the
  260. actual CFHTTPMessageRef, containing the details of the invocation
  261. using kWSHTTPResponseMessage. Attempting to retrieve the response
  262. message property before the invocation completes will result
  263. return NULL.
  264. See: <CFNetwork/CFHTTPMessage.h> for more information.
  265. */
  266. extern CFStringRef kWSHTTPMessage; /* CFHTTPMessageRef */
  267. extern CFStringRef kWSHTTPResponseMessage; /* CFHTTPMessageRef */
  268. /*
  269. To avoid having to create an entire CFHTTPMessageRef, these properties are
  270. individually settable. If they are set, they will override any CFHTTPMessageRef
  271. previously specified.
  272. */
  273. extern CFStringRef kWSHTTPVersion; /* "http/1.1" */
  274. extern CFStringRef kWSHTTPExtraHeaders; /* a CFDictionary of { key (CFString), val (CFString) } pairs */
  275. extern CFStringRef kWSHTTPProxy; /* CFURfRefL */
  276. extern CFStringRef kWSHTTPFollowsRedirects; /* kCFBooleanFalse */
  277. /*
  278. SOCKS proxy support. WSMethodInvocation uses the same flags as
  279. CFSocketStream.h in configuring SOCKS proxy support. You can set
  280. the kCFStreamPropertySOCKSProxy property on the invocation and the
  281. value will be applied to the underlying stream. See CFSocketStream.h
  282. for more information and valid keys.
  283. */
  284. /*
  285. These debugging flags will populate the WSInvocationResultRef
  286. with some potentially useful debugging output. The property
  287. name of the flag is the same as the the field in the result
  288. dictionary.
  289. */
  290. extern CFStringRef kWSDebugOutgoingHeaders; /* kCFBooleanFalse */
  291. extern CFStringRef kWSDebugOutgoingBody; /* kCFBooleanFalse */
  292. extern CFStringRef kWSDebugIncomingHeaders; /* kCFBooleanFalse */
  293. extern CFStringRef kWSDebugIncomingBody; /* kCFBooleanFalse */
  294. /*
  295. Extra properties for SOAP messages. These apply to the message
  296. namespace and format itself. Individual message elements can
  297. be modified using the kWSRecord constants below.
  298. */
  299. extern CFStringRef kWSSOAPMethodNamespaceURI; /* CFStringRef */
  300. extern CFStringRef kWSSOAPBodyEncodingStyle; /* CFStringRef { kWSSOAPStyleDoc, kWSSOAPStyleRPC } */
  301. extern CFStringRef kWSSOAPStyleDoc;
  302. extern CFStringRef kWSSOAPStyleRPC;
  303. /*
  304. For SOAP messages, this is an array of CFStringRefs which
  305. contain valid XML header elements that are sent with the
  306. message. These are only applicable to the Header of a SOAP
  307. message.
  308. */
  309. extern CFStringRef kWSSOAPMessageHeaders; /* CFArrayRef */
  310. /*
  311. When serializing a record (dictionary) these keys present in
  312. the dictionary can modify the behavior of the serialization.
  313. */
  314. extern CFStringRef kWSRecordParameterOrder; /* CFArrayRef of CFStringRef */
  315. extern CFStringRef kWSRecordNamespaceURI; /* CFStringRef */
  316. extern CFStringRef kWSRecordType; /* CFStringRef */
  317. /*
  318. Specifies that the result parameter will be found as this name. This
  319. forces the deserializer to alias the named output parameter to kWSMethodInvocationResult
  320. */
  321. extern CFStringRef kWSMethodInvocationResultParameterName;
  322. /*
  323. Specifies a timeout (as CFNumber) which specifies in seconds the
  324. amount of time to wait for the invocation to complete. If the
  325. invocation times out before the server results are returned,
  326. a fault will be returned with the error code errWSTimeoutError.
  327. */
  328. extern CFStringRef kWSMethodInvocationTimeoutValue;
  329. /*
  330. * WSMethodInvocationRef
  331. *
  332. * Discussion:
  333. * a WSMethodInvocationRef represents an object that can be executed
  334. * to obtain a rsult from a web service. This is CFType and is
  335. * therefore reference counted and and should be managed via
  336. * CFRetain and CFRelease.
  337. */
  338. typedef struct OpaqueWSMethodInvocationRef* WSMethodInvocationRef;
  339. /*
  340. * WSMethodInvocationGetTypeID()
  341. *
  342. * Availability:
  343. * Non-Carbon CFM: not available
  344. * CarbonLib: not available
  345. * Mac OS X: in version 10.2 and later
  346. */
  347. EXTERN_API_C( CFTypeID )
  348. WSMethodInvocationGetTypeID(void);
  349. /*
  350. * WSMethodInvocationCreate()
  351. *
  352. * Discussion:
  353. * Creates a web services method invocation object. This object may
  354. * be executed synchronously or scheduled on a run loop for
  355. * asynchronous execution.
  356. *
  357. * Parameters:
  358. *
  359. * url:
  360. * the endpoint of the service
  361. *
  362. * methodName:
  363. * the name of the method to be called
  364. *
  365. * protocol:
  366. * a string, defined above, that determines the type of invocation
  367. * object to create (XML-RPC vs. SOAP)
  368. *
  369. * Result:
  370. * A WSMethodInvocationRef object that can be passed to
  371. * WSMethodInvocationInvoke or scheduled with a run loop.
  372. *
  373. * Availability:
  374. * Non-Carbon CFM: not available
  375. * CarbonLib: not available
  376. * Mac OS X: in version 10.2 and later
  377. */
  378. EXTERN_API_C( WSMethodInvocationRef )
  379. WSMethodInvocationCreate(
  380. CFURLRef url,
  381. CFStringRef methodName,
  382. CFStringRef protocol);
  383. /*
  384. * WSMethodInvocationCreateFromSerialization()
  385. *
  386. * Discussion:
  387. * Creates a web services method invocation object from a previously
  388. * serialized contract.
  389. *
  390. * Parameters:
  391. *
  392. * contract:
  393. * the result of a previously serialized WSMethodInvocationRef
  394. *
  395. * Result:
  396. * A WSMethodInvocationRef object that can be passed to
  397. * WSMethodInvocationInvoke or scheduled with a run loop.
  398. *
  399. * Availability:
  400. * Non-Carbon CFM: not available
  401. * CarbonLib: not available
  402. * Mac OS X: in version 10.2 and later
  403. */
  404. EXTERN_API_C( WSMethodInvocationRef )
  405. WSMethodInvocationCreateFromSerialization(CFDataRef contract);
  406. /*
  407. * WSMethodInvocationCopySerialization()
  408. *
  409. * Discussion:
  410. * Create a serialized version of the Method Invocation which can be
  411. * reconstituted at a later time.
  412. *
  413. * Parameters:
  414. *
  415. * invocation:
  416. * the invocation to serialize
  417. *
  418. * Result:
  419. * a CFDataRef
  420. *
  421. * Availability:
  422. * Non-Carbon CFM: not available
  423. * CarbonLib: not available
  424. * Mac OS X: in version 10.2 and later
  425. */
  426. EXTERN_API_C( CFDataRef )
  427. WSMethodInvocationCopySerialization(WSMethodInvocationRef invocation);
  428. /*
  429. * WSMethodInvocationSetParameters()
  430. *
  431. * Discussion:
  432. * Set the parameters for a method invocation. The parameterOrder
  433. * may be NULL, in which case the order of th parameters is
  434. * undefined. If it is not NULL and the parameters dictionary
  435. * contains more parameters than are specified by the order, the
  436. * behavior is undefined. If the parameterOrder specifies more
  437. * parameters than are present in the dictionary, the result is
  438. * undefined.
  439. *
  440. * Parameters:
  441. *
  442. * invocation:
  443. * the invocation object
  444. *
  445. * parameters:
  446. * a CFDictionaryRef of CFString keys and CFTypeRef values.
  447. *
  448. * parameterOrder:
  449. * a CFArrayRef of CFString parameter names.
  450. *
  451. * Availability:
  452. * Non-Carbon CFM: not available
  453. * CarbonLib: not available
  454. * Mac OS X: in version 10.2 and later
  455. */
  456. EXTERN_API_C( void )
  457. WSMethodInvocationSetParameters(
  458. WSMethodInvocationRef invocation,
  459. CFDictionaryRef parameters,
  460. CFArrayRef parameterOrder); /* can be NULL */
  461. /*
  462. * WSMethodInvocationCopyParameters()
  463. *
  464. * Discussion:
  465. * Copies the parameters from the invocation. The resulting
  466. * dictionary contains the parameter dictionary. The parameterOrder
  467. * output parameter, if not NULL, will contain the order used to
  468. * serialize the parameters.
  469. *
  470. * Parameters:
  471. *
  472. * invocation:
  473. * the invocation
  474. *
  475. * parameterOrder:
  476. * a pointer to a CFArray which will will receive the names, in
  477. * their specified order, of the input parameter values. This
  478. * parameter may be NULL.
  479. *
  480. * Result:
  481. * a CFDictionaryRef
  482. *
  483. * Availability:
  484. * Non-Carbon CFM: not available
  485. * CarbonLib: not available
  486. * Mac OS X: in version 10.2 and later
  487. */
  488. EXTERN_API_C( CFDictionaryRef )
  489. WSMethodInvocationCopyParameters(
  490. WSMethodInvocationRef invocation,
  491. CFArrayRef * parameterOrder); /* can be NULL */
  492. /*
  493. * WSMethodInvocationSetProperty()
  494. *
  495. * Discussion:
  496. * Add "properties" to a method invocation. These properties can be
  497. * user defined or one of the WebServicesCore declared properties
  498. * (which may modify the behavior of the invocation.) All
  499. * WebServicesCore declared properties will start with the string
  500. * "kWS", eg, kWSHTTPFollowsRedirects. Properties are serialized
  501. * along with the contract, so you may want to avoid sticking raw
  502. * pointers in a CFNumber (for example).
  503. *
  504. * Parameters:
  505. *
  506. * invocation:
  507. * the invocation
  508. *
  509. * propertyName:
  510. * a CFStringRef name of the property to modify
  511. *
  512. * propertyValue:
  513. * a CFTypeRef containing the new property value
  514. *
  515. * Result:
  516. * none
  517. *
  518. * Availability:
  519. * Non-Carbon CFM: not available
  520. * CarbonLib: not available
  521. * Mac OS X: in version 10.2 and later
  522. */
  523. EXTERN_API_C( void )
  524. WSMethodInvocationSetProperty(
  525. WSMethodInvocationRef invocation,
  526. CFStringRef propertyName,
  527. CFTypeRef propertyValue);
  528. /*
  529. * WSMethodInvocationCopyProperty()
  530. *
  531. * Discussion:
  532. * Return a property from a invocation. If the result is NULL, the
  533. * property doesn't exist. Being a "Copy" call, you must release
  534. * the result.
  535. *
  536. * Parameters:
  537. *
  538. * invocation:
  539. * the invocation
  540. *
  541. * propertyName:
  542. * the name of the property to retreive
  543. *
  544. * Result:
  545. * the CFTypeRef value of the property, or NULL if the property was
  546. * not specified.
  547. *
  548. * Availability:
  549. * Non-Carbon CFM: not available
  550. * CarbonLib: not available
  551. * Mac OS X: in version 10.2 and later
  552. */
  553. EXTERN_API_C( CFTypeRef )
  554. WSMethodInvocationCopyProperty(
  555. WSMethodInvocationRef invocation,
  556. CFStringRef propertyName);
  557. /*
  558. * WSMethodInvocationInvoke()
  559. *
  560. * Discussion:
  561. * Execute the invocation. If the call was successful, the result
  562. * will contain the result of the invocation. If for some reason the
  563. * invocation failed, including out of memory or invalid parameter
  564. * errors, then the result will contain a fault structure. You must
  565. * release the result when you're done with it.
  566. *
  567. * Parameters:
  568. *
  569. * invocation:
  570. * the invocation
  571. *
  572. * Result:
  573. * a CFDictionaryRef containing the result of the execution or a
  574. * fault, and optional debug information.
  575. *
  576. * Availability:
  577. * Non-Carbon CFM: not available
  578. * CarbonLib: not available
  579. * Mac OS X: in version 10.2 and later
  580. */
  581. EXTERN_API_C( CFDictionaryRef )
  582. WSMethodInvocationInvoke(WSMethodInvocationRef invocation);
  583. /*
  584. These calls implemented the asynchronous variant of the WSMethodInvocationInvoke.
  585. The strategy is to schedule the invocation on a given runloop.
  586. When the invocation completes, it calls the specified callback with
  587. the result of the execution. The callback is responsible for
  588. releasing the result ref. Your code is responsible for
  589. unscheduling the invocation from the run loop, whether it completes
  590. or not.
  591. You can re-schedule an invocation after it completes.
  592. When you unschedule with the run loop, the CallBack is not called.
  593. If a network error occurs, the kWSFaultString entry of the result
  594. will contain some textual description of the error, kWSFaultCode
  595. will contain kWSNetworkingFault and kWSFaultExtra will be a
  596. dictionary containing two CFNumber values called kWSStreamErrorDomain
  597. and kWSStreamErrorError.
  598. */
  599. /*
  600. * WSMethodInvocationCallBackProcPtr
  601. *
  602. * Discussion:
  603. * Prototypes the callback made when an asynchronous invocation
  604. * completes. This callback is passed a reference to the invocation
  605. * just completed, a pointer to private data, and a dictionary that
  606. * contains the return value or falut for this invocation. The
  607. * callback is responsible for releasing the dictionary when it is
  608. * no longer used.
  609. *
  610. * Parameters:
  611. *
  612. * invocation:
  613. * the invocation just completed
  614. *
  615. * info:
  616. * private callback data
  617. *
  618. * outRef:
  619. * a CFDictionaryRef containing the result of the execution or a
  620. * fault, and optional debug information.
  621. */
  622. typedef CALLBACK_API( void , WSMethodInvocationCallBackProcPtr )(WSMethodInvocationRef invocation, void *info, CFDictionaryRef outRef);
  623. /*
  624. * WSMethodInvocationSetCallBack()
  625. *
  626. * Discussion:
  627. * sets the callback for an asynchronous method invocation. Call
  628. * with a clientCB and context of NULL to clear the invocation
  629. * callback.
  630. *
  631. * Parameters:
  632. *
  633. * invocation:
  634. * the invocation
  635. *
  636. * clientCB:
  637. * a ProcPtr to be called when the invocation completes.
  638. *
  639. * context:
  640. * a pointer to a WSClientContext. The structure will be copied.
  641. *
  642. * Availability:
  643. * Non-Carbon CFM: not available
  644. * CarbonLib: not available
  645. * Mac OS X: in version 10.2 and later
  646. */
  647. EXTERN_API_C( void )
  648. WSMethodInvocationSetCallBack(
  649. WSMethodInvocationRef invocation,
  650. WSMethodInvocationCallBackProcPtr clientCB,
  651. WSClientContext * context);
  652. /*
  653. @function WSMethodInvocationScheduleWithRunLoop
  654. @discussion Schedules the invocation to execute on the run loop.
  655. @param invocation
  656. the invocation
  657. @param runLoop
  658. the run loop upon which to scheduile the invocation
  659. @param runLoopMode
  660. the run loop mode
  661. */
  662. /*
  663. * WSMethodInvocationScheduleWithRunLoop()
  664. *
  665. * Availability:
  666. * Non-Carbon CFM: not available
  667. * CarbonLib: not available
  668. * Mac OS X: in version 10.2 and later
  669. */
  670. EXTERN_API_C( void )
  671. WSMethodInvocationScheduleWithRunLoop(
  672. WSMethodInvocationRef invocation,
  673. CFRunLoopRef runLoop,
  674. CFStringRef runLoopMode);
  675. /*
  676. @function WSMethodInvocationUnscheduleFromRunLoop
  677. @discussion Unschedules the invocation from a given run loop and
  678. mode. If the invocation has not yet completed,
  679. its callback will not be called.
  680. @param invocation
  681. the invocation
  682. @param runLoop
  683. the run loop upon which to scheduile the invocation
  684. @param runLoopMode
  685. the run loop mode
  686. */
  687. /*
  688. * WSMethodInvocationUnscheduleFromRunLoop()
  689. *
  690. * Availability:
  691. * Non-Carbon CFM: not available
  692. * CarbonLib: not available
  693. * Mac OS X: in version 10.2 and later
  694. */
  695. EXTERN_API_C( void )
  696. WSMethodInvocationUnscheduleFromRunLoop(
  697. WSMethodInvocationRef invocation,
  698. CFRunLoopRef runLoop,
  699. CFStringRef runLoopMode);
  700. /*
  701. Result interrogation.
  702. If the result is a fault, look in the kWSFaultCode, kWSFaultString
  703. and kWSFaultExtra fields of the resulting dictionary. If not a
  704. fault, kWSMethodInvocationResult will contain the result of the
  705. execution. If debugging information was requested, it will be
  706. available in the dictionary as well.
  707. */
  708. /*
  709. * WSMethodResultIsFault()
  710. *
  711. * Discussion:
  712. * returns TRUE if the method invocation result contains a fault.
  713. *
  714. * Parameters:
  715. *
  716. * methodResult:
  717. * the result ref
  718. *
  719. * Result:
  720. * TRUE if the result contains a fault condition
  721. *
  722. * Availability:
  723. * Non-Carbon CFM: not available
  724. * CarbonLib: not available
  725. * Mac OS X: in version 10.2 and later
  726. */
  727. EXTERN_API_C( Boolean )
  728. WSMethodResultIsFault(CFDictionaryRef methodResult);
  729. /*
  730. Serialization / Deserialization override support.
  731. You can add serialization and deserialization callbacks for custom
  732. types, or types not otherwise handled by the framework. Note that these
  733. properties are *not* serialized if the invocation is serialized.
  734. */
  735. /*
  736. * WSMethodInvocationSerializationProcPtr
  737. *
  738. * Discussion:
  739. * Prototypes the callback function for a custom serialization proc.
  740. * This callback is called whenever a type has the given CFTypeID.
  741. * The callback should return an XML snippet that will be understood
  742. * by the server as a correct serialization for a given type. If
  743. * the callback returns NULL, the default serializer will be used.
  744. *
  745. * Parameters:
  746. *
  747. * invocation:
  748. * the invocation currently being serialized
  749. *
  750. * obj:
  751. * the CFTypeRef to be serialized
  752. *
  753. * info:
  754. * private callback data
  755. *
  756. * Result:
  757. * a CFStringRef containing valid XML. The caller of this callback
  758. * will release the string.
  759. */
  760. typedef CALLBACK_API( CFStringRef , WSMethodInvocationSerializationProcPtr )(WSMethodInvocationRef invocation, CFTypeRef obj, void *info);
  761. /*
  762. * WSMethodInvocationAddSerializationOverride()
  763. *
  764. * Discussion:
  765. * Specifies a callback which will be called to produce the XML that
  766. * represents the serialization of a given type ref. See
  767. * WSDescription.h for a list of CFTypes for which there currently
  768. * exist serializers. If your callback returns NULL, the default
  769. * serializer will be used.
  770. *
  771. * Parameters:
  772. *
  773. * invocation:
  774. * the invocation
  775. *
  776. * objType:
  777. * the CFTypeID of the object
  778. *
  779. * serializationProc:
  780. * the callback called
  781. *
  782. * context:
  783. * a pointer to a WSClientContext. The structure will be copied.
  784. *
  785. * Availability:
  786. * Non-Carbon CFM: not available
  787. * CarbonLib: not available
  788. * Mac OS X: in version 10.2 and later
  789. */
  790. EXTERN_API_C( void )
  791. WSMethodInvocationAddSerializationOverride(
  792. WSMethodInvocationRef invocation,
  793. CFTypeID objType,
  794. WSMethodInvocationSerializationProcPtr serializationProc,
  795. WSClientContext * context);
  796. /*
  797. * WSMethodInvocationDeserializationProcPtr
  798. *
  799. * Discussion:
  800. * Prototypes the callback function for a custom deserializer. This
  801. * callback is passed a reference to the invocation currently being
  802. * executed, the root of the response parse tree, the current node
  803. * being deserialized, and a pointer to private data. The return
  804. * result should be a valid CFTypeRef object (which will be released
  805. * by the caller) or NULL to allow the default deserializer to act.
  806. *
  807. * Parameters:
  808. *
  809. * invocation:
  810. * the invocation executing
  811. *
  812. * msgRoot:
  813. * the root tree element
  814. *
  815. * deserializeRoot:
  816. * the tree element that needs to be deserialied
  817. *
  818. * info:
  819. * private callback data
  820. *
  821. * Result:
  822. * a CFTypeRef representing the deserialized data, or NULL to allow
  823. * the default deserializers to act.
  824. */
  825. typedef CALLBACK_API( CFTypeRef , WSMethodInvocationDeserializationProcPtr )(WSMethodInvocationRef invocation, CFXMLTreeRef msgRoot, CFXMLTreeRef deserializeRoot, void *info);
  826. /*
  827. * WSMethodInvocationAddDeserializationOverride()
  828. *
  829. * Discussion:
  830. * Specifies a callback to be made when parsing an XML method
  831. * response. The callback should return a CFTypeRef containing the
  832. * deserialized object value. If the callback returns NULL, the
  833. * default deserializer will be used.
  834. *
  835. * Parameters:
  836. *
  837. * invocation:
  838. * the invocation
  839. *
  840. * typeNamespace:
  841. * the fully resolved namespace for a specific type. If NULL, the
  842. * default namespace will be used. For example, this field could
  843. * be: CFSTR("http://www.w3.org/2001/XMLSchema-instance").
  844. *
  845. * typeName:
  846. * the non-qualified type name. This parameter must not be NULL.
  847. *
  848. * deserializationProc:
  849. * a ProcPtr to be called to perform the deserialization
  850. *
  851. * context:
  852. * a pointer to a WSClientContext. The structure will be copied.
  853. *
  854. * Availability:
  855. * Non-Carbon CFM: not available
  856. * CarbonLib: not available
  857. * Mac OS X: in version 10.2 and later
  858. */
  859. EXTERN_API_C( void )
  860. WSMethodInvocationAddDeserializationOverride(
  861. WSMethodInvocationRef invocation,
  862. CFStringRef typeNamespace,
  863. CFStringRef typeName,
  864. WSMethodInvocationDeserializationProcPtr deserializationProc,
  865. WSClientContext * context);
  866. #if PRAGMA_ENUM_ALWAYSINT
  867. #pragma enumsalwaysint reset
  868. #ifdef __WSMETHODINVOCATION__RESTORE_TWOBYTEINTS
  869. #pragma fourbyteints off
  870. #endif
  871. #elif PRAGMA_ENUM_OPTIONS
  872. #pragma option enum=reset
  873. #elif defined(__WSMETHODINVOCATION__RESTORE_PACKED_ENUMS)
  874. #pragma options(pack_enums)
  875. #endif
  876. #if PRAGMA_STRUCT_ALIGN
  877. #pragma options align=reset
  878. #elif PRAGMA_STRUCT_PACKPUSH
  879. #pragma pack(pop)
  880. #elif PRAGMA_STRUCT_PACK
  881. #pragma pack()
  882. #endif
  883. #ifdef PRAGMA_IMPORT_OFF
  884. #pragma import off
  885. #elif PRAGMA_IMPORT
  886. #pragma import reset
  887. #endif
  888. #ifdef __cplusplus
  889. }
  890. #endif