У меня есть 2 службы SOAP, которые я хочу вызвать из приложения IPad.
Одна используется для входа пользователя в систему (SecurityASMX), другая - та, которая возвращает текущее имя пользователя (SecuredCalls) после входа в систему.в.
Я могу вызвать SecurityASMX без проблем, используя следующий код.Асинхронный обратный вызов - это операция :
- (IBAction) OnButtonClick:(id) sender {
bindingSecurity = [[SecurityASMXSvc SecurityASMXSoapBinding] initWithAddress:@"http://myserver/Azur.IPADTest.Web.Services/public/Security.asmx"];
bindingSecurity.logXMLInOut = YES;
SecurityASMXSvc_Login *requestLogin = [[SecurityASMXSvc_Login alloc] init];
requestLogin.strUsername = @"test";
requestLogin.strPassword = @"testpass";
[bindingSecurity LoginAsyncUsingParameters:requestLogin delegate:self];
[requestLogin release];
self.label.text = @"Login in progress";
}
- (void) operation:(SecurityASMXSoapBindingOperation *)operation completedWithResponse:(SecurityASMXSoapBindingResponse *)response
{
[NSThread sleepForTimeInterval:2.0];
self.label.text = @"Login Done!";
}
Это прекрасно работает.
Однако в том же файле кода у меня есть привязка ко второму веб-сервису:верните имя пользователя со следующим кодом.Асинхронный обратный вызов: operationSecure :
- (IBAction) OnButtonSecureCallClick:(id) sender {
bindingSecuredCalls = [[SecureCallsSvc SecureCallsSoapBinding] initWithAddress:@"http://myserver/Azur.IPADTest.Web.Services/private/SecureCalls.asmx"];
bindingSecuredCalls.logXMLInOut = YES;
SecureCallsSvc_ReturnUserName *requestReturnUserName = [[SecureCallsSvc_ReturnUserName alloc] init];
[bindingSecuredCalls ReturnUserNameAsyncUsingParameters:requestReturnUserName delegate:self];
[requestReturnUserName release];
self.label.text = @"Get UserName In Progress";
}
- (void) operationSecure:(SecureCallsSoapBindingOperation *)operation completedWithResponse:(SecureCallsSoapBindingResponse *)response
{
[NSThread sleepForTimeInterval:2.0];
self.label.text = @"Get Username Done!";
}
Проблема заключается в том, что при возврате вызова ReturnUserName вызывается вызываемый метод для входа в систему (операция )1018 *), а не тот, который я хочу ( operationSecure ).
Как я могу указать моей второй привязке веб-службы вызвать второй обратный вызов?
Спасибо!