Revision: 28594
http://sourceforge.net/p/bibdesk/svn/28594
Author: hofman
Date: 2024-01-11 17:58:35 +0000 (Thu, 11 Jan 2024)
Log Message:
-----------
No need to wrap response body parts in a response object
Modified Paths:
--------------
trunk/bibdesk/BDSKISIGroupServer.m
trunk/bibdesk/BDSKSoapBinding.h
trunk/bibdesk/BDSKSoapBinding.m
Modified: trunk/bibdesk/BDSKISIGroupServer.m
===================================================================
--- trunk/bibdesk/BDSKISIGroupServer.m 2024-01-11 17:37:55 UTC (rev 28593)
+++ trunk/bibdesk/BDSKISIGroupServer.m 2024-01-11 17:58:35 UTC (rev 28594)
@@ -319,7 +319,7 @@
}
}
-- (void)operation:(BDSKSoapBindingOperation *)anOperation
completedWithResponse:(BDSKSoapBindingResponse *)response {
+- (void)operation:(BDSKSoapBindingOperation *)anOperation
completedWithResponse:(NSArray *)response error:(NSError *)error {
// calling release may make the operation and response invalid
operation = nil;
@@ -327,7 +327,7 @@
id result = nil;
NSString *errorString = nil;
- for (id bodyPart in [response bodyParts]) {
+ for (id bodyPart in response) {
if ([bodyPart respondsToSelector:@selector(faultstring)])
errorString = [[(BDSKSoapBinding_fault *)bodyPart faultstring]
stringByDeletingCharactersInSet:[NSCharacterSet newlineCharacterSet]];
else if ([bodyPart respondsToSelector:@selector(return_)])
@@ -381,7 +381,7 @@
// if the session has expired, the error message will include
this server error code, so discard the cookie to allow authentication again
sessionCookie = nil;
}
- [self setErrorMessage:errorString ?: [[response error]
localizedDescription] ?: NSLocalizedString(@"Unable to retrieve results. You
may not have permission to use this database, or your query syntax may be
incorrect.", @"Error message when connection to Web of Science fails.")];
+ [self setErrorMessage:errorString ?: [error localizedDescription]
?: NSLocalizedString(@"Unable to retrieve results. You may not have permission
to use this database, or your query syntax may be incorrect.", @"Error message
when connection to Web of Science fails.")];
failedDownload = YES;
state = BDSKWOKStateIdle;
Modified: trunk/bibdesk/BDSKSoapBinding.h
===================================================================
--- trunk/bibdesk/BDSKSoapBinding.h 2024-01-11 17:37:55 UTC (rev 28593)
+++ trunk/bibdesk/BDSKSoapBinding.h 2024-01-11 17:58:35 UTC (rev 28594)
@@ -1,12 +1,11 @@
#import <Cocoa/Cocoa.h>
@class BDSKSoapBindingElement;
-@class BDSKSoapBindingResponse;
@class BDSKSoapBindingOperation;
@class BDSKDownload;
@protocol BDSKSoapBindingOperationDelegate <NSObject>
-- (void)operation:(BDSKSoapBindingOperation *)operation
completedWithResponse:(BDSKSoapBindingResponse *)response;
+- (void)operation:(BDSKSoapBindingOperation *)operation
completedWithResponse:(NSArray *)response error:(NSError *)error;
@optional
- (NSWindow *)operationWindowForAuthenticationSheet:(BDSKSoapBindingOperation
*)anOperation;
@end
@@ -41,7 +40,6 @@
NSDictionary *bodyElements;
NSDictionary *responseClasses;
NSString *soapAction;
- BDSKSoapBindingResponse *response;
__weak id<BDSKSoapBindingOperationDelegate> delegate;
BDSKDownload *download;
BOOL complete;
@@ -51,7 +49,6 @@
@property (nonatomic, strong) NSDictionary *bodyElements;
@property (nonatomic, strong) NSDictionary *responseClasses;
@property (nonatomic, strong) NSString *soapAction;
-@property (nonatomic, readonly) BDSKSoapBindingResponse *response;
@property (nonatomic, weak) id<BDSKSoapBindingOperationDelegate> delegate;
@property (nonatomic, strong) BDSKDownload *download;
- (id)initWithBinding:(BDSKSoapBinding *)aBinding
delegate:(id<BDSKSoapBindingOperationDelegate>)aDelegate soapAction:(NSString
*)aSoapAction bodyElements:(NSDictionary *)aBodyElements
responseClasses:(NSDictionary *)aResponseClasses;
@@ -61,16 +58,6 @@
- (void)cancel;
@end
-@interface BDSKSoapBindingResponse : NSObject {
- NSArray *headers;
- NSArray *bodyParts;
- NSError *error;
-}
-@property (nonatomic, strong) NSArray *headers;
-@property (nonatomic, strong) NSArray *bodyParts;
-@property (nonatomic, strong) NSError *error;
-@end
-
@interface BDSKSoapBindingElement : NSObject {
}
- (NSXMLElement *)XMLNodeWithName:(NSString *)elName prefix:(NSString
*)elNSPrefix;
Modified: trunk/bibdesk/BDSKSoapBinding.m
===================================================================
--- trunk/bibdesk/BDSKSoapBinding.m 2024-01-11 17:37:55 UTC (rev 28593)
+++ trunk/bibdesk/BDSKSoapBinding.m 2024-01-11 17:58:35 UTC (rev 28594)
@@ -135,7 +135,6 @@
@synthesize bodyElements;
@synthesize responseClasses;
@synthesize soapAction;
-@synthesize response;
@synthesize delegate;
@synthesize download;
- (id)initWithBinding:(BDSKSoapBinding *)aBinding
delegate:(id<BDSKSoapBindingOperationDelegate>)aDelegate soapAction:(NSString
*)aSoapAction bodyElements:(NSDictionary *)aBodyElements
responseClasses:(NSDictionary *)aResponseClasses
@@ -145,7 +144,6 @@
self.bodyElements = aBodyElements;
self.responseClasses = aResponseClasses;
self.soapAction = aSoapAction;
- response = nil;
self.delegate = aDelegate;
self.download = nil;
complete = NO;
@@ -175,7 +173,6 @@
}
- (void)start
{
- response = [BDSKSoapBindingResponse new];
complete = NO;
NSMutableDictionary *headerElements = [NSMutableDictionary dictionary];
@@ -252,9 +249,8 @@
if ([[error domain] isEqualToString:NSURLErrorDomain] == NO || [error
code] != NSURLErrorCancelled) {
// ignore explict cancellation of the connection or the
authentication
// we call ourselves with a more detailed error in that case, and
we should not call this twice
- response.error = error;
complete = YES;
- [delegate operation:self completedWithResponse:response];
+ [delegate operation:self completedWithResponse:nil error:error];
}
return;
}
@@ -269,12 +265,16 @@
NSError *err = nil;
NSXMLDocument *doc = [[NSXMLDocument alloc] initWithData:data
options:NSXMLDocumentTidyXML error:&err];
-
+
if (doc == nil) {
NSDictionary *userInfo = @{NSLocalizedDescriptionKey:[NSString
stringWithFormat:@"Errors while parsing returned XML: %@", [err
localizedDescription]]};
- response.error = [NSError
errorWithDomain:@"BDSKSoapBindingResponseXML" code:1 userInfo:userInfo];
+ error = [NSError
errorWithDomain:@"BDSKSoapBindingResponseXML" code:1 userInfo:userInfo];
+
+ complete = YES;
+ [delegate operation:self completedWithResponse:nil error:error];
} else {
+ NSMutableArray *responseBodyParts = nil;
NSXMLElement *node = [doc rootElement];
for(node in [node children]) {
@@ -281,7 +281,7 @@
if([node kind] == NSXMLElementKind) {
if([[node localName]
isEqualToString:@"Body"]) {
- NSMutableArray
*responseBodyParts = [NSMutableArray array];
+ responseBodyParts = [NSMutableArray array];
for(NSXMLElement *bodyNode in
[node children]) {
if([bodyNode kind] ==
NSXMLElementKind) {
@@ -299,34 +299,17 @@
}
}
}
-
- response.bodyParts =
responseBodyParts;
}
}
}
+
+ complete = YES;
+ [delegate operation:self completedWithResponse:responseBodyParts
error:nil];
}
- complete = YES;
- [delegate operation:self completedWithResponse:response];
}
}
@end
-@implementation BDSKSoapBindingResponse
-@synthesize headers;
-@synthesize bodyParts;
-@synthesize error;
-- (id)init
-{
- if((self = [super init])) {
- headers = nil;
- bodyParts = nil;
- error = nil;
- }
-
- return self;
-}
-@end
-
@implementation BDSKSoapBindingElement
- (NSXMLElement *)XMLNodeWithName:(NSString *)elName prefix:(NSString
*)elNSPrefix
{
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit