この応答を解析するための助けが必要です。それは WSDL だと思います。「Successfully Entered」という文字列を確認したいと思います。以下はコードです:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://example.com/reg/abc">
<soapenv:Header/>
<soapenv:Body>
<sch:LoginResponse>
<sch:Status code=200>Successfully Entered</sch:Status>
<sch:Message>[CDATA[Successfully Entered]]</sch:Message>
</sch:LoginResponse>
</soapenv:Body>
</soapenv:Envelope>
編集:以下は私が実装したコードです
-(void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *) namespaceURI qualifiedName:(NSString *)qName
attributes: (NSDictionary *)attributeDict
{
NSLog(@"START ELEMENT NAME ==> %@", elementName);
if( [elementName isEqualToString:@"sch:Status"])
{
if(!soapResults)
{
soapResults = [[NSMutableString alloc] init];
}
elementFound = YES;
}
}
-(void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
{
if( elementFound )
{
[soapResults appendString:string];
}
}
-(void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
{
NSLog(@"END ELEMENT NAME ==> %@", elementName);
if( [elementName isEqualToString:@"sch:Status"])
{
NSLog(@"Found ==> %@", soapResults);
[soapResults setString:@""];
elementFound = FALSE;
}
}
印刷ログはsch:LoginResponse
要素名まで表示され、表示されませんsch:Status