Search code examples
objective-cioswcfsudzc

assign property to object in sudzc


I am calling a .Net WCF service from objective c.I have to pass an object of type 'Category' to a function.Before I pass the object,I have to initialise its 'id'.Here's the code:

SDZiPadDocSyncService *service = [[SDZiPadDocSyncService alloc]init];
service.logging = YES;
SDZCategory *cat = [[SDZCategory alloc]init];
cat.categoryId = [catId intValue];
[service getDocsByCatId:self action:@selector(getDocsByCatIdHandler:) category:cat];        

When the call hits the SQL Server,the categoryId is 0.Since there isn't any category with Id=0,the service is returning 0 records. Can someone please help me with this?


Solution

  • There is a possibility the request isn't being deserialized correctly by the WCF service. To verify sudzc is generating soap XML that the WCF service expects, use the WcfTestClient.exe app that comes with Visual Studio to make a call to that getDocsByCatId method. In there request/response panel, you'll see an XML tab. Compare the sudzc XML with the XML in that tab.

    Sometimes WCF expects XML namespaces to be used explicitly in the soap body. For example, your soap shows that the categoryId element is in the xmlns="http://tempuri.org/" XML namespace because that is the default namespace. Ensure the soap XML from the WcfTestClient also places categoryId in the http://tempuri.org/ XML namespace. Don't know how you would configure sudzc if it doesn't do that.