I’m trying to connect to a web service using cocoa. I’ve used the General/WSMakeStub tool in the developer tools to generate the stubs, but the simple Hello World method which has no parameters does not accept a simple call. I’m just trying to call it using the line.. (General/NSString*)[Service1Service Helloworld] ;
I’ve also tried using nil as a parameter like this…
temp = (General/NSString*)[Service1Service Helloworld:nil] ;
This resulted in the following error…
*** -General/[NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil value
I passed a string like this… temp = (General/NSString*)[Service1Service General/HelloWorld:@”test”] ;
When I try the string I get the following error…
Invalid parameter not satisfying: aString != nil
I even tried a dummy dictionary. with a key of “test” and value of “mytest” That still generated the same message as the string attempt.
Any assistance is appreciated. I’ve included the wsdl and the implementation stub file for reference, below.
Paul
Here’s the wsdl file generated by my sample .Net web service.
<?xml version=”1.0” encoding=”utf-8”?>
Here’s the stub that the General/WSMakeStubs Developer tool created…
/*-
(void) setParameters:(General/CFTypeRef /* Complex type http://tempuri.org/|General/HelloWorld /) in_parameters { id _paramValues[] = { in_parameters, }; General/NSString _paramNames[] = { @”parameters”, }; [super setParameters:1 values: _paramValues names: _paramNames]; }
(id) resultValue { return General/super getResultDictionary] objectForKey: @”parameters”]; }
@end; /* General/HelloWorld */
@implementation Service1Service
@end;
/*-
Paul,
Here is how I was able to invoke a .NET General/WebService:
General/NSDictionary params = General/[[NSDictionary alloc] init];
General/HelloWorld _invocation = General/[[HelloWorld alloc] init];
[_invocation setParameters: params];
General/NSDictionary result = General/_invocation getResultDictionary] retain];
if ([[WSMethodResultIsFault ((General/CFDictionaryRef) result)) /error?/
[information setStringValue: [result objectForKey: (General/NSString *)kWSFaultString]];
else /no error; all’s well*/
[information setStringValue: [result objectForKey: (General/NSString *)kWSMethodInvocationResult]];
[_invocation release];
Sean