我曾尝试使用ASIFormDataRequest请求wsdl服务,但它没有正确回复。你可以请任何人指导我的错。
#define SIGNON @"http://smile.stanford.edu:8080/SMILE/spring-ws/StudentSignOn.wsdl"
NSString *Message = [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"
"<stdSignon xmlns=\"http://tempuri.org/\">\n"
"<username>%@</username>\n"
"<password>%@</password>\n"
"</stdSignon>\n"
"</soap:Body>\n"
"</soap:Envelope>\n",txtUserName.text,txtPassword.text];
NSMutableData *soapdata = [[[NSMutableData alloc] initWithData:[Message dataUsingEncoding:NSUTF8StringEncoding]] autorelease];
ASIFormDataRequest *_ASIFormDataRequest = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:SIGNON]];
[_ASIFormDataRequest addRequestHeader:@"Namespace" value:@"http://stanford.edu/smile/studentsignon/schema"];
[_ASIFormDataRequest addRequestHeader:@"Content-Type" value:@"text/xml; charset=utf-8"];
[_ASIFormDataRequest addRequestHeader:@"EndpointURI" value:@"http://stanford.edu/smile/studentsignon"];
[_ASIFormDataRequest setTimeOutSeconds:20];
[_ASIFormDataRequest setPostBody:soapdata];
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0
[_ASIFormDataRequest setShouldContinueWhenAppEntersBackground:YES];
#endif
[_ASIFormDataRequest setDelegate:self];
[_ASIFormDataRequest setDidFailSelector:@selector(asyncFail:)];
[_ASIFormDataRequest setDidFinishSelector:@selector(asyncSuccess:)];
[_ASIFormDataRequest startAsynchronous];
答案 0 :(得分:0)
我使用ASIFormDataRequest
,我认为这是最好的网络框架。而且它也很容易使用。尝试删除自定义选择器,并将NSLog
放入-asyncSuccess:
方法。
- (void)asyncSuccess:(ASIFormDataRequest *)request {
NSLog(@"finished");
// your code from asyncSuccess:
}
如果调用NSLog
,您可以通过[request responseString]
或[request responseData]
获取服务器输出。