web services & _parseFault
-
Hi,
Wondering if anyone has experimented with web services. I fetched the
stub code from XMethods, in Obj-C, but every attempt to invoke a remote
operation yields a 'in _parseFault'. Would anyone know what causes
this and how to correct it?
--Brian
_______________________________________________
MacOSX-dev mailing list
<MacOSX-dev...>
http://www.omnigroup.com/mailman/listinfo/macosx-dev -
It seems to be a bug in the WebServices code. Anytime you get a SOAP
fault back from the server that message will be printed to the console.
Not really a big deal but kind of annoying. I filed a bug report about
it a couple months ago.
What this means for you is that you're getting a SOAP exception back
from the server. Dump out the result dictionary to get more details.
(Or sniff the conversation with tcpdump/ethereal.)
zach
On Jun 26, 2004, at 1:48 PM, Anthony Brian Arthur wrote:
> Hi,
>
> Wondering if anyone has experimented with web services. I fetched the
> stub code from XMethods, in Obj-C, but every attempt to invoke a
> remote operation yields a 'in _parseFault'. Would anyone know what
> causes this and how to correct it?
>
> --Brian
>
> _______________________________________________
> MacOSX-dev mailing list
> <MacOSX-dev...>
> http://www.omnigroup.com/mailman/listinfo/macosx-dev
_______________________________________________
MacOSX-dev mailing list
<MacOSX-dev...>
http://www.omnigroup.com/mailman/listinfo/macosx-dev -
Hi,
I want to thank Zach for his help, but I was wondering if there was any
one else with some input. I have tried several services, and several
operations within each, but never get results--other than the 'in
_parseFault'. Should I get results, even though this SOAP exception is
raised? Is there some credentials needed before the service is
available? If so, how could I tell, this is unclear for the service's
profile.
I noticed that there are always 3 different versions of the stubs that
get generated. Which one should I choose? Would that make a
difference?
Any input would be appreciated.
Regards,
--Brian
On Jun 27, 2004, at 2:32 AM, Zach Wily wrote:
>
> It seems to be a bug in the WebServices code. Anytime you get a SOAP
> fault back from the server that message will be printed to the
> console. Not really a big deal but kind of annoying. I filed a bug
> report about it a couple months ago.
>
> What this means for you is that you're getting a SOAP exception back
> from the server. Dump out the result dictionary to get more details.
> (Or sniff the conversation with tcpdump/ethereal.)
>
> zach
>
>
> On Jun 26, 2004, at 1:48 PM, Anthony Brian Arthur wrote:
>
>> Hi,
>>
>> Wondering if anyone has experimented with web services. I fetched
>> the stub code from XMethods, in Obj-C, but every attempt to invoke a
>> remote operation yields a 'in _parseFault'. Would anyone know what
>> causes this and how to correct it?
>>
>> --Brian
>>
>> _______________________________________________
>> MacOSX-dev mailing list
>> <MacOSX-dev...>
>> http://www.omnigroup.com/mailman/listinfo/macosx-dev
>
_______________________________________________
MacOSX-dev mailing list
<MacOSX-dev...>
http://www.omnigroup.com/mailman/listinfo/macosx-dev -
Posting my reply to benefit others, the archive, and preserve the
integrity of the thread:
On Jun 30, 2004, at 10:26 AM, Zachary Wily wrote:
>> I want to thank Zach for his help, but I was wondering if there was
>> any
>> one else with some input. I have tried several services, and several
>> operations within each, but never get results--other than the 'in
>> _parseFault'. Should I get results, even though this SOAP exception
>> is
>> raised? Is there some credentials needed before the service is
>> available? If so, how could I tell, this is unclear for the service's
>> profile.
>
> Are you trying to hit against one of the big services such as Google?
> If so, can
> you give us a code sample?
This is not a big time service. A snippet looks like:
NSString* from = nil;
NSString* to = nil;
id money = nil;
from = @"USD";
to = @"BOB";
money = [CurrencywsService GetRate:from in_destCurrency:to];
//this is where the fault occurs and nil is returned.
>
> When you get a SOAP exception, that means the operation failed and you
> won't get
> any results. What you do get is an exception code and description.
>
>> I noticed that there are always 3 different versions of the stubs that
>> get generated. Which one should I choose? Would that make a
>> difference?
>
> 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??
>
> 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.
Thanks,
--Brian
>_______________________________________________
MacOSX-dev mailing list
<MacOSX-dev...>
http://www.omnigroup.com/mailman/listinfo/macosx-dev -
>> 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:
<A
href="http://developer.apple.com/documentation/Networking/Conceptual/">h
ttp://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
<MacOSX-dev...>
http://www.omnigroup.com/mailman/listinfo/macosx-dev



