FROM : Zach Wily
DATE : Wed Jun 30 22:28:22 2004
>> Not sure how you're getting 3 versions. I think that you specify when
>> you create
>> the stubs if you want Obj-C, C++, or AppleScript.
>
> Using the XMethodsInspector example app, selecting the desired service
> and click fetch. I use the Obj-C stubs, and I seem to always get 3
> (duplicate?) implementations of each class. For example in the case
> of this WDSL ( see URL below ), I get stubs for classes GetLicRate &
> GetRate ( 3 implementations for each ) and 1 implementation for the
> synchronous class CurrencywsService which has all class method
> implementations--calling the others. Maybe there are versions for
> SOAP and straight XML, but I figured the service would respond to
> either one or the other, not both??
It looks like the WSDL is declaring some variants of the methods that
distinguish between SOAP/HTTP GET/HTTP POST requests, and the stubs
generator (probably WSMakeStubs) isn't handling them correctly.
>> Let me know what service you're connecting to (WSDL would be nice)
>> and I'll see
>> if I can help.
>
> http://glkev.webs.innerhost.com/glkev_ws/Currencyws.asmx?WSDL
>
> Also, when it is unclear what the parameter should be or look like, is
> there a way to find out? Again, inspecting the service's profile
> online or embedded comments within the stubs often does not yield any
> clues.
I went ahead and generated some stubs myself from that WSDL and built a
small project. After I deleted the extra implementations of those two
methods, I ran it, and with ethereal sniffed the server response. I
don't have it to paste in, but it said something about the SOAPAction
header missing. Then I remembered that WSMakeStubs seems to have a bug
where it doesn't set those, but .NET likes (demands) them. The
SOAPAction that the .NET service is expecting looks like
base_url/method_name. So for example, I made -[GetRate
genCreateInvocationRef] look like this:
- (WSMethodInvocationRef) genCreateInvocationRef
{
return [self createInvocationRef
/*endpoint*/:
@"http://glkev.webs.innerhost.com/glkev_ws/Currencyws.asmx"
methodName: @"GetRate"
protocol: (NSString*) kWSSOAP2001Protocol
// missing encoding style - defaulting to RPC
style: (NSString*) kWSSOAPStyleRPC
soapAction: @"http://www.myasptools.com/GetRate" /* No
SOAPAction header needed (zwily: oh yes it is!!) */
methodNamespace: NULL /* No Method Namespace specified */
];
}
So that sends in the right SOAPAction, but then there's ANOTHER bug
where WSGeneratedObj that doesn't actually set that correctly. So in
WSGeneratedObj.m on lines 174 and 175:
NSString* soapAction = @"SOAPAction";
NSDictionary* headers = [self
copyHeaderDictionary:1 extraVals:&soapAction extraKeys:&soapAction];
Change these to:
NSString* soapActionKey = @"SOAPAction"; // the
name soapAction is taken by the method parameter
NSDictionary* headers = [self
copyHeaderDictionary:1 extraVals:&soapAction extraKeys:&soapActionKey];
After making all these changes, here's what the web service is
responding with (once again, caught with ethereal):
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>System.Web.Services.Protocols.SoapException: Server
was unable to process request. ---> System.NullReferenceException:
Object reference not set to an instance of an object.
at LicenseChecker.CheckSecurity()
at Currencyws.GetRate(String srcCurrency, String destCurrency)
--- End of inner exception stack trace ---</faultstring>
<detail />
</soap:Fault>
</soap:Body>
</soap:Envelope>
The "LicenseChecker.CheckSecurity()" line leads me to believe that it's
expecting some sort of authentication token to be passed in, but I
could be wrong.
Anyway, I gave up on the generated stubs awhile ago and just work
straight with the Web Services API's documented here:
http://developer.apple.com/documentation/Networking/Conceptual/
UsingWebservices/3_ref_folder/chapter_3_section_1.html#//apple_ref/doc/
uid/TP30000985-CH206-BBCFFFHC
I hope this helps...
zach
_______________________________________________
MacOSX-dev mailing list
<email_removed>
http://www.omnigroup.com/mailman/listinfo/macosx-dev
DATE : Wed Jun 30 22:28:22 2004
>> Not sure how you're getting 3 versions. I think that you specify when
>> you create
>> the stubs if you want Obj-C, C++, or AppleScript.
>
> Using the XMethodsInspector example app, selecting the desired service
> and click fetch. I use the Obj-C stubs, and I seem to always get 3
> (duplicate?) implementations of each class. For example in the case
> of this WDSL ( see URL below ), I get stubs for classes GetLicRate &
> GetRate ( 3 implementations for each ) and 1 implementation for the
> synchronous class CurrencywsService which has all class method
> implementations--calling the others. Maybe there are versions for
> SOAP and straight XML, but I figured the service would respond to
> either one or the other, not both??
It looks like the WSDL is declaring some variants of the methods that
distinguish between SOAP/HTTP GET/HTTP POST requests, and the stubs
generator (probably WSMakeStubs) isn't handling them correctly.
>> Let me know what service you're connecting to (WSDL would be nice)
>> and I'll see
>> if I can help.
>
> http://glkev.webs.innerhost.com/glkev_ws/Currencyws.asmx?WSDL
>
> Also, when it is unclear what the parameter should be or look like, is
> there a way to find out? Again, inspecting the service's profile
> online or embedded comments within the stubs often does not yield any
> clues.
I went ahead and generated some stubs myself from that WSDL and built a
small project. After I deleted the extra implementations of those two
methods, I ran it, and with ethereal sniffed the server response. I
don't have it to paste in, but it said something about the SOAPAction
header missing. Then I remembered that WSMakeStubs seems to have a bug
where it doesn't set those, but .NET likes (demands) them. The
SOAPAction that the .NET service is expecting looks like
base_url/method_name. So for example, I made -[GetRate
genCreateInvocationRef] look like this:
- (WSMethodInvocationRef) genCreateInvocationRef
{
return [self createInvocationRef
/*endpoint*/:
@"http://glkev.webs.innerhost.com/glkev_ws/Currencyws.asmx"
methodName: @"GetRate"
protocol: (NSString*) kWSSOAP2001Protocol
// missing encoding style - defaulting to RPC
style: (NSString*) kWSSOAPStyleRPC
soapAction: @"http://www.myasptools.com/GetRate" /* No
SOAPAction header needed (zwily: oh yes it is!!) */
methodNamespace: NULL /* No Method Namespace specified */
];
}
So that sends in the right SOAPAction, but then there's ANOTHER bug
where WSGeneratedObj that doesn't actually set that correctly. So in
WSGeneratedObj.m on lines 174 and 175:
NSString* soapAction = @"SOAPAction";
NSDictionary* headers = [self
copyHeaderDictionary:1 extraVals:&soapAction extraKeys:&soapAction];
Change these to:
NSString* soapActionKey = @"SOAPAction"; // the
name soapAction is taken by the method parameter
NSDictionary* headers = [self
copyHeaderDictionary:1 extraVals:&soapAction extraKeys:&soapActionKey];
After making all these changes, here's what the web service is
responding with (once again, caught with ethereal):
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>System.Web.Services.Protocols.SoapException: Server
was unable to process request. ---> System.NullReferenceException:
Object reference not set to an instance of an object.
at LicenseChecker.CheckSecurity()
at Currencyws.GetRate(String srcCurrency, String destCurrency)
--- End of inner exception stack trace ---</faultstring>
<detail />
</soap:Fault>
</soap:Body>
</soap:Envelope>
The "LicenseChecker.CheckSecurity()" line leads me to believe that it's
expecting some sort of authentication token to be passed in, but I
could be wrong.
Anyway, I gave up on the generated stubs awhile ago and just work
straight with the Web Services API's documented here:
http://developer.apple.com/documentation/Networking/Conceptual/
UsingWebservices/3_ref_folder/chapter_3_section_1.html#//apple_ref/doc/
uid/TP30000985-CH206-BBCFFFHC
I hope this helps...
zach
_______________________________________________
MacOSX-dev mailing list
<email_removed>
http://www.omnigroup.com/mailman/listinfo/macosx-dev
| Related mails | Author | Date |
|---|---|---|
| Anthony Brian Arth… | Jun 26, 22:48 | |
| Zach Wily | Jun 27, 08:32 | |
| Anthony Brian Arth… | Jun 30, 09:13 | |
| Anthony Brian Arth… | Jun 30, 17:05 | |
| Zach Wily | Jun 30, 22:28 |






Cocoa mail archive

