使用wdsl2objc调用从ios返回xml的Web服务
我正在制作一个应用程序,通过使用“登录”并返回xml“字符串”的Web服务调用来搜索数据库 此呼叫的wdsl如下所示:使用wdsl2objc调用从ios返回xml的Web服务,ios,xml,ios6,wsdl2objc,Ios,Xml,Ios6,Wsdl2objc,我正在制作一个应用程序,通过使用“登录”并返回xml“字符串”的Web服务调用来搜索数据库 此呼叫的wdsl如下所示: <s:element name="PerformGlobalSearch"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="searchString" type="s:string"/> <s:el
<s:element name="PerformGlobalSearch">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="searchString" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="username" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="password" type="s:string"/>
<s:element minOccurs="1" maxOccurs="1" name="errorCode" type="s:int"/>
<s:element minOccurs="0" maxOccurs="1" name="errorDescription" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="PerformGlobalSearchResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="PerformGlobalSearchResult">
<s:complexType mixed="true">
<s:sequence>
<s:any/>
</s:sequence>
</s:complexType>
</s:element>
<s:element minOccurs="1" maxOccurs="1" name="errorCode" type="s:int"/>
<s:element minOccurs="0" maxOccurs="1" name="errorDescription" type="s:string"/>
</s:sequence>
</s:complexType>
我试过很多不同的方法。
我需要访问xml并解析它。我想我在尝试不同的解决方案时已经做到了
但是如何访问xml呢?如何将PerformGlobalSearchResult转换为xml文档?因此,问题的解决方案最终是更改生成的SOAP代码,使其返回我所需的内容 结果是WSDL和wsdl2objc设置它返回worng变量类型。 我改变了它,最终使用了一个字典作为返回值,因为这是一个预定义的类型,没有使用。 然后我就可以毫不费力地操练了
-(void) processResponse : (WebServiceSoapBindingResponse *)soapResponse {
NSArray *responseBodyParts = soapResponse.bodyParts;
id bodyPart;
@try{
bodyPart = [responseBodyParts objectAtIndex:0];
}
...
else if([bodyPart isKindOfClass:[xxxWebServiceSvc_PerformeGlobalSearchResponse class]]) {
xxxWebServiceSvc_PerformGlobalSearchResponse* SearchResponse = bodyPart;
NSLog(@"Test: %@", SearchResponse.PerformeGlobalSearchResult);
}