需要有关从 wsdl2objc Web 服务生成的 Objective-C 代码的帮助
我是 iPhone 开发新手。我正在尝试使用 wsdl2objc Web 服务在客户端生成代理服务器。我浏览了本教程,并使用本教程制作了一个示例应用程序。
实际上我有两个字符串 s1 和 s2 我需要连接这两个字符串并使用按钮在文本字段上显示结果。我已经从 wsdl2objc 文件生成了代码。生成的类的名称是SimpleService
。
由于我是 iPhone 开发新手,生成的代码包含许多方法,我很困惑要使用哪个类。我有一个编写的代码可以正确编译,但仍然无法执行。我哪里错了?下面的代码需要做哪些修改?
@implementation WsdlViewController
@synthesize field;
-(IBAction)buttonpressed:(id)sender
{
SimpleServiceSOAP *binding = [SimpleService SimpleServiceSOAP];
binding.logXMLInOut = YES;
SimpleService_concat *testParams = [[SimpleService_concat new]autorelease];
testParams.s1 = field.text; // parameters all become properties of this testParams object
testParams.s2 = field.text;
SimpleServiceSOAPResponse * response = [binding concatUsingParameters: testParams];
[response self];
NSArray * responseBodyParts = response.bodyParts;
NSError *responseError = response.error;
for (id bodypart in responseBodyParts)
{
if ([bodypart isKindOfClass:[SimpleService_concat class]])
{
SimpleService_concat * body = (SimpleService_concat *)bodypart;
field.text = body.s1;
field.text = body.s2;
}
}
}
你想让我提供 wsdl2objc 生成的代码吗?
I am new to iPhone development. I am trying out to generate a proxy server at a client side using a wsdl2objc web service. I went through this tutorial and am doing a sample application using this tutorial.
Actually I have two strings s1 and s2 I need to concatenate the two strings and display the result on a textfield using a button. I have generated code out of the wsdl2objc file. The name of the generated class is SimpleService
.
As I am new to iphone development, the generated code contains many methods where I am confused which class to be used. I have a written code which compiles correctly but still its not executing. Where I am going wrong? What corrections need to be done in the following code?
@implementation WsdlViewController
@synthesize field;
-(IBAction)buttonpressed:(id)sender
{
SimpleServiceSOAP *binding = [SimpleService SimpleServiceSOAP];
binding.logXMLInOut = YES;
SimpleService_concat *testParams = [[SimpleService_concat new]autorelease];
testParams.s1 = field.text; // parameters all become properties of this testParams object
testParams.s2 = field.text;
SimpleServiceSOAPResponse * response = [binding concatUsingParameters: testParams];
[response self];
NSArray * responseBodyParts = response.bodyParts;
NSError *responseError = response.error;
for (id bodypart in responseBodyParts)
{
if ([bodypart isKindOfClass:[SimpleService_concat class]])
{
SimpleService_concat * body = (SimpleService_concat *)bodypart;
field.text = body.s1;
field.text = body.s2;
}
}
}
u wan me to provide wsdl2objc generated code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我根本不知道 wsdl2objc 。
然而,读完代码后,在我看来,核心是基于这两行:
正如你的解释是你想连接两个字符串并在字段中显示结果,你应该尝试将上面的两行替换为
:连接两个字符串并将结果分配给
field
的text
属性。希望这有帮助。
I don't know about wsdl2objc at all.
However, after reading the code, it seems to me the heart is based on these two lines :
As your explanation is you want to concatenate two strings and display the result in the field, you should try replacing the two lines above, with :
This concatenates the two strings and assign the result to the
text
property offield
.Hope this helps.