SUDZC: Saving arrays of objects.

by Mark Deraeve 28. December 2012 00:03

SUDZC works pretty fine out of the box. You will defenately change here and there some things in the generated code. But probably the worst thing most people will end up bumping against is the fact that it doesn't support saving array of objects to the database. Its easy to retrieve arrays of objects, but for some reason the development stopped there and didn't spend any time any more to the sending of SOAPArrays. In my application I had to save objects in 1 statement and process them on the server synchronously. 

This required a deeper implementation and I had to inspect the SOAP envelope that needed to be generated. By default, the SUDZC will generate something like this:

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://tempuri.org/"><soap:Body><SaveOrderDetails></SaveOrderDetails></soap:Body></soap:Envelope>

Not much use, there even is no data from the objects passed. The envelope only has the Method call and that's it.

The desired result at the end should look like this:

<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"  xmlns:tem="http://tempuri.org/" xmlns:ser="http://schemas.microsoft.com/2003/10/Serialization/"  xmlns:a="http://schemas.datacontract.org/2004/07/SFIMobileEntities" ><soapenv:Body><tem:SaveOrderDetails><tem:f06Details><a:GP_MES_OrderDetails><a:ChangeTracker><a:State>Unchanged</a:State></a:ChangeTracker><a:Client>900</a:Client><a:Created>2012-12-27T12:33:58.697</a:Created><a:CreatedBy>@CORDOBA</a:CreatedBy><a:Description>u</a:Description><a:Modified>2012-12-28T09:55:07.550</a:Modified><a:ModifiedBy>@CORDOBA</a:ModifiedBy><a:Plant>GX</a:Plant><a:Pos>1</a:Pos><a:ProductCat>t</a:ProductCat><a:Quantity>10</a:Quantity><a:SalesOrder>119000764</a:SalesOrder><a:Sequence>1</a:Sequence><a:Size>ào</a:Size><a:StoragePlace>à</a:StoragePlace><a:UpdCount>10</a:UpdCount></a:GP_MES_OrderDetails><a:GP_MES_OrderDetails><a:ChangeTracker><a:State>Unchanged</a:State></a:ChangeTracker><a:Client>900</a:Client><a:Created>2012-12-27T12:33:58.697</a:Created><a:CreatedBy>@CORDOBA</a:CreatedBy><a:Description>u</a:Description><a:Modified>2012-12-28T09:55:07.557</a:Modified><a:ModifiedBy>@CORDOBA</a:ModifiedBy><a:Plant>GX</a:Plant><a:Pos>2</a:Pos><a:ProductCat>t</a:ProductCat><a:Quantity>20</a:Quantity><a:SalesOrder>119000764</a:SalesOrder><a:Sequence>2</a:Sequence><a:Size>àoo</a:Size><a:StoragePlace>àpp</a:StoragePlace><a:UpdCount>10</a:UpdCount></a:GP_MES_OrderDetails><a:GP_MES_OrderDetails><a:ChangeTracker><a:State>Unchanged</a:State></a:ChangeTracker><a:Client>900</a:Client><a:Created>2012-12-27T12:33:58.697</a:Created><a:CreatedBy>@CORDOBA</a:CreatedBy><a:Description>u</a:Description><a:Modified>2012-12-28T09:55:07.560</a:Modified><a:ModifiedBy>@CORDOBA</a:ModifiedBy><a:Plant>GX</a:Plant><a:Pos>3</a:Pos><a:ProductCat>t</a:ProductCat><a:Quantity>30</a:Quantity><a:SalesOrder>119000764</a:SalesOrder><a:Sequence>3</a:Sequence><a:Size>ào</a:Size><a:StoragePlace>à</a:StoragePlace><a:UpdCount>11</a:UpdCount></a:GP_MES_OrderDetails><a:GP_MES_OrderDetails><a:ChangeTracker><a:State>Unchanged</a:State></a:ChangeTracker><a:Client>900</a:Client><a:Created>2012-12-27T12:33:58.697</a:Created><a:CreatedBy>@CORDOBA</a:CreatedBy><a:Description>u</a:Description><a:Modified>2012-12-28T09:55:07.567</a:Modified><a:ModifiedBy>@CORDOBA</a:ModifiedBy><a:Plant>GX</a:Plant><a:Pos>4</a:Pos><a:ProductCat>t</a:ProductCat><a:Quantity>40</a:Quantity><a:SalesOrder>119000764</a:SalesOrder><a:Sequence>4</a:Sequence><a:Size>ào</a:Size><a:StoragePlace>à</a:StoragePlace><a:UpdCount>12</a:UpdCount></a:GP_MES_OrderDetails><a:GP_MES_OrderDetails><a:ChangeTracker><a:State>Unchanged</a:State></a:ChangeTracker><a:Client>900</a:Client><a:Created>2012-12-27T12:33:58.697</a:Created><a:CreatedBy>@CORDOBA</a:CreatedBy><a:Description>u</a:Description><a:Modified>2012-12-28T09:55:07.570</a:Modified><a:ModifiedBy>@CORDOBA</a:ModifiedBy><a:Plant>GX</a:Plant><a:Pos>5</a:Pos><a:ProductCat>t</a:ProductCat><a:Quantity>50</a:Quantity><a:SalesOrder>119000764</a:SalesOrder><a:Sequence>5</a:Sequence><a:Size>à</a:Size><a:StoragePlace>à</a:StoragePlace><a:UpdCount>8</a:UpdCount></a:GP_MES_OrderDetails><a:GP_MES_OrderDetails><a:ChangeTracker><a:State>Unchanged</a:State></a:ChangeTracker><a:Client>900</a:Client><a:Created>2012-12-27T14:15:15.517</a:Created><a:CreatedBy>@CORDOBA</a:CreatedBy><a:Description>u</a:Description><a:Modified>2012-12-28T09:55:07.570</a:Modified><a:ModifiedBy>@CORDOBA</a:ModifiedBy><a:Plant>GX</a:Plant><a:Pos>6</a:Pos><a:ProductCat>t</a:ProductCat><a:Quantity>60</a:Quantity><a:SalesOrder>119000764</a:SalesOrder><a:Sequence>6</a:Sequence><a:Size>io</a:Size><a:StoragePlace>p</a:StoragePlace><a:UpdCount>12</a:UpdCount></a:GP_MES_OrderDetails><a:GP_MES_OrderDetails><a:ChangeTracker><a:State>Unchanged</a:State></a:ChangeTracker><a:Client>900</a:Client><a:Created>2012-12-27T15:07:12.430</a:Created><a:CreatedBy>@CORDOBA</a:CreatedBy><a:Description>u</a:Description><a:Modified>2012-12-28T09:55:07.573</a:Modified><a:ModifiedBy>@CORDOBA</a:ModifiedBy><a:Plant>GX</a:Plant><a:Pos>7</a:Pos><a:ProductCat>t</a:ProductCat><a:Quantity>70</a:Quantity><a:SalesOrder>119000764</a:SalesOrder><a:Sequence>7</a:Sequence><a:Size>tyo</a:Size><a:StoragePlace>ty</a:StoragePlace><a:UpdCount>4</a:UpdCount></a:GP_MES_OrderDetails></tem:f06Details></tem:SaveOrderDetails></soapenv:Body></soapenv:Envelope>

That's something else...

How do we get there. The first thing we will need to do is to add an extra method on our soap class. (soap.h and soap.m)

In the soap.h (add these lines):

//Created by MRD to serialize arrays

+ (NSString*) serializeForArray: (id) object withName: (NSString*) nodeName;

In the soap.m (ass these lines):

// Serializes an object to a string, XML representation with a specific node name.

// if its an array of objects, it will use the serializeForArray implementation on the object array to serialize.

+ (NSString*) serialize: (id) object withName: (NSString*) nodeName

{

 

    if([object respondsToSelector:@selector(serialize:)])

    {

        return [object serialize: nodeName];

}

    else

    {

        if([object isKindOfClass:[NSArray class]])

        {

            

            NSMutableString* s = [NSMutableStringstring];

            

            bool setFirstNode=NO;

            for(id obj in object)

            {

                if (!setFirstNode)

                {

                    [s appendFormat:@"<tem:%@>",nodeName];

                    setFirstNode=YES;

                }

                if([obj respondsToSelector:@selector(serializeForArray:)])

                {

                    NSMutableString * str = [obj serializeForArray:nil];

                    [s appendFormat:@"%@",str];

                }

                else

                {

                    [s appendFormat:@"<%@>%@</%@>",@"arr:string",obj,@"arr:string"];

                }

            }

            if (setFirstNode)

            {

                [s appendFormat:@"</tem:%@>",nodeName];

            }

            else

            {

                [s appendFormat:@"</tem:%@>",nodeName];

            }

            return s;

            

        }

    }

    return [NSString stringWithFormat:@"<%@>%@</%@>", nodeName, [Soap serialize: object], nodeName];

}

When we have a class that inherits from the SOAPArray, we ill now not call the default serialize method, but the serializeForArray method. This is done by overwriting the SoapArray function call in your SUDZC generated array. The xml that was generated was working only for 1 object. So we needed to add first the parameter name and then the iteration of the objects. In the method below you'll see that first I will add the parameter name with the tem prefix (again inspect your soap call to check of you are using the same namespace. You could do this with SOAPUI by SmartBear.)

You simply add this method (e.g. in the implementation MYArrayOfGP_MES_OrderDetails):

- (NSMutableString *) serialize:(NSString *)nodeName

{

    NSMutableString *str = [NSMutableStringstring];

    [str appendFormat: @"<tem:%@", nodeName];

    [str appendString: [selfserializeAttributes]];

    [str appendString: @">"];

    for (id content in self)

    {

        [str appendString:[Soap serializeForArray:content withName:nodeName]];

    }

    [str appendFormat: @"</tem:%@>", nodeName];

    return str;

}

 

Now this is where the difference is. We will generate a different SOAP body when the object is used in an array. So the last thing we need to do is to implement this function on the object itself.You could even loose the argument nodeName since its not used in this function. (In my case: implementation GALVGP_MES_OrderDetails)

    - (NSMutableString*) serializeForArray: (NSString*) nodeName

    {

        NSMutableString* s = [NSMutableStringstring];

        [s appendString:@"<a:GP_MES_OrderDetails>"];

        [s appendString: [self serializeElements]];

        [s appendString:@"</a:GP_MES_OrderDetails>"];

        return s;

    }

Once you've done this, you can send array of your object to the server and use them there. It works fine. If you still struggle, I could help you with the complete solution, because there are some things I've had to change on the CreateEnvelope for Saving data. The default SUDZC code didn't work for me, since my SOAP required some extra namespaces.

This involved creating a new CreateEnvelope method in the SOAP class. This method should then be called when you do insert or update. This make sure that the namespace for the object prefixes is passed. The method looks like this:

NSString* const SOAP_PREFIX = @"soapenv";

NSString* const NS_PREFIX = @"tem";

NSString* const SER_PREFIX_URL = @"xmlns:ser=\"http://schemas.microsoft.com/2003/10/Serialization/\"";

 

NSString* const HTTP_PREFIX = @"http://";

NSUInteger const FORWARD_FLASH_CHARACTER_VALUE = 47;

// Creates the XML request for the SOAP envelope with optional SOAP headers and extra namespace.

+ (NSString*) createEnvelope: (NSString*) method forNamespace: (NSString*) ns

forParameters: (NSString*) params withHeaders: (NSDictionary*) headers withExtraNameSpace: (NSString *) extraNameSpace

