Note that there are some explanatory texts on larger screens.

plurals
  1. PONot getting response from server on iPhone
    primarykey
    data
    text
    <p>I am new to iPhone programming. Using the code below I send a request to the server but I am not getting output. Can anybody tell me what is mistake in this code?</p> <pre><code>NSString *soapMessage=[NSString stringWithFormat: @"&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n" "&lt;soap:Envelope \n" "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \n" "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n" "xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope\"&gt;\n" "&lt;soap:Body&gt;\n" "&lt;OnlineStatus xmlns=\"http://tempuri.org\"&gt;\n" "&lt;CafeName&gt;CyberCafeName&lt;/CafeName&gt;\n" "&lt;FromDate&gt;9/4/2012&lt;/FromDate&gt;\n" "&lt;ToDate&gt; 5/5/2013&lt;/ToDate&gt;\n" "&lt;/OnlineStatus&gt;\n" "&lt;/soap:Body&gt;\n" "&lt;/soap:Envelope&gt;"]; NSLog(@"%@",soapMessage); NSURL *url = [NSURL URLWithString:@"http://www.ebidmanagerdemo.com/gjHouseOnline/xml/XMLDataService.asmx"]; NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url]; NSString *msgLength = [NSString stringWithFormat:@"%d", [soapMessage length]]; [theRequest addValue: @"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"]; [theRequest addValue: @"http://tempuri.org/OnlineStatus" forHTTPHeaderField:@"Soapaction"]; [theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"]; [theRequest setHTTPMethod:@"POST"]; [theRequest setHTTPBody: [soapMessage dataUsingEncoding:NSUTF8StringEncoding]]; NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; if(theConnection) { webData = [NSMutableData data]; } else { NSLog(@"theConnection is NULL"); NSString *msgLength = [NSString stringWithFormat:@"%d", [soapMessage length]]; NSLog(@"%@",msgLength); </code></pre> <p>I am getting this output error message in the console:</p> <pre><code> 2013-05-20 17:28:26.447 NewC Newcafezee[1166:11303] &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;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"&gt; &lt;soap:Body&gt; &lt;OnlineStatus xmlns="http://tempuri.org"&gt; &lt;CafeName&gt;CyberCafeName&lt;/CafeName&gt; &lt;FromDate&gt;9/4/2012&lt;/FromDate&gt; &lt;ToDate&gt; 5/5/2013&lt;/ToDate&gt; &lt;/OnlineStatus&gt; &lt;/soap:Body&gt; &lt;/soap:Envelope&gt; 2013-05-20 17:28:28.355 NewC Newcafezee[1166:11303] &lt;?xml version="1.0" encoding="utf-8"?&gt;&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;&lt;soap:Header&gt;&lt;soap12:Upgrade xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"&gt;&lt;soap12:SupportedEnvelope qname="soap:Envelope" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" /&gt;&lt;soap12:SupportedEnvelope qname="soap12:Envelope" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope" /&gt;&lt;/soap12:Upgrade&gt;&lt;/soap:Header&gt;&lt;soap:Body&gt;&lt;soap:Fault&gt;&lt;faultcode&gt;soap:VersionMismatch&lt;/faultcode&gt;&lt;faultstring&gt;System.Web.Services.Protocols.SoapException: Possible SOAP version mismatch: Envelope namespace http://schemas.xmlsoap.org/soap/envelope was unexpected. Expecting http://schemas.xmlsoap.org/soap/envelope/. at System.Web.Services.Protocols.SoapServerProtocol.CheckHelperVersion() at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters() at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()&lt;/faultstring&gt;&lt;detail /&gt;&lt;/soap:Fault&gt;&lt;/soap:Body&gt;&lt;/soap:Envelope&gt; 2013-05-20 17:28:28.357 NewC Newcafezee[1166:11303] fsdfsd </code></pre> <p>This original soap request</p> <pre><code>POST /gjHouseOnline/xml/XMLDataService.asmx HTTP/1.1 Host: www.ebidmanagerdemo.com Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://tempuri.org/OnlineStatus" &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;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/"&gt; &lt;soap:Body&gt; &lt;OnlineStatus xmlns="http://tempuri.org/"&gt; &lt;CafeName&gt;string&lt;/CafeName&gt; &lt;FromDate&gt;dateTime&lt;/FromDate&gt; &lt;ToDate&gt;dateTime&lt;/ToDate&gt; &lt;/OnlineStatus&gt; &lt;/soap:Body&gt; &lt;/soap:Envelope&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload