NSString *urlString = @"http://172.29.165.219:8090/abc/services/Abc";
NSString *soapMessage = [NSString stringWithFormat:
@"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n"
"<soap:Body>\n"
"<getUserInfo>\n"
"<email>%@</email>\n"
"<pwd>%@</pwd>\n"
"</getUserInfo>\n"
"</soap:Body>\n"
"</soap:Envelope>\n", @"babla.sharan@tcs.com",@"UGFzc0AxMjM="//,@"50006F0063006B0065007400500043000000-444556494345454D00",@"PocketPC"
];
NSMutableURLRequest *loginRequest = [RequestGenerator -generateSOAPRequestWithURLString:urlString soapMessage:soapMessage contentType:@"text/xml; charset=utf-8" action:@"getUserInfo"];
WebServiceHandler *connection = [[WebServiceHandler alloc]init];
对于上面的代码,它工作正常,但是当我将附加标签作为父标签添加到 id 和密码时
NSString *urlString = @"http://172.29.165.219:8090/abc/services/Abc";
NSString *soapMessage = [NSString stringWithFormat:
@"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n"
"<soap:Body>\n"
"<getUserInfo>\n"
**"<ABC>\n"**
"<email>%@</email>\n"
"<pwd>%@</pwd>\n"
**"</ABC>\n"**
"</getUserInfo>\n"
"</soap:Body>\n"
"</soap:Envelope>\n", @"babla.sharan@tcs.com",@"UGFzc0AxMjM="//,@"50006F0063006B0065007400500043000000-444556494345454D00",@"PocketPC"
];
NSMutableURLRequest *loginRequest = [RequestGenerator generateSOAPRequestWithURLString:urlString soapMessage:soapMessage contentType:@"text/xml; charset=utf-8" action:@"getUserInfo"];
WebServiceHandler *connection = [[WebServiceHandler alloc]init];
它显示异常并收到此错误:
org.xml.sax.SAXException:SimpleDeserializer 在尝试反序列化的过程中遇到了一个子元素,这不是预期的。
它甚至不允许我访问服务器。