{

    

    NSMutableString* s = [NSMutableStringstring];

 

    [s appendString: @"<?xml version=\"1.0\" encoding=\"utf-8\"?>"];

 

    [s appendString: @"<"];

    [s appendString: SOAP_PREFIX];

    [s appendString:@":Envelope xmlns:"];

    [s appendString: SOAP_PREFIX];

    [s appendString: @"=\"http://schemas.xmlsoap.org/soap/envelope/\" "];

    [s appendString:@" xmlns:"];

    [s appendString: NS_PREFIX];

    [s appendFormat:@"=\"%@\" ",ns ];

    [s appendFormat:@"%@ ",SER_PREFIX_URL];

    if(extraNameSpace)

    {

        [s appendFormat:@" %@ >",extraNameSpace];

    }

    

    if(headers != nil && headers.count > 0) {

        [s appendString: @"<"];

        [s appendString: SOAP_PREFIX];

        [s appendString:@":Header>"];

        

        for(id key in [headers allKeys]) {

            if([[headers objectForKey: key] isMemberOfClass: [SoapNil class]])

            {

                [s appendFormat: @"<%@ xsi:nil=\"true\"/>", key];

            } else {

                [s appendString:[Soap serializeHeader:headers forKey:key]];

            }

        }

        [s appendString: @"</"];

        [s appendString: SOAP_PREFIX];

        [s appendString:@":Header>"];

    }

    

    [s appendString: @"<"];

    [s appendString: SOAP_PREFIX];

    [s appendString:@":Body>"];

    

    NSMutableString* fullMethodName = [NSMutableStringstring];

    [fullMethodName appendString:NS_PREFIX];

    [fullMethodName appendString:@":"];

    [fullMethodName appendString:method];

    

    [s appendFormat: @"<%@>%@</%@>", fullMethodName,[params

                                                     stringByReplacingOccurrencesOfString:@"&" withString:@"&amp;"],

     fullMethodName];

    

    

    [s appendString: @"</"];

    [s appendString: SOAP_PREFIX];

    [s appendString:@":Body>"];

    [s appendString: @"</"];

    [s appendString: SOAP_PREFIX];

    [s appendString:@":Envelope>"];

    return s;

}

I used a tool called soapui to inspect the SOAP and find out what the envelope should look like.  


Tags:

| |

Comments (6) -

austin texas persaonl injury attorneys
austin texas persaonl injury attorneys United States
1/4/2014 6:01:21 AM #

My internet web page ... viagra - kisdpodcast.killeenisd.org/.../viagra.html I am genuinely pleased to glance at this web web site posts which carries plenty of handy data, many thanks for providing such information.

accident attorney Austin
accident attorney Austin United States
1/9/2014 8:47:35 AM #

