2011-03-26 4 views
0

인증을 위해 비누 웹 서비스를 구문 분석하고 있지만 NSDF 데이터를 다시 작성할 필요가 없으므로 xml 파서를 writex 할 수 있습니다.비누 웹 서비스

내가 뭘 잘못하고 있는지 알려 주시기 바랍니다.

** 
-(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. 
    } 

} 
+0

이 자신을 편집 할 수 있습니다 –

+0

위의 코드는 당신이 원한다면 질문. – gideon

+0

가능한 [soap web service parsing] 중복 (http://stackoverflow.com/questions/5456212/soap-web-service-parsing) –

답변

0

있는 NSURLConnection 비동기 방법입니다 - 당신이 실제로 수신하고 데이터를 검색하는 데 필요한 대리자 메서드의 나머지 부분을 구현 : 여기에

내 코드?

당신은 WEBDATA 항상 그것을 채우기 위해 당신까지, 비어있을 것입니다 위의 예에서 documentation here

을 검토 할 수도 있습니다 ...

관련 문제