мыльный веб-сервис - PullRequest
       2

мыльный веб-сервис

0 голосов
/ 26 марта 2011

Я анализирую мыльный веб-сервис для аутентификации, но он не повторяет повторение NSData, чтобы я мог написать для него xx-парсер.

Пожалуйста, дайте мне знать, что я делаю неправильно.

Вот мой код:

**
-(void)getAdvertisment
{
    NSString* soapMesasge=
    [NSString stringWithFormat:@"<?xml version=\"1.0\" encoding=\"utf-8\"?>"
    "<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/\">"
      "<soap:Body>"
      "<GetAdvertisement xmlns=\"http://tempuri.org/\" />"
      "</soap:Body>"
      "</soap:Envelope>"];**



    NSURL* url=[NSURL URLWithString:@"http://codeexsolutions.com/HosService/ServiceHOSProvider.asmx"];
    NSMutableURLRequest* theRequest=[NSMutableURLRequest requestWithURL:url];
    NSString* msgLength=[NSString stringWithFormat:@"%d",[soapMesasge length]];

    [theRequest addValue:@"text/xml" forHTTPHeaderField:@"Content-Type"];
    [theRequest addValue:@"http://tempuri.org/GetAdvertisement" forHTTPHeaderField:@"SOAPAction"];
    [theRequest addValue:msgLength forHTTPHeaderField:@"Content-Length"];
    [theRequest setHTTPMethod:@"POST"];
    [theRequest setHTTPBody:[soapMesasge dataUsingEncoding:NSUTF8StringEncoding]];
    NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
    if (theConnection)
    {
        webData =[[NSMutableData alloc]retain];
    }
    else
    {
        // Inform the user that the connection failed.
    }   

}

1 Ответ

0 голосов
/ 27 марта 2011

NSURLConnection - это асинхронный метод - реализовали ли вы остальные методы делегата, необходимые для фактического прослушивания и получения данных?

Возможно, вы захотите просмотреть документацию здесь

В приведенном выше примере webData всегда будет пустой, вы можете заполнить ее ...

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...