0

whenever i try to request my server through NSUrlRequest, an xml code comes in -didRceivedata delegate method. when i print it some body fault come. How to do this?

Nithin Michael
  • 2,166
  • 11
  • 32
  • 56
Saurabh Gulia
  • 285
  • 1
  • 3
  • 13
  • Post your code and error what you get. – Maul Jan 31 '14 at 10:57
  • @Maul i am getting this error: data received is = ns1:Client.NoSOAPAction no SOAPAction header! priyankad-ThinkPad-T410 – Saurabh Gulia Jan 31 '14 at 10:58
  • @Maul my code is: NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://192.168.1.5:9090/IphoneWebService/services/MyWebServiceTest"]]; [request setValue:@"application/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"]; [request setHTTPMethod:@"POST"]; NSString *stringData = @"Hello"; NSData *requestBodyData = [stringData dataUsingEncoding:NSUTF8StringEncoding]; request.HTTPBody = requestBodyData; NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:request delegate:self]; [conn start]; help? – Saurabh Gulia Jan 31 '14 at 11:03
  • @Maul i am not parsing any thing.. response coming is not what i want.. yes i am using SOAP api.. everytime i am receiving is this: soapenv:Body> ns1:Client.NoSOAPAction no SOAPAction header! – Saurabh Gulia Jan 31 '14 at 11:17
  • can you send me the request which you have created and sent to server to get response? – Jekil Patel Feb 01 '14 at 11:58
  • @JekilPatel i have put my entire source code here: http://stackoverflow.com/questions/21478728/error-in-getting-data-from-the-server/21479255?noredirect=1#comment32419037_21479255 – Saurabh Gulia Feb 02 '14 at 14:00
  • @JekilPatel Please help!! – Saurabh Gulia Feb 02 '14 at 14:01

1 Answers1

2

With use of NSURLRequest, You may o/p as below output code/somethng.

To get proper output ,you have to use - NSXMLParserDelegate and its delegate methods as below

-(void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict

-(void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName

-(void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string

I hope, you will get your answer...

Er.Shreyansh Shah
  • 1,482
  • 1
  • 9
  • 29
  • parsing is ok.. but i am not getting the correct xml in response. In i am not getting the correct result. This is what i am getting.: ns1:Client.NoSOAPAction no SOAPAction header! – Saurabh Gulia Jan 31 '14 at 11:07
  • I am not sure. But there may a problem in web service. Plz check web service again. – Er.Shreyansh Shah Jan 31 '14 at 11:29
  • 1
    can you send me the request which you have created and sent to server to get response? Kindly check your request that you have created to get response. – Jekil Patel Feb 01 '14 at 11:55