enhance my internet site!I suppose its ok to work with some within your tips!! You might be welcome to work with any strategies you feel are practical to you. My aim is to reach as numerous men and women as I can with my ideas. So feel free to implement any. Many thanks. The interface is colorful, has more flair, and some great features like Mixview' that allow you quickly see associated albums, songs, or other users similar to what you might be listening to. Hello there! I could have sworn I have been to this site right before but following looking at as a result of several of the submit I realized it is really new to me. Nonetheless, I am definitely delighted I found it and I will be bookmarking and examining back often! Greetings from Carolina! I am bored at operate so I decided to browse your web site on my iphone during lunch break. I love the information you present right here and can't wait around to choose a seem once i get house. I'm amazed at how quick your blog site loaded on my cell phone .. I'm not even utilizing WIFI, just 3G .. Anyhow, excellent site! Would like to detailed introductory class in creative writing-novel,short story,even plays and screenplays. Written in advance of but not published and no formal training.. I actually like your blog.. quite good colors & concept. Did you make this web site you or did you hire an individual to try and do it for you? Plz reply as I'm searching to construct my very own blog site and would want to know where u obtained this from. thanks quite a bit I designed the web-site myself working with an e-book I bought about web designing. Hello! Would you thoughts if I share your website with my twitter team? There's quite a bit of people that i consider would definitely enjoy your material. Be sure to enable me know. Lots of many thanks Many thanks to your comment. Sure, I'll value if you do so. No difficulty about that. Once once more, thanks to your take a look at. Hello there! I'm at work searching your weblog from my new iphone! Just preferred to mention I really like reading through your blog site and glimpse forward to all your posts! Keep up the great do the job! Hi there, Neat article. There is an situation with your website internet site in web explorer, could possibly examine this? IE nevertheless would be the marketplace leader in addition to a big part of folks will omit your fantastic writing simply because of the challenge. I was studying some of your posts on this web site and i conceive this website is very insightful! Proceed putting up. What I'd like to do is compose a publishing on my blogspot and provide the most recent entry publish onto my personal webpage. Is there any way to accomplish this and would the coding be rather easy? I know just a little about internet structure and coding, so if it would involve connecting my blogspot towards the website page somehow, I could almost certainly do it. . . If this is certainly probable, make sure you stage me within the appropriate direction to ensure that I could achieve this feature. Any support is greatly appreciated!. Hmm is anyone else encountering complications while using the images on this blog site loading? I am trying to seek out out if its a dilemma on my end or if it really is the weblog. Any responses can be greatly appreciated. Instructive and precise Hello! I know this is often kind of off matter but I had been questioning which blog site platform have you been working with for this website? I am obtaining sick and tired of WordPress because I have experienced issues with hackers and i'm looking at alternatives for another platform. I would be great should you could stage me within the direction of the excellent platform. I used to be recommended tis web site by my cousin. I'm

car accident attorney Austin
car accident attorney Austin United States
1/23/2014 5:17:00 PM #

You're incredible! Thanks! I just need to say I'm just all new to blogging and site-building and absolutely loved this weblog. Very probable I'm planning to bookmark your site . You undoubtedly arrive with amazing properly written posts. Kudos for sharing with us your blog. Now I'm ready to try and do my breakfast, immediately after having my

car accident attorney Austin
car accident attorney Austin United States
1/26/2014 11:44:05 AM #

bit of your issue exciting for my web-site surfers.

car accident attorney Austin
car accident attorney Austin United States
2/24/2014 10:40:46 PM #

Did you develop this web web-site your self? You should reply again as I am hoping to generate my very own own web page

Dorothea Lashway
Dorothea Lashway United States
3/5/2014 9:02:17 PM #

Ooh, it is my favourite article until now! I could barely hang on.

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

About the author

I started as a VB6 developer, programming all kinds of applications. I also got involved in the development of a e-market in ASP.

When .Net was introduced, I had the privilege to start in a team of professionals and develop a framework. I learned a lot and started to work as a c#.Net consultant from then on.

After 2 years I also got the chance to work for several months with Sharepoint. Sharepoint kept chasing me all the years after and when the product got more and more mature I started to love it. Now Sharepoint is a somewhat daily occupation for me. I implemented a large quality document management system at PMRL being the only developper/technical analyst. Working close togehter with the QA department we succeeded in making and improving a very good Quality document management system. Its used up until this day.

I worked for 6 years as a .Net consultant for 2 of the largest consultancy companies in Belgium. I mainly worked as a Sharepoint engineer, but also .Net expert and several ASP.Net and Windows applications. One of my last projects with the consultancy was creating a custom LIMS system. This was a succes and the customer asked me to stay and help to expand and maintain this LIMS. I had great years in this company. There was a focus on innovation and a lot of opportunities for improving and developping new IS systems. Apart from several small projects I further more improved the custom LIMS system, created a SOP library based on Sharepoint and a web based Skill matrix system to handle the skills of the employees in the company. 

Then I was involved in transferring the LIMS to a new lab in Singapore. This was done in a short time frame. The deployment was again a success and it passed the GLP inspection tests. I learned a lot from the Quality engineers about validation of computerized systems.

