我用WSDL2OBJC生成了代码。 我有很大的问题,在我的目标C客户端请求:Objective-C SOAP客户端 - 请求问题?
CatalogoPortBinding *binding = [[CatalogoSvc CatalogoPortBinding] initWithAddress:@"http://localhost:8080/WSServer/Catalogo_V1"];
binding.logXMLInOut = YES; // to get logging to the console.
CatalogoSvc_hello *request = [[CatalogoSvc_hello alloc] init];
NSString *t = @"David";
request.name = t;
NSLog(@"request: %@",request.name);
CatalogoPortBindingResponse *response = [binding helloUsingParameters:request];
//NSLog(@"%@",resp.bodyParts);
for (id mine in response.bodyParts)
{
NSLog(@"name: %@",[mine return_]);
if ([mine isKindOfClass:[CatalogoSvc_helloResponse class]])
{
if (sec == YES) {
//NSLog(@"name: %@",[mine return_]);
NSString *texto = (NSString*)[mine return_];
[lab setText:(NSString*)texto];
}
}
}
我的控制台显示:
2011-08-31 12:29:05.086 Catalogo-V1[3596:207] request: David
2011-08-31 12:29:05.088 Catalogo-V1[3596:207] OutputHeaders:
{
"Content-Length" = 434;
"Content-Type" = "text/xml; charset=utf-8";
Host = localhost;
Soapaction = "";
"User-Agent" = wsdl2objc;
}
2011-08-31 12:29:05.088 Catalogo-V1[3596:207] OutputBody:
<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:CatalogoSvc="http://org/" xsl:version="1.0">
<soap:Body>
<CatalogoSvc:hello>
<CatalogoSvc:name>David</CatalogoSvc:name>
</CatalogoSvc:hello>
</soap:Body>
</soap:Envelope>
2011-08-31 12:29:05.093 Catalogo-V1[3596:207] ResponseStatus: 200
2011-08-31 12:29:05.094 Catalogo-V1[3596:207] ResponseHeaders:
{
"Content-Type" = "text/xml;charset=utf-8";
Date = "Wed, 31 Aug 2011 10:29:05 GMT";
Server = "GlassFish Server Open Source Edition 3.1.1";
"Transfer-Encoding" = Identity;
"X-Powered-By" = "Servlet/3.0 JSP/2.2 (GlassFish Server Open Source Edition 3.1.1 Java/Apple Inc./1.6)";
}
2011-08-31 12:29:05.094 Catalogo-V1[3596:207] ResponseBody:
<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:helloResponse xmlns:ns2="http://org/"><return>Hello null !</return></ns2:helloResponse></S:Body></S:Envelope>
2011-08-31 12:29:05.095 Catalogo-V1[3596:207] name: Hello null !
我需要显示这样的信息:“你好!大卫”我收到:“你好null!”。
我需要帮助.......我已经在Java中生成了很多不同的Web服务,结果是一样的,我知道问题出在了目标C SOAP客户端上。我已经展示了这个教程,并且我已经遵循了这个 - > http://myblack.net/showthread.php?399-iPhone-Development-Accessing-SOAP-Services-with-WSDL2ObjC – Davidin073