objective c - Connect Webservice through XML -


nsurl *url = [nsurl urlwithstring:@"http://192.168.1.56/amsp/amspws.asmx"];  nsstring *soapmsg=[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>"                    "<postxmlstr xmlns=\"http://tempuri.org/\">"                    "<cust>%@</cust>"                    "<tran>%@</tran>"                    "<ret>%@</ret>"                    "<ppay>%@</ppay>"                    "<recp>%@</recp>"                    "<scode>%@</scode>"                    "<companyshortname>%@</companyshortname>"                    "<companycode>%@</companycode>"                    "</postxmlstr>"                    "</soap:body>"                    "</soap:envelope>",cust,trans,returns,prepayment,receipt,spcode1,companyshortname,companycode];   nsmutableurlrequest *requests = [nsmutableurlrequest requestwithurl:url                                                         cachepolicy:nsurlrequestreloadignoringlocalandremotecachedata                                                     timeoutinterval:5]; nsstring *msglength = [nsstring stringwithformat:@"%d",[soapmsg length]]; [requests sethttpmethod:@"post"]; [requests addvalue:@"text/xml; charset=utf-8" forhttpheaderfield:@"content-type"]; [requests addvalue:msglength forhttpheaderfield:@"content-length"]; [requests addvalue:@"http://tempuri.org/postxmlstr" forhttpheaderfield:@"soapaction"];  [requests sethttpbody:[soapmsg datausingencoding:nsutf8stringencoding ]];  nsurlresponse *response; nserror *error = nil;  nsdata   *data =[[nsmutabledata alloc]init]; data = [nsurlconnection sendsynchronousrequest:requests returningresponse:&response error:&error];  nsstring *stringsoap;  stringsoap = [[nsstring alloc] initwithdata:data encoding:nsmacosromanstringencoding]; nsdictionary *headers = [(nshttpurlresponse *)response allheaderfields]; 

i new connect webservice through objective c. not know how check xml connected webservice. when print stringsoap, not getting value. not know correct way calling xml. how check xml connected webservice or not. appreciated. in advance.

as new, u convert soap service objectivec
sudzc.com
wsdl2objc


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -