calling soap web service with wshttpbinding & transport security

I created service with wshttpbinding with transport security in it, using Nsurlconnection, but i get status code 400....


web Coinfig is:


<?xml version="1.0"?>
<configuration>

  <system.web>
    <compilation targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="TransportSecurity">
          <security mode="Transport">
            <transport clientCredentialType="None"></transport>
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <services>
      <service name="AndService.Service" behaviorConfiguration="HttpsServicebehaviour">
        <endpoint address="" binding="wsHttpBinding" contract="AndService.Service" bindingConfiguration="TransportSecurity">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="HttpsServicebehaviour">
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpsGetEnabled="false"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
<system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
</configuration>


is that possible to call web service with "WShttpbinding" in ios? &

How can we do that?

my code is:


/
- (NSString* )serviceCall{
    NSString *soapActionURL;
soapActionURL=[NSString stringWithFormat: @"http://tempuri.org/IService/GetData"];
    NSString *soapMessage = [NSString stringWithFormat:
                             @"<s:Envelope xmlns:s=\"http:/
                             " <s:Body>\n"
                                "<GetData xmlns=\"http:/
                                "<value>10</value>\n"
                                "</GetData>\n"
                             "</s:Body>\n"
                            "</s:Envelope>\n"];
    url = [NSURL URLWithString:@"https://192.168.0.10/AndService/Service.svc"];
    NSOperationQueue *queue = [[NSOperationQueue alloc] init];
    NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
    NSString *msgLength = [NSString stringWithFormat:@"%lu", (unsigned long)[soapMessage length]];
    NSData* bodyData = [soapMessage dataUsingEncoding:NSUTF8StringEncoding];
    NSUInteger bodyDataLength = [bodyData length];
    [theRequest setTimeoutInterval:10.0f];
    [theRequest addValue: @"application/soap+xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
    [theRequest addValue: soapActionURL forHTTPHeaderField:@"SOAPAction"];
    [theRequest addValue: [NSString stringWithFormat:@"%lu", (unsigned long)bodyDataLength] forHTTPHeaderField:@"Content-Length"];
    [theRequest setHTTPMethod:@"POST"];
    [theRequest setHTTPBody: bodyData];
    NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
    if (theConnection) {
        webData = [NSMutableData data] ;
    }
}
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
    /
    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
    NSLog(@"Status code %ld", (long)[httpResponse statusCode]);
    [webData setLength:0];
}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
    /
    [webData appendData:data];
}
- (void) connectionDidFinishLoading:(NSURLConnection *)connection {
    NSMutableArray *list =[[NSMutableArray alloc]init];
    NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithData:webData];
    NSString *xmlData = [[NSString alloc]
                         initWithBytes:[webData mutableBytes]
                         length:[webData length]
                         encoding:NSUTF8StringEncoding];
    NSLog(xmlData);
}
/
- (BOOL) connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace {
/
    BOOL authResult;
    authResult= [protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust];
    /
    if(authResult)
    {
        NSLog(@"Auth is Ok");
    }
    return authResult;
}
- (void) connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {
    NSLog(@"___didReceiveAuthenticationChallenge");
    if([challenge.protectionSpace.authenticationMethod isEqualToString: NSURLAuthenticationMethodServerTrust]) {
        /
        if ([challenge.protectionSpace.host isEqualToString: challenge.protectionSpace.host]) {
             NSLog(@"trusting connection to host %@", challenge.protectionSpace.host);
            NSURLCredential *credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust];
            [challenge.sender useCredential:credential forAuthenticationChallenge:challenge];
        }
    }
    [challenge.sender continueWithoutCredentialForAuthenticationChallenge:challenge];
}
-(void) connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
     NSLog(@"@%",error);
}

Haven’t we done this already? You really need to follow the advice I gave you in your previous thread.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Hello Eskimo


I follow your all instruction that you told me in previous thread ...

but in this thread my question is:

is that possible to call soap service with wshttpbinding from ios?

because when i do r & d on this wshttpbinding & NetTcpBinding for ios i see that ios support basicbinding base service and RESTfull service and not other binding base services(not easily).....

calling soap web service with wshttpbinding & transport security
 
 
Q