在WSDL2ObjC文档中有一个类似下面的示例代码,但在我生成的代码中,我找不到任何与"myOperationUsingParameters“相等的类、方法或属性。这是什么?在哪里可以找到?我也不知道什么是"myOperation“,什么是"ns1”。
我是新手,所以在Objective C中,当我以某种方式改变变量的大写字母,并将它们与一些关键字连接起来时,可能会有某种意义?
例如: ns1_MyOperationRequest -- myOperationUsingParameters
tnx
#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];发布于 2011-07-07 18:27:40
这一切都取决于您的web服务类名等,因为wsdl2objc构成了许多NSObjects和基于此的方法,但是,如果您使用的是SOAP1.2绑定,并且您的web服务名为“SimpleService”,下面的代码将调用一个名为“MobileTestService”的web方法,并从生成的xml中返回整数值。
-(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,
}
}发布于 2017-03-19 07:27:31
在WSDL2ObjC中,获取数据= <>,响应为nill。
代码:
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)“
https://stackoverflow.com/questions/6404325
复制相似问题