At my current job I have a wide range of challenges. Mainly I'm still working with .Net (VB.net and C#.Net). But outside of the Microsoft world I also do some ABAB programming in our SAP system. Like developing Adobe Forms and the program behind it. Or making small changes to customized code.

Latest I started to follow a course from Stanford Univercity on Objective C programming for IPAD and IPHONE.I just finished the first app for IPad and it appears to be a great succes. People in the factory are working with IPad to take pictures and upload them to orders. Already more and more projects are coming my way. The iOS apps are supported by a home made .Net architecture that exposes WCF services. Its working great. My second app is almost ready for deployment in factories. Now I started an App for the management team so they can manage projects on their IPAD and IPHONE.

My linkedIn!

Month List

Tag cloud

Youtube

Locations of visitors to this page

Dailycode.info Dailycode.Info | SUDZC webservices always return 0 (WCF web service and IOS client)

SUDZC webservices always return 0 (WCF web service and IOS client)

by Mark Deraeve 7. August 2012 04:10

This occurs when you are using ARC (Automatic Reference Counting) generated code.

I found the place to look on these websites: http://stackoverflow.com/questions/8645637/sudzc-with-ios-5-and-arc 

and http://code.google.com/p/sudzc/issues/detail?id=40 but it didn't solve my problem completely. 

In my case it was an .Net web service (WCF) and I had to use s:Body in stead of Body in the SUDZC generated file: SoapRequest.m

CXMLNode* element = [[SoapgetNode: [doc rootElement] withName: @"s:Body"] childAtIndex:0]; 

Found it out by NSLogging the CXML document (I used NSLog tp inspect the cxmldocument ):

        CXMLNode* test = [doc rootElement];

        

        NSLog(@"%@",test); 

Here I got this:

<CXMLElement 0x68c1a50 [0x68c1b10] s:Envelope  <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body><GetUserIDResponse xmlns="http://tempuri.org/"><GetUserIDResult>8</GetUserIDResult></GetUserIDResponse></s:Body> </s:Envelope> >

 

So if in your case the s:Body still doesn't do the trick, look into the XML code and find out which prefix to use! Soon I will be posting a complete solution using WCF web serivces and SUDZC generator for iOS 5. It will be a local service running on the local network, not available through the internet. 

Now an extra finding when you are working with custom objects. In my case I'm using Entity Framework with self tracking entities. There entities are passed over the WCF webservice. SUDZC will generate these objects for you and adds them to a NSMutableArray. But when you look at the objects in the array you will notice all properties are empty or nil. Therefore I had to make another change in the generated objects. In the exemple below I changed the generated code withName: @ChangeTracker ... into withName: @"a:ChangeTracker ... I had to change this for all the properties of the entity. So they were filled with the data coming from the xml!

NSMutableString* s = [superserializeElements];

[s appendFormat: @"<a:CashPayment>%@</a:CashPayment>", (self.CashPayment)?@"true":@"false"];

if (self.ChangeTracker != nil) [s appendString: [self.ChangeTrackerserialize: @"a:ChangeTracker"]];

