我用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