在ios中的本地主机中调用SOAP web服务

在ios中的本地主机中调用SOAP web服务,ios,Ios,我有本地托管的soap Web服务!我从另一个角度来称呼它;android,Windows,但我无法从ios调用它?任何想法。我已经成功地从ios调用了在线soap Web服务。为了在ios中调用soap本地web服务,我必须做哪些更改。这是我的代码注释:我正在开发它,因为phonegap插件在线Web服务被成功调用 // // Hello.m // helloi // // Created by procit on 4/25/14. // // #import "Hello.

我有本地托管的soap Web服务!我从另一个角度来称呼它;android,Windows,但我无法从ios调用它?任何想法。我已经成功地从ios调用了在线soap Web服务。为了在ios中调用soap本地web服务,我必须做哪些更改。这是我的代码注释:我正在开发它,因为phonegap插件在线Web服务被成功调用

    //
//  Hello.m
//  helloi
//
//  Created by procit on 4/25/14.
//
//


#import "Hello.h"
#import <Cordova/CDV.h>
@implementation Hello
- (void)echo:(CDVInvokedUrlCommand*)command
{
    CDVPluginResult* pluginResult = nil;
     NSString *echo = [command.arguments objectAtIndex:0]; // args value assign in echo here
    // NSLog(@"%@", echo);


    NSString *soapMsg = [NSString stringWithFormat:@"<?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"
                         "<soap:Body>\n"
                         "<PingResponse xmlns=\"http://Smartflowtest.88degrees.nl/mobilewebservice/\">\n"
                         "<compressed>%@</compressed>\n"
                         "</Ping>\n"
                         "</soap:Body>\n"
                         "</soap:Envelope>", echo];


    NSURL *url = [NSURL URLWithString:@"http://192.168.100.2/mobilewebservice_ganesh/services.asmx"];
    NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
    NSString *msgLength = [NSString stringWithFormat:@"%d", [soapMsg length]];
   // NSLog(@"%@", msgLength); // shows the length of soap msg

    [theRequest addValue:@"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type" ] ;
    [theRequest addValue:@"http://Smartflowtest.88degrees.nl/mobilewebservice/Ping" forHTTPHeaderField:@"SOAPAction"];
    [theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"];
    [theRequest setHTTPMethod:@"POST"];
    [theRequest addValue:@"192.168.100.2" forHTTPHeaderField:@"HOST"];
    [theRequest setHTTPBody:[soapMsg dataUsingEncoding:NSUTF8StringEncoding]];

    theconnection = [[NSURLConnection alloc] initWithRequest: theRequest delegate:self];



    NSError *errorReturned = nil;
    NSURLResponse *theResponse =[[NSURLResponse alloc]init];
    NSData *data = [NSURLConnection sendSynchronousRequest:theRequest
                                         returningResponse:&theResponse
                                                     error:&errorReturned];
    //NSLog(data);
    if (errorReturned)
    {
        //...handle the error
        pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR];
    }
    else
    {
        NSString *retVal = [[NSString alloc] initWithData:data
                                                 encoding:NSUTF8StringEncoding ];

        NSLog(@"%@", retVal);

        pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:retVal];


    }

   [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}



@end

您需要提供更多信息才能获得帮助。请提供您用来调用SOAP服务的代码我已经添加了我的代码!你能帮忙吗