在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];
答案 0 :(得分:2)
所有取决于您的Web服务类名称等,因为wsdl2objc根据此构成了很多NSObject和方法,但是,建议您使用soap 1.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,
}
}
答案 1 :(得分:0)
在WSDL2ObjC中获取data =<>并且回应是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:错误域=代码= 0"(null)"