senojsitruc / wsdl2objc

Automatically exported from code.google.com/p/wsdl2objc
MIT License
0 stars 0 forks source link

STS TemplateEngine error on operation.soapAction #183

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
This problem exists in both trunk and stephane's ARC modified branch.

When I tried to compile my WSDL it generates files but also gives these errors:

WSDLParser[55682:7903] Unable to parse template document : STS TemplateEngine 
encountered *ERROR* in line 161 
Placeholder 'operation.soapAction' is undefined.
Skipping placeholder 'operation.soapAction' to continue.
WSDLParser[55682:7903] errors have ocurred while expanding placeholders in 
string

The full template is at the bottom of this message but the problem is this line:

    "\t[self.binding sendHTTPCallUsingBody:operationXMLString soapAction:@\"%\U00aboperation.soapAction\U00bb\" forOperation:self];",

The web service is running under SAP, and WSDL file is also generated by SAP.. 
I imported WSDLs before for SAP but I didn't check errors, maybe I got this 
error on those files too. I had to modify the code to successfully run web 
services, because SAP couldn't understand some tags when the program creates a 
web service call.. 

Here is the full template:

WSDLParser[55682:7903] using template:
(
    "@implementation %\U00abclassName\U00bb_%\U00aboperation.className\U00bb",
    "",
    "%FOREACH part in operation.input.body.parts",
    "@synthesize %\U00abpart.name\U00bb;",
    "%ENDFOR",
    "%FOREACH header in operation.input.headers",
    "@synthesize %\U00abheader.name\U00bb;",
    "%ENDFOR",
    "",
    "- (id)initWithBinding:(%\U00abclassName\U00bb *)aBinding delegate:(id <%\U00abclassName\U00bbResponseDelegate>)responseDelegate",
    "%FOREACH part in operation.input.body.parts",
    "%\U00abpart.name\U00bb:(%\U00abpart.element.type.classNameWithPtr\U00bb)a%\U00abpart.uname\U00bb",
    "%ENDFOR",
    "%FOREACH header in operation.input.headers",
    "%\U00abheader.name\U00bb:(%\U00abheader.type.classNameWithPtr\U00bb)a%\U00abheader.uname\U00bb",
    "%ENDFOR",
    "{",
    "\tif((self = [super initWithBinding:aBinding delegate:responseDelegate])) {",
    "%FOREACH part in operation.input.body.parts",
    "\t\tself.%\U00abpart.name\U00bb = a%\U00abpart.uname\U00bb;",
    "%ENDFOR",
    "%FOREACH header in operation.input.headers",
    "\t\tself.%\U00abheader.name\U00bb = a%\U00abheader.uname\U00bb;",
    "%ENDFOR",
    "\t}",
    "",
    "\treturn self;",
    "}",
    "",
    "#if !__has_feature(objc_arc)",
    "- (void)dealloc",
    "{",
    "%FOREACH part in operation.input.body.parts",
    "%IFEQ part.element.type.assignOrRetain strong",
    "\tif(%\U00abpart.name\U00bb != nil) [%\U00abpart.name\U00bb release];",
    "%ENDIF",
    "%ENDFOR",
    "%FOREACH header in operation.input.headers",
    "%IFEQ header.type.assignOrRetain strong",
    "\tif(%\U00abheader.name\U00bb != nil) [%\U00abheader.name\U00bb release];",
    "%ENDIF",
    "%ENDFOR",
    "",
    "\t[super dealloc];",
    "}",
    "#endif",
    "",
    "- (void)main",
    "{",
    "#if !__has_feature(objc_arc)",
    "//\t[response autorelease];",
    "#endif",
    "\tself.response = [%\U00abclassName\U00bbResponse new];",
    "",
    "\t%\U00abclassName\U00bb_envelope *envelope = [%\U00abclassName\U00bb_envelope sharedInstance];",
    "",
    "\tNSMutableDictionary *headerElements = nil;",
    "%IFDEF operation.input.headers",
    "\theaderElements = [NSMutableDictionary dictionary];",
    "%FOREACH header in operation.input.headers",
    "%IFEQ header.type.assignOrRetain strong",
    "\tif(%\U00abheader.name\U00bb != nil) [headerElements setObject:%\U00abheader.name\U00bb forKey:@\"%\U00abheader.wsdlName\U00bb\"];",
    "%ELSIFEQ header.type.typeName boolean",
    "\tif(%\U00abheader.name\U00bb != nil) ",
    "#if !__has_feature(objc_arc)",
    "\t\t[headerElements setObject:[[[USBoolean alloc] initWithBool:*%\U00abheader.name\U00bb] autorelease] forKey:@\"%\U00abheader.wsdlName\U00bb\"];",
    "#else",
    "\t\t[headerElements setObject:[[USBoolean alloc] initWithBool:*%\U00abheader.name\U00bb] forKey:@\"%\U00abheader.wsdlName\U00bb\"];",
    "#endif",
    "%ELSIFEQ header.type.typeName byte",
    "\tif(%\U00abheader.name\U00bb != nil) [headerElements setObject:[NSNumber numberWithChar:*%\U00abheader.name\U00bb] forKey:@\"%\U00abheader.wsdlName\U00bb\"];",
    "%ELSIFEQ header.type.typeName int",
    "\tif(%\U00abheader.name\U00bb != nil) [headerElements setObject:[NSNumber numberWithInt:*%\U00abheader.name\U00bb] forKey:@\"%\U00abheader.wsdlName\U00bb\"];",
    "%ELSIFEQ header.type.typeName integer",
    "\tif(%\U00abheader.name\U00bb != nil) [headerElements setObject:[NSNumber numberWithInt:*%\U00abheader.name\U00bb] forKey:@\"%\U00abheader.wsdlName\U00bb\"];",
    "%ELSIFEQ header.type.typeName nonNegativeInteger",
    "\tif(%\U00abheader.name\U00bb != nil) [headerElements setObject:[NSNumber numberWithInt:*%\U00abheader.name\U00bb] forKey:@\"%\U00abheader.wsdlName\U00bb\"];",
    "%ELSIFEQ header.type.typeName positiveInteger",
    "\tif(%\U00abheader.name\U00bb != nil) [headerElements setObject:[NSNumber numberWithInt:*%\U00abheader.name\U00bb] forKey:@\"%\U00abheader.wsdlName\U00bb\"];",
    "%ELSIFEQ header.type.typeName unsignedByte",
    "\tif(%\U00abheader.name\U00bb != nil) [headerElements setObject:[NSNumber numberWithUnsignedChar:*%\U00abheader.name\U00bb] forKey:@\"%\U00abheader.wsdlName\U00bb\"];",
    "%ELSIFEQ header.type.typeName unsignedInt",
    "\tif(%\U00abheader.name\U00bb != nil) [headerElements setObject:[NSNumber numberWithUnsignedInt:*%\U00abheader.name\U00bb] forKey:@\"%\U00abheader.wsdlName\U00bb\"];",
    "%ELSIFEQ header.type.typeName long",
    "\tif(%\U00abheader.name\U00bb != nil) [headerElements setObject:[NSNumber numberWithLong:*%\U00abheader.name\U00bb] forKey:@\"%\U00abheader.wsdlName\U00bb\"];",
    "%ELSIFEQ header.type.typeName unsignedLong",
    "\tif(%\U00abheader.name\U00bb != nil) [headerElements setObject:[NSNumber numberWithUnsignedLong:*%\U00abheader.name\U00bb] forKey:@\"%\U00abheader.wsdlName\U00bb\"];",
    "%ELSIFEQ header.type.typeName short",
    "\tif(%\U00abheader.name\U00bb != nil) [headerElements setObject:[NSNumber numberWithShort:*%\U00abheader.name\U00bb] forKey:@\"%\U00abheader.wsdlName\U00bb\"];",
    "%ELSIFEQ header.type.typeName unsignedShort",
    "\tif(%\U00abheader.name\U00bb != nil) [headerElements setObject:[NSNumber numberWithUnsignedShort:*%\U00abheader.name\U00bb] forKey:@\"%\U00abheader.wsdlName\U00bb\"];",
    "%ELSIFEQ header.type.typeName double",
    "\tif(%\U00abheader.name\U00bb != nil) [headerElements setObject:[NSNumber numberWithDouble:*%\U00abheader.name\U00bb] forKey:@\"%\U00abheader.wsdlName\U00bb\"];",
    "%ELSIFEQ header.type.typeName float",
    "\tif(%\U00abheader.name\U00bb != nil) [headerElements setObject:[NSNumber numberWithFloat:*%\U00abheader.name\U00bb] forKey:@\"%\U00abheader.wsdlName\U00bb\"];",
    "%ELSIFEQ header.type.typeName decimal",
    "\tif(%\U00abheader.name\U00bb != nil) [headerElements setObject:[NSNumber numberWithDouble:*%\U00abheader.name\U00bb] forKey:@\"%\U00abheader.wsdlName\U00bb\"];",
    "%ELSIFNEQ header.type.enumCount 0",
    "\tif(%\U00abheader.name\U00bb != nil) [headerElements setObject:%\U00abheader.type.className\U00bb_stringFromEnum(%\U00abheader.name\U00bb) forKey:@\"%\U00abheader.wsdlName\U00bb\"];",
    "%ENDIF",
    "%ENDFOR",
    "%ENDIF",
    "",
    "\tNSMutableDictionary *bodyElements = nil;",
    "\tNSMutableArray *bodyKeys = nil;",
    "%IFDEF operation.input.body.parts",
    "\tbodyElements = [NSMutableDictionary dictionary];",
    "\tbodyKeys = [NSMutableArray array];",
    "\tid obj = nil;",
    "%FOREACH part in operation.input.body.parts",
    "%IFEQ part.element.type.assignOrRetain strong",
    "\tif(%\U00abpart.name\U00bb != nil) obj = %\U00abpart.name\U00bb;",
    "%ELSIFEQ part.element.type.typeName boolean",
    "#if !__has_feature(objc_arc)",
    "\tif(%\U00abpart.name\U00bb != nil) obj = [[[USBoolean alloc] initWithBool:*%\U00abpart.name\U00bb] autorelease];",
    "#else",
    "\tif(%\U00abpart.name\U00bb != nil) obj = [[USBoolean alloc] initWithBool:*%\U00abpart.name\U00bb];",
    "#endif",
    "%ELSIFEQ part.element.type.typeName byte",
    "\tif(%\U00abpart.name\U00bb != nil) obj = [NSNumber numberWithChar:*%\U00abpart.name\U00bb];",
    "%ELSIFEQ part.element.type.typeName int",
    "\tif(%\U00abpart.name\U00bb != nil) obj = [NSNumber numberWithInt:*%\U00abpart.name\U00bb];",
    "%ELSIFEQ part.element.type.typeName integer",
    "\tif(%\U00abpart.name\U00bb != nil) obj = [NSNumber numberWithInt:*%\U00abpart.name\U00bb];",
    "%ELSIFEQ part.element.type.typeName nonNegativeInteger",
    "\tif(%\U00abpart.name\U00bb != nil) obj = [NSNumber numberWithInt:*%\U00abpart.name\U00bb];",
    "%ELSIFEQ part.element.type.typeName positiveInteger",
    "\tif(%\U00abpart.name\U00bb != nil) obj = [NSNumber numberWithInt:*%\U00abpart.name\U00bb];",
    "%ELSIFEQ part.element.type.typeName unsignedChar",
    "\tif(%\U00abpart.name\U00bb != nil) obj = [NSNumber numberWithUnsignedChar:*%\U00abpart.name\U00bb];",
    "%ELSIFEQ part.element.type.typeName unsignedInt",
    "\tif(%\U00abpart.name\U00bb != nil) obj = [NSNumber numberWithUnsignedInt:*%\U00abpart.name\U00bb];",
    "%ELSIFEQ part.element.type.typeName long",
    "\tif(%\U00abpart.name\U00bb != nil) obj = [NSNumber numberWithLong:*%\U00abpart.name\U00bb];",
    "%ELSIFEQ part.element.type.typeName unsignedLong",
    "\tif(%\U00abpart.name\U00bb != nil) obj = [NSNumber numberWithUnsignedLong:*%\U00abpart.name\U00bb];",
    "%ELSIFEQ part.element.type.typeName short",
    "\tif(%\U00abpart.name\U00bb != nil) obj = [NSNumber numberWithShort:*%\U00abpart.name\U00bb];",
    "%ELSIFEQ part.element.type.typeName unsignedShort",
    "\tif(%\U00abpart.name\U00bb != nil) obj = [NSNumber numberWithUnsignedShort:*%\U00abpart.name\U00bb];",
    "%ELSIFEQ part.element.type.typeName double",
    "\tif(%\U00abpart.name\U00bb != nil) obj = [NSNumber numberWithDouble:*%\U00abpart.name\U00bb];",
    "%ELSIFEQ part.element.type.typeName float",
    "\tif(%\U00abpart.name\U00bb != nil) obj = [NSNumber numberWithFloat:*%\U00abpart.name\U00bb];",
    "%ELSIFEQ part.element.type.typeName decimal",
    "\tif(%\U00abpart.name\U00bb != nil) obj = [NSNumber numberWithDouble:*%\U00abpart.name\U00bb];",
    "%ELSIFNEQ part.element.type.enumCount 0",
    "\tif(%\U00abpart.name\U00bb != nil) obj = %\U00abpart.element.type.className\U00bb_stringFromEnum(%\U00abpart.name\U00bb);",
    "%ENDIF",
    "",
    "\tif(obj != nil) {",
    "\t\t[bodyElements setObject:obj forKey:@\"%\U00abpart.element.wsdlName\U00bb\"];",
    "\t\t[bodyKeys addObject:@\"%\U00abpart.element.wsdlName\U00bb\"];",
    "\t}",
    "%ENDFOR",
    "%ENDIF",
    "",
    "\tNSString *operationXMLString = [envelope serializedFormUsingHeaderElements:headerElements bodyElements:bodyElements bodyKeys:bodyKeys];",
    "\toperationXMLString = self.binding.soapSigner ? [self.binding.soapSigner signRequest:operationXMLString] : operationXMLString;",
    "\t",
    "\t[self.binding sendHTTPCallUsingBody:operationXMLString soapAction:@\"%\U00aboperation.soapAction\U00bb\" forOperation:self];",
    "}",
    "",
    "- (void)connectionDidFinishLoading:(NSURLConnection *)connection",
    "{",
    "\tif(self.responseData != nil && self.delegate != nil){",
    "\t\txmlDocPtr doc;",
    "\t\txmlNodePtr cur;",
    "",
    "\t\tif (self.binding.logXMLInOut) {",
    "#if !__has_feature(objc_arc)",
    "\t\t\tNSLog(@\"ResponseBody:\\n%@\", [[[NSString alloc] initWithData:self.responseData encoding:NSUTF8StringEncoding] autorelease]);",
    "#else",
    "\t\t\tNSLog(@\"ResponseBody:\\n%@\", [[NSString alloc] initWithData:self.responseData encoding:NSUTF8StringEncoding]);",
    "#endif",
    "\t\t}",
    "",
    "#if !TARGET_OS_IPHONE && (!defined(MAC_OS_X_VERSION_10_6) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6)",
    "\t\t// Not yet defined in 10.5 libxml",
    "\t\t#define XML_PARSE_COMPACT 0",
    "#endif",
    "\t\tdoc = xmlReadMemory([self.responseData bytes], [self.responseData length], NULL, NULL, XML_PARSE_COMPACT | XML_PARSE_NOBLANKS);",
    "",
    "\t\tif(doc == NULL){",
    "\t\t\tNSDictionary *userInfo = [NSDictionary dictionaryWithObject:@\"Errors while parsing returned XML\" forKey:NSLocalizedDescriptionKey];",
    "",
    "\t\t\tself.response.error = [NSError errorWithDomain:@\"%\U00abclassName\U00bbResponseXML\" code:1 userInfo:userInfo];",
    "\t\t\t[self completedWithResponse:self.response];",
    "\t\t}",
    "\t\telse{",
    "\t\t\tcur = xmlDocGetRootElement(doc);",
    "\t\t\tcur = cur->children;",
    "",
    "\t\t\tfor(; cur != NULL ; cur = cur->next){",
    "\t\t\t\tif(cur->type == XML_ELEMENT_NODE){",
    "%IF operation.output.hasHeaders",
    "\t\t\t\t\tif(xmlStrEqual(cur->name, (const xmlChar *) \"Header\")){",
    "\t\t\t\t\t\tNSMutableArray\t*responseHeaders = [NSMutableArray array];",
    "\t\t\t\t\t\txmlNodePtr\t\theaderNode;",
    "",
    "\t\t\t\t\t\tfor(headerNode=cur->children; headerNode != NULL; headerNode = headerNode->next){",
    "\t\t\t\t\t\t\tif(cur->type == XML_ELEMENT_NODE){",
    "%FOREACH header in operation.output.headers",
    "\t\t\t\t\t\t\t\tif(xmlStrEqual(headerNode->name, (const xmlChar *) \"%\U00abheader.wsdlName\U00bb\")){",
    "\t\t\t\t\t\t\t\t\t%\U00abheader.type.classNameWithoutPtr\U00bb *headerObject = [%\U00abheader.type.classNameWithoutPtr\U00bb deserializeNode:headerNode];",
    "\t\t\t\t\t\t\t\t\t//NSAssert1(headerObject != nil, @\"Errors while parsing header %s\", headerNode->name);",
    "\t\t\t\t\t\t\t\t\tif (headerObject != nil) [responseHeaders addObject:headerObject];",
    "\t\t\t\t\t\t\t\t}",
    "%ENDFOR",
    "\t\t\t\t\t\t\t}",
    "\t\t\t\t\t\t}",
    "",
    "\t\t\t\t\t\tself.response.headers = responseHeaders;",
    "\t\t\t\t\t}",
    "%ENDIF",
    "",
    "\t\t\t\t\tif(xmlStrEqual(cur->name, (const xmlChar *) \"Body\")){",
    "\t\t\t\t\t\tNSMutableArray\t*responseBodyParts = [NSMutableArray array];",
    "\t\t\t\t\t\txmlNodePtr\t\tbodyNode;",
    "",
    "\t\t\t\t\t\tfor(bodyNode=cur->children; bodyNode != NULL; bodyNode = bodyNode->next){",
    "\t\t\t\t\t\t\tif(cur->type == XML_ELEMENT_NODE){",
    "%FOREACH part in operation.output.body.parts",
    "\t\t\t\t\t\t\t\tif(xmlStrEqual(bodyNode->name, (const xmlChar *) \"%\U00abpart.element.wsdlName\U00bb\")){",
    "\t\t\t\t\t\t\t\t\t%\U00abpart.element.type.classNameWithoutPtr\U00bb *bodyObject = [%\U00abpart.element.type.classNameWithoutPtr\U00bb deserializeNode:bodyNode];",
    "\t\t\t\t\t\t\t\t\t//NSAssert1(bodyObject != nil, @\"Errors while parsing body %s\", bodyNode->name);",
    "\t\t\t\t\t\t\t\t\tif (bodyObject != nil) [responseBodyParts addObject:bodyObject];",
    "\t\t\t\t\t\t\t\t}",
    "%ENDFOR",
    "\t\t\t\t\t\t\t\tif ((bodyNode->ns != nil && xmlStrEqual(bodyNode->ns->prefix, cur->ns->prefix)) && ",
    "\t\t\t\t\t\t\t\t\txmlStrEqual(bodyNode->name, (const xmlChar *) \"Fault\")) {",
    "                                    NSDictionary *exceptions = [NSDictionary dictionaryWithObjectsAndKeys:",
    "%FOREACH fault in operation.faults",
    "                                                                @\"%\U00abschema.prefix\U00bb_%\U00abfault.name\U00bb\", @\"%\U00abfault.name\U00bb\",",
    "%ENDFOR",
    "                                                                nil];",
    "\t\t\t\t\t\t\t\t\tSOAPFault *bodyObject = [SOAPFault deserializeNode:bodyNode expectedExceptions:exceptions];",
    "\t\t\t\t\t\t\t\t\t//NSAssert1(bodyObject != nil, @\"Errors while parsing body %s\", bodyNode->name);",
    "\t\t\t\t\t\t\t\t\tif (bodyObject != nil) [responseBodyParts addObject:bodyObject];",
    "\t\t\t\t\t\t\t\t}",
    "\t\t\t\t\t\t\t}",
    "\t\t\t\t\t\t}",
    "",
    "\t\t\t\t\t\tself.response.bodyParts = responseBodyParts;",
    "\t\t\t\t\t}",
    "\t\t\t\t}",
    "\t\t\t}",
    "",
    "\t\t\txmlFreeDoc(doc);",
    "\t\t}",
    "",
    "\t\txmlCleanupParser();",
    "\t\t[self completedWithResponse:self.response];",
    "\t}",
    "}",
    "",
    "@end"
)

Original issue reported on code.google.com by plat...@gmail.com on 17 Apr 2012 at 8:42