Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iPhone应用程序-下面的输入是否足以请求webmethod?_Iphone_Ios_Nsurlconnection - Fatal编程技术网

iPhone应用程序-下面的输入是否足以请求webmethod?

iPhone应用程序-下面的输入是否足以请求webmethod?,iphone,ios,nsurlconnection,Iphone,Ios,Nsurlconnection,对于iPhone应用程序,下面的输入是否足以请求SOAP webmethod?在Android中,方法名称、soap操作、名称空间、url和输入参数就足够了。iOS应用程序呢 我看了一下示例iPhone代码- -(IBAction)btnFindCountry:(id)sender { NSString *soapMsg = [NSString stringWithFormat: @"<?xml version=\"1.0\" encoding=\"utf-8\"?>"

对于iPhone应用程序,下面的输入是否足以请求SOAP webmethod?在Android中,方法名称、soap操作、名称空间、url和输入参数就足够了。iOS应用程序呢

我看了一下示例iPhone代码-

-(IBAction)btnFindCountry:(id)sender { 

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>"
 "<GetGeoIP xmlns=\"http://www.webservicex.net/\">"
 "<IPAddress>3.4.5.6</IPAddress>"
 "</GetGeoIP>"
 "</soap:Body>"
 "</soap:Envelope>"]; 

//---print it to the Debugger Console for verification---
NSLog(@"%@",soapMsg); 

NSURL *url = [NSURL URLWithString:
              @"http://www.webservicex.net/geoipservice.asmx"];

NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:url];

//---set the various headers---
NSString *msgLength = [NSString stringWithFormat:@"%d", [soapMsg length]];

[req addValue:@"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];

[req addValue:@"http://www.webservicex.net/GetGeoIP" forHTTPHeaderField:@"SOAPAction"];

[req addValue:msgLength forHTTPHeaderField:@"Content-Length"];

 //---set the HTTP method and body---
[req setHTTPMethod:@"POST"]; 

[req setHTTPBody:[soapMsg dataUsingEncoding:NSUTF8StringEncoding]];

 //---start animating--

 [activityIndicator startAnimating]; 

 conn = [[NSURLConnection alloc] initWithRequest:req  delegate:self];

         if (conn) { 
             webData = [[NSMutableData data] retain];
         }

}
非常感谢。我找到了解决方案--“用户名”和“密码”
Name: xxyy

Binding: Book247XMLWebServiceForMobileBinding

Endpoint: yyxx.com/webservice/indexMobile.php

SoapAction: yyxx.com/webservice/Book247XMLWebServiceForMobile.wsdl#tGetSearchDataByCategories

Style: rpc

Input:

  use: encoded

  namespace: yyxx.com/webservice/Book247XMLWebServiceForMobile.wsdl

  encodingStyle: schemas.xmlsoap.org/soap/encoding/

  message: tGetSearchDataByCategoriesRequest

  parts:

    vendor_access_url: xsd:string

    category_id: xsd:integer

    subcategory_id: xsd:integer

Output:
  use: encoded

  namespace: yyxx.com/webservice/Book247XMLWebServiceForMobile.wsdl
  encodingStyle:schemas.xmlsoap.org/soap/encoding/
  message: xxyy
  parts:
    return: tns:Searches

Namespace: webservice/Book247XMLWebServiceForMobile.wsdl

Transport: schemas.xmlsoap.org/soap/http