Open GoogleCodeExporter opened 8 years ago
I am seeing this exact same behavior in my application. The only thing I can
add to what was posted above is
that the service I am connecting to was written/generated via Apache Axis. Not
sure if that makes a difference or
not.
Original comment by corey.th...@gmail.com
on 11 Feb 2010 at 12:14
I was able to workaround this issue. I changed the serialization method to what
is shown below and then
updated all of the invocations to pass in the method name and it seems to work.
<code>
- (NSString *)serializedFormUsingHeaderElements:(NSString*) methodName
:(NSDictionary *)headerElements
:(NSDictionary *)bodyElements
{
xmlDocPtr doc;
doc = xmlNewDoc((const xmlChar*)XML_DEFAULT_VERSION);
if (doc == NULL) {
NSLog(@"Error creating the xml document tree");
return @"";
}
xmlNodePtr root = xmlNewDocNode(doc, NULL, (const xmlChar*)"Envelope", NULL);
xmlDocSetRootElement(doc, root);
xmlNsPtr soapEnvelopeNs = xmlNewNs(root, (const
xmlChar*)"http://schemas.xmlsoap.org/soap/envelope/", (const
xmlChar*)"soapenv");
xmlSetNs(root, soapEnvelopeNs);
//xmlNsPtr xslNs = xmlNewNs(root, (const xmlChar*)"http://www.w3.org/1999/XSL/Transform", (const
xmlChar*)"xsl");
/*xmlNsPtr xsiNs = */xmlNewNs(root, (const xmlChar*)"http://www.w3.org/2001/XMLSchema-instance",
(const xmlChar*)"xsi");
//xmlNewNsProp(root, xslNs, (const xmlChar*)"version", (const xmlChar*)"1.0");
xmlNewNs(root, (const xmlChar*)"http://www.w3.org/2001/XMLSchema", (const xmlChar*)"xsd");
xmlNsPtr serviceNs = xmlNewNs(root, (const xmlChar*)"http://webservice.memmgmt.stercomm.com/",
(const xmlChar*)"web");
xmlNewNs(root, (const xmlChar*)"http://model.memmgmt.stercomm.com", (const xmlChar*)"tns1");
//xmlNewNs(root, (const xmlChar*)"http://xml.apache.org/xml-soap", (const xmlChar*)"apachesoap");
xmlNewNs(root, (const xmlChar*)"http://schemas.xmlsoap.org/soap/encoding/", (const xmlChar*)"ns1");
if((headerElements != nil) && ([headerElements count] > 0)) {
xmlNodePtr headerNode = xmlNewDocNode(doc, soapEnvelopeNs, (const xmlChar*)"Header", NULL);
xmlAddChild(root, headerNode);
for(NSString *key in [headerElements allKeys]) {
id header = [headerElements objectForKey:key];
xmlAddChild(headerNode, [header xmlNodeForDoc:doc elementName:key]);
}
}
if((bodyElements != nil) && ([bodyElements count] > 0)) {
xmlNodePtr bodyNode = xmlNewDocNode(doc, soapEnvelopeNs, (const xmlChar*)"Body", NULL);
xmlAddChild(root, bodyNode);
xmlNodePtr methodNode = xmlNewDocNode(doc, serviceNs, (const xmlChar*) [methodName
UTF8String], NULL);
xmlAddChild(bodyNode, methodNode);
for(NSString *key in [bodyElements allKeys]) {
id body = [bodyElements objectForKey:key];
xmlAddChild(methodNode, [body xmlNodeForDoc:doc elementName:key]);
//xmlSetNsProp(childNode, xsiNs, (const xmlChar*) "type", (const xmlChar*) "xsd:string");
}
}
xmlChar *buf;
int size;
xmlDocDumpFormatMemory(doc, &buf, &size, 1);
NSString *serializedForm = [NSString stringWithCString:(const char*)buf
encoding:NSUTF8StringEncoding];
xmlFree(buf);
xmlFreeDoc(doc);
return serializedForm;
}
</code>
Original comment by corey.th...@gmail.com
on 11 Feb 2010 at 1:45
Same issue here with latest svn. The workaround from comment #2 works, but is
obviously not ideal.
Original comment by krabien
on 1 Mar 2011 at 1:39
Original issue reported on code.google.com by
developm...@raisesolutions.com
on 5 Feb 2010 at 11:17Attachments: