Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/71.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
Ios5 从xcode4.3调用wcf服务_Ios5_Xcode4.3_Wsdl2objc - Fatal编程技术网

Ios5 从xcode4.3调用wcf服务

Ios5 从xcode4.3调用wcf服务,ios5,xcode4.3,wsdl2objc,Ios5,Xcode4.3,Wsdl2objc,我是一名.Net程序员,也是Xcode的初学者。我想在UITableViewController中显示iPad上WCF服务的结果。我已经使用wsdl2objc成功地为服务创建了存根。创建的SOAP消息如下所示: 2012-07-25 14:02:37.169 TestWCF[5280:fb03] OutputHeaders: { "Content-Length" = 572; "Content-Type" = "text/xml; charset=utf-8"; Host = "XX

我是一名.Net程序员,也是Xcode的初学者。我想在UITableViewController中显示iPad上WCF服务的结果。我已经使用wsdl2objc成功地为服务创建了存根。创建的SOAP消息如下所示:

2012-07-25 14:02:37.169 TestWCF[5280:fb03] OutputHeaders:
{
  "Content-Length" = 572;
  "Content-Type" = "text/xml; charset=utf-8";
  Host = "XXX.XXX.XXX";
  SOAPAction = "http://tempuri.org/IDocSync/getAllCategories";
  "User-Agent" = wsdl2objc;
}
2012-07-25 14:02:37.172 TestWCF[5280:fb03] OutputBody:
<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"          xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-   instance" xmlns:xs="http://www.w3.org/2001/XMLSchema"      xmlns:iPadDocSyncServiceSvc="http://tempuri.org/" xmlns:ns1="http://tempuri.org/Imports" xmlns:tns1="http://schemas.datacontract.org/2004/07/DocSyncService"   xmlns:tns2="http://schemas.microsoft.com/2003/10/Serialization/" xsl:version="1.0">
<soap:Body>
<iPadDocSyncServiceSvc:getAllCategories/>
</soap:Body>
</soap:Envelope>
2012-07-25 14:03:03.119 TestWCF[5280:fb03] ResponseStatus: 200
2012-07-25 14:03:03.120 TestWCF[5280:fb03] ResponseHeaders:
{
  "Cache-Control" = private;
  "Content-Encoding" = gzip;
 "Content-Length" = 421;
 "Content-Type" = "text/xml; charset=utf-8";
  Date = "Wed, 25 Jul 2012 06:03:02 GMT";
 Server = "Microsoft-IIS/7.5";
 "Set-Cookie" = "ASP.NET_SessionId=55w4noiub50zqtqclwdx3ral; path=/; HttpOnly";
  Vary = "Accept-Encoding";
  "X-AspNet-Version" = "4.0.30319";
  "X-Powered-By" = "ASP.NET";
}
2012-07-25 14:03:03.121 TestWCF[5280:fb03] ResponseBody:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
    <getAllCategoriesResponse xmlns="http://tempuri.org/">
        <getAllCategoriesResult        xmlns:a="http://schemas.datacontract.org/2004/07/DocSyncService"    xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
                <a:Category>
                    <a:categoryId>4</a:categoryId>
                    <a:categoryName>IT</a:categoryName>
                    <a:categoryType>0</a:categoryType>
                    <a:docCount>3</a:docCount>
                    <a:subCategoryId>0</a:subCategoryId>
                </a:Category>
                <a:Category>
                    <a:categoryId>6</a:categoryId>
                    <a:categoryName>CPG</a:categoryName>
                    <a:categoryType>0</a:categoryType>
                    <a:docCount>1</a:docCount>
                    <a:subCategoryId>0</a:subCategoryId>
                </a:Category>
        </getAllCategoriesResult>
    </getAllCategoriesResponse>
</s:Body>
</s:Envelope>

当我运行此程序时,模拟器中没有显示任何内容…它显示一个空白屏幕。很明显,我遗漏了一些东西。如何让它工作?

前一段时间,我用Wsdl2Objc编写了一些教程;也许他们能帮上忙


:-我按照你的例子做了,效果很好。但我想要达到的是有点不同。教程示例返回标记中的单个值。我正在处理的示例返回一个对象数组(复杂类型)。我想在表格中显示“某些值”和“值”。如何实现这一点?@from.nett您需要检查Wsdl2obj创建的代码。特别是,它会使一个类对应于(它可能会被命名为类似于_Response的东西,在该类中,您可能会看到对应于的对象数组的规定)
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
   BasicHttpBinding_IDocSyncBinding *myBinding = [iPadDocSyncServiceSvc    BasicHttpBinding_IDocSyncBinding];
myBinding.logXMLInOut = YES;

//iPadDocSyncServiceSvc_getAllCategories *allCate =     [[iPadDocSyncServiceSvc_getAllCategories new]autorelease];
iPadDocSyncServiceSvc_getAllCategories *allCate = [[iPadDocSyncServiceSvc_getAllCategories     alloc]init];

BasicHttpBinding_IDocSyncBindingResponse *response = [myBinding getAllCategoriesUsingParameters:allCate];

for(id bodyPart in response.bodyParts)
{
    //if([bodyPart isKindOfClass:[BasicHttpBinding_IDocSyncBindingResponse class]])
    //{
    //tns1_ArrayOfCategory *cateClass = (tns1_ArrayOfCategory *) bodyPart;
    //[self.tableView reloadData];

    //categories  = (NSMutableArray *) cateClass;
    //tns1_ArrayOfCategory *cateClass = [bodyPart getAllCategoriesResult];

    self.categories = (NSMutableArray *) [bodyPart getAllCategoriesResult];
    //}
}


return YES;
}