开发者

unable to get parameter in webservice [duplicate]

This question already has an answer here: Closed 11 years ago. 开发者_JS百科

Possible Duplicate:

get values from text field to webservice

i have posted similar question before but i didn't get appropriate help! i am repeating. i am uploading parameters from my textField to web service .Everything is going well but i am not able to retreive the values in webservice. plz plz help!! here is my code:

NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

    NSLog(textView1.text);
    NSString *soapMsg = [[NSString alloc] initWithFormat:@"?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"
                         ""
                         "\n"
                         "%@\n"
                         "%@\n"                                                                                                              
                         "%@\n"
                         "%@\n"
                         "\n"
                         "\n"
                         "\n",str1,str2,str3,str4];                       
        NSLog(soapMsg);

    NSURL *url = [NSURL URLWithString:@"http://192.168.0.218:84/WebServiceCustomerByAmit/Service.asmx?op=InsertCustomerInformation"];
    NSLog(@"url. . . .%@", url);
    NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:url];    
    NSLog(@"req....%@", req);
    NSString *msgLength = [NSString stringWithFormat:@"%d", [soapMsg length]];


    NSLog(@"msgLength. . .%@", msgLength);
    [req setValue:@"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
    [req setValue:@"http://tempuri.org/InsertCustomerInformation" forHTTPHeaderField:@"SOAPAction"];
    [req setValue:msgLength forHTTPHeaderField:@"Content-Length"];
    [req setHTTPMethod:@"POST"];
    [req setHTTPBody: [soapMsg dataUsingEncoding:NSUTF8StringEncoding]];
    NSLog(@"req....%@", req);
    NSError *error;
    NSURLResponse *response;
    NSData *urlData=[NSURLConnection sendSynchronousRequest:req returningResponse:&response error:&error];
    if(!response){
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Connection Error" message:@"Failed to Connect to the Internet" delegate:self  cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [alert show];
        [alert release];
    }

    else{
        UIAlertView *alert1 = [[UIAlertView alloc] initWithTitle:@"Connection Successful" message:@"Connected to the Internet" delegate:self  cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [alert1 show];
        [alert1 release];

    }
}

in gdb:

2011-04-13 18:40:36.137 uploadToWeb[6018:20b] strings.....ketan 
2011-04-13 18:40:36.138 uploadToWeb[6018:20b] ketan 
2011-04-13 18:40:36.146 uploadToWeb[6018:20b] ?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/">

ketan 
NSr
9463952542
macos



2011-04-13 18:40:36.148 uploadToWeb[6018:20b] url. . . .http://192.168.0.218:84/WebServiceCustomerByAmit/Service.asmx?op=InsertCustomerInformation
2011-04-13 18:40:36.148 uploadToWeb[6018:20b] req....
2011-04-13 18:40:36.148 uploadToWeb[6018:20b] msgLength. . .430
2011-04-13 18:40:36.149 uploadToWeb[6018:20b] req....

webservice:

unable to get parameter in webservice [duplicate]


Use an HTTP-Proxy like Charles for finding out if your requests are actually formed correctly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