开发者

Using Obj-C generated code using WSDLToObj-c Tool

开发者 https://www.devze.com 2023-04-06 06:46 出处:网络
From my application i need to call a web service to get the list of books in a server. For this purpose the following WSDL link is provided http://demo.kitaboo.com/eBookServices/services/ListOfBooksSe

From my application i need to call a web service to get the list of books in a server. For this purpose the following WSDL link is provided http://demo.kitaboo.com/eBookServices/services/ListOfBooksService?wsdl

Using the WSDL2ObjC Tool available at http://code.google.com/p/wsdl2objc/downloads/list i've generated the equivalent objective-C code for the given WSDL url.

This is the link which i referred while implementing to call the web service.

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

NSArray *responseHeaders = response.headers;
NSArray *responseBodyParts = response.bodyParts;

for(id header in responseHeaders) {
  if([header isKindOfClass:[ns2_MyHeaderResponse class]]) {
    ns2_MyHeaderResponse *headerResponse = (ns2_MyHeaderResponse*)header;

    // ... Handle ns2_MyHeaderResponse ...
  }
}

for(id bodyPart in responseB开发者_如何学GoodyParts) {
  if([bodyPart isKindOfClass:[ns2_MyBodyResponse class]]) {
    ns2_MyBodyResponse *body = (ns2_MyBodyResponse*)bodyPart;

    // ... Handle ns2_MyBodyResponse ...
  }
}

I'm unable to interrelate the terms such as (ns1_MyOperationRequest, MyWebServiceBindingResponse, myOperationUsingParameters) that are present in the code.

Any idea on how to go about doing this?


EDIT for your updated question:

In your header file, add the ListOfBooksServiceSoapBindingResponseDelegate and also implement - (void) operation:(ListOfBooksServiceSoapBindingOperation *)operation completedWithResponse:(ListOfBooksServiceSoapBindingResponse *)response;

Check the instructions:

Once you obtain WSDL2ObjC, code generation is pretty simple.

  1. Launch the app
  2. Browse to a WSDL file or enter in a URL
  3. Browse to an output directory
  4. Click "Parse WSDL"

Source code files will be added to the output directory you've specified. There will be one pair of .h/.m files for each namespace in your WSDL.

In case you didn't notice, you must have downloaded a standalone WSDL2ObjC.app. The window looks like this:

Using Obj-C generated code using WSDLToObj-c Tool


Just enter your WSDL link in link and get the code http://sudzc.com/

0

精彩评论

暂无评论...
验证码 换一张
取 消