首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >需要有关Objective-C代码(WSDL2ObjC生成)的帮助

需要有关Objective-C代码(WSDL2ObjC生成)的帮助
EN

Stack Overflow用户
提问于 2011-06-20 02:29:41
回答 2查看 1.5K关注 0票数 0

在WSDL2ObjC文档中有一个类似下面的示例代码,但在我生成的代码中,我找不到任何与"myOperationUsingParameters“相等的类、方法或属性。这是什么?在哪里可以找到?我也不知道什么是"myOperation“,什么是"ns1”。

我是新手,所以在Objective C中,当我以某种方式改变变量的大写字母,并将它们与一些关键字连接起来时,可能会有某种意义?

例如: ns1_MyOperationRequest -- myOperationUsingParameters

tnx

代码语言:javascript
复制
#import "MyWebService.h"
MyWebServiceBinding *binding = [MyWebService MyWebServiceBinding];
binding.logXMLInOut = YES;

ns1_MyOperationRequest *request = [[ns1_MyOperationRequest new] autorelease];
request.attribute = @"attributeValue";
request.element = [[ns1_MyElement new] autorelease];
request.element.value = @"elementValue"];

MyWebServiceBindingResponse *response = [binding myOperationUsingParameters:request];
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2011-07-07 18:27:40

这一切都取决于您的web服务类名等,因为wsdl2objc构成了许多NSObjects和基于此的方法,但是,如果您使用的是SOAP1.2绑定,并且您的web服务名为“SimpleService”,下面的代码将调用一个名为“MobileTestService”的web方法,并从生成的xml中返回整数值。

代码语言:javascript
复制
-(NSString *)returnThatStringFromWebServiceResult 

{


SimpleServiceSoap12Binding * binding = [SimpleService SimpleServiceSoap12Binding];

binding.logXMLInOut = YES; // shows all in the console log.

SimpleService_concat * testParams = [[SimpleService_concat new]autorelease];

testParams.s1 = someTextField.text; // parameters all become properties of this testParams object

testParams.s2 = anotherTextField.text;

SimpleServiceSoap12BindingResponse * response= [binding SimpleService_concatUsingParameters:testParams];

[response self]; // removes compile error

NSArray * responseBodyParts = response.bodyParts;

NSError * responseError = response.error;

if (responseError!=NULL) 

{
    return @"";     // if error from ws use [responeError code]; for http err code


}

for (id bodyPart in responseBodyParts)

{

    if ([bodyPart isKindOfClass:[SimpleService_concat_Response class]]) 

    {
        SimpleService_concatResponse* body = (SimpleService_concatResponse*) bodyPart;

        return body.SimpleService_concatResult; // if you are returning a string from your WS then this value will be a string, 

    }

}
票数 2
EN

Stack Overflow用户

发布于 2017-03-19 07:27:31

在WSDL2ObjC中,获取数据= <>,响应为nill。

代码:

代码语言:javascript
复制
VKQWare_Binding * binding = [[VKQWare_Binding alloc] init];
VKQRequestResultHandler *reqResultHandler = [[VKQRequestResultHandler alloc]init];
binding.EnableLogging = YES;
reqResultHandler.EnableLogging = YES;

NSMutableURLRequest *mutableURLRequest = [binding createPasswordRequest:@"userName" p_txtPassword:@"Password" p_codLocationCode:@"xxx" __request:reqResultHandler];
[reqResultHandler prepareRequest:mutableURLRequest];
[reqResultHandler sendImplementation:mutableURLRequest];

OutputHeader :(null) OutputBody :(null) OutputFault :Error Domain= Code=0 "(null)“

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6404325

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档