if (self.City != nil) [s appendFormat: @"<a:City>%@</a:City>", [[self.CitystringByReplacingOccurrencesOfString:@"\""withString:@"&quot;" 

 

Be advised that when you start inserting or updating data, you will also need to change some generated code. You will need to add the namespace to the serialization code in the Soap.h and Soap.m file. The I created an extra method which will add the namespace to the envelope: 

// Creates the XML request for the SOAP envelope with optional SOAP headers and an extra given namespace.

+ (NSString*) createEnvelope: (NSString*) method forNamespace: (NSString*) ns withParameters: (NSArray*) params withHeaders: (NSDictionary*) headers  withExtraNameSpace: (NSString *) extraNameSpace;

 

Then in the Soap.m file we implement this method like this:


 

NSString* const SOAP_PREFIX = @"soapenv";

NSString* const NS_PREFIX = @"tem";

NSString* const SER_PREFIX_URL = @"xmlns:ser=\"http://schemas.microsoft.com/2003/10/Serialization/\"";

 

NSString* const HTTP_PREFIX = @"http://";

NSUInteger const FORWARD_FLASH_CHARACTER_VALUE = 47;

// Creates the XML request for the SOAP envelope with optional SOAP headers.

+ (NSString*) createEnvelope: (NSString*) method forNamespace: (NSString*) ns

forParameters: (NSString*) params withHeaders: (NSDictionary*) headers withExtraNameSpace: (NSString *) extraNameSpace

{

    

    NSMutableString* s = [NSMutableStringstring];

    /* example header <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:ser="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:gal="http://schemas.datacontract.org/2004/07/MyNamespace">*/

    [s appendString: @"<?xml version=\"1.0\" encoding=\"utf-8\"?>"];

 

    [s appendString: @"<"];

    [s appendString: SOAP_PREFIX];

    [s appendString:@":Envelope xmlns:"];

    [s appendString: SOAP_PREFIX];

    [s appendString: @"=\"http://schemas.xmlsoap.org/soap/envelope/\" "];

    [s appendString:@" xmlns:"];

    [s appendString: NS_PREFIX];

    [s appendFormat:@"=\"%@\" ",ns ];

    [s appendFormat:@"%@ ",SER_PREFIX_URL];

    if(extraNameSpace)

    {

        [s appendFormat:@" %@ >",extraNameSpace];

    }

    

    if(headers != nil && headers.count > 0) {

        [s appendString: @"<"];

        [s appendString: SOAP_PREFIX];

        [s appendString:@":Header>"];

        

        for(id key in [headers allKeys]) {

            if([[headers objectForKey: key] isMemberOfClass: [SoapNil class]])

            {

                [s appendFormat: @"<%@ xsi:nil=\"true\"/>", key];

            } else {

                [s appendString:[Soap serializeHeader:headers forKey:key]];

            }

        }

        [s appendString: @"</"];

        [s appendString: SOAP_PREFIX];

        [s appendString:@":Header>"];

    }

    

    [s appendString: @"<"];

    [s appendString: SOAP_PREFIX];

    [s appendString:@":Body>"];

    

    NSMutableString* fullMethodName = [NSMutableStringstring];

    [fullMethodName appendString:NS_PREFIX];

    [fullMethodName appendString:@":"];

    [fullMethodName appendString:method];

    

    [s appendFormat: @"<%@>%@</%@>", fullMethodName,[params

                                                     stringByReplacingOccurrencesOfString:@"&" withString:@"&amp;"],

     fullMethodName];

    

    

    [s appendString: @"</"];

    [s appendString: SOAP_PREFIX];

    [s appendString:@":Body>"];

    [s appendString: @"</"];

    [s appendString: SOAP_PREFIX];

    [s appendString:@":Envelope>"];

    return s;

}

 

So in this implementation you see there are more namespaces given. This I discovered after inspecting the WSDL xml and looking for the envelope structure. It could be that in your case the namespace prefix are different. Inspect this yourself.

Then when you call the insert function, just add the extra namespace to the create envelope:

NSString* _envelope = [SoapcreateEnvelope: @"InsertSomething"forNamespace: self.namespacewithParameters: _params withHeaders: self.headers  withExtraNameSpace:SOAP_FUNCTION_PREFIX];


The constant SOAP_FUNCTION_PREFIX looks like this: 

NSString* const SOAP_FUNCTION_PREFIX = @"xmlns:a=\"http://schemas.datacontract.org/2004/07/MyNamespace\""; 


Tags: ,

Comments (4) -

personal injury lawyers austin
personal injury lawyers austin United States
1/4/2014 7:28:18 AM #

My web content ... propecia - peerreview.multilingualwriters.org/.../2929136 I have learn a handful of fantastic things right here. Definitely value bookmarking for revisiting. I wonder how so much effort and hard work you set to produce this kind of fantastic informative website.

car accident attorney Austin
car accident attorney Austin United States
1/23/2014 6:53:13 PM #

Also pay a visit to my weblog; viagra - 210.240.29.141/wiki/index.php?title=Viagra_online I definitely adore your site.. Pleasant colors & topic. Did you make this incredible internet site oneself? Make sure you reply back as I am setting up to make my really possess site and want to discover where by you obtained this from or just what the topic is called. Respect it!

Austin personal injury lawyers
Austin personal injury lawyers United States
1/26/2014 1:30:49 PM #

in fact a great site. I swriously loove your site.. Really nice colors & concept.

accident attorney Austin
accident attorney Austin United States
2/24/2014 10:39:22 PM #

my web site - viagra on the internet - wiki.ku.dk/discoverer/index.php?title=Bruger:Shonda02Ybx Excellent tips for new bloggers. Countless men and women focus on Web site rank. Web page rank is useless if the web site does not have very good articles. Ideal now it looks like Wordpress is the ideal running a blog platform available correct now. (from what I have study) Is that what you're utilizing on your own weblog? I almost acquired an heart attac, due in your set of volume. Excellent things even so! Superior tips for new bloggers. So many men and women focus on Website page rank. Page rank is useless if the web site doesn't have excellent information. Fantastic ideas for new bloggers. A lot of people today focus on Web site rank. Web page rank is useless if the web-site doesn't have superior content. I'm unsure exactly where you are getting your info, but fantastic subject matter. I needs to spend a while understanding a great deal more or knowledge far more. Many thanks for wonderful information and facts I used to be seeking for this data for my mission.

Pingbacks and trackbacks (1)+

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

About the author

I started as a VB6 developer, programming all kinds of applications. I also got involved in the development of a e-market in ASP.

When .Net was introduced, I had the privilege to start in a team of professionals and develop a framework. I learned a lot and started to work as a c#.Net consultant from then on.

After 2 years I also got the chance to work for several months with Sharepoint. Sharepoint kept chasing me all the years after and when the product got more and more mature I started to love it. Now Sharepoint is a somewhat daily occupation for me. I implemented a large quality document management system at PMRL being the only developper/technical analyst. Working close togehter with the QA department we succeeded in making and improving a very good Quality document management system. Its used up until this day.

I worked for 6 years as a .Net consultant for 2 of the largest consultancy companies in Belgium. I mainly worked as a Sharepoint engineer, but also .Net expert and several ASP.Net and Windows applications. One of my last projects with the consultancy was creating a custom LIMS system. This was a succes and the customer asked me to stay and help to expand and maintain this LIMS. I had great years in this company. There was a focus on innovation and a lot of opportunities for improving and developping new IS systems. Apart from several small projects I further more improved the custom LIMS system, created a SOP library based on Sharepoint and a web based Skill matrix system to handle the skills of the employees in the company. 

Then I was involved in transferring the LIMS to a new lab in Singapore. This was done in a short time frame. The deployment was again a success and it passed the GLP inspection tests. I learned a lot from the Quality engineers about validation of computerized systems.

At my current job I have a wide range of challenges. Mainly I'm still working with .Net (VB.net and C#.Net). But outside of the Microsoft world I also do some ABAB programming in our SAP system. Like developing Adobe Forms and the program behind it. Or making small changes to customized code.

Latest I started to follow a course from Stanford Univercity on Objective C programming for IPAD and IPHONE.I just finished the first app for IPad and it appears to be a great succes. People in the factory are working with IPad to take pictures and upload them to orders. Already more and more projects are coming my way. The iOS apps are supported by a home made .Net architecture that exposes WCF services. Its working great. My second app is almost ready for deployment in factories. Now I started an App for the management team so they can manage projects on their IPAD and IPHONE.

My linkedIn!

Month List

Tag cloud

Youtube

Locations of visitors to this page