簡體   English   中英

需要有關Objective-C代碼的幫助(WSDL2ObjC生成)

[英]Need help on Objective-C code (WSDL2ObjC generated)

在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];

所有這些都取決於你的web服務類名等,因為wsdl2objc基於此構成了很多你的NSObject和方法,但是,建議你使用soap 1.2綁定並且你的web服務被稱為'SimpleService',以下將調用web方法命名為'MobileTestService並從生成的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, 

    }

}

在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:Error Domain = Code = 0“(null)”

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM