0

In the WSDL2ObjC documentation there is a sample code like below, but in my generated code I couldnt find any class, method or property equavilant to "myOperationUsingParameters" what is that and where can I find it? I don't know also what "myOperation" and what "ns1" is.

I'm newbie, so in Objective C maybe there is a meaning when I change the capitals of variables in a certain way and concatenate them with some keywords?

for instance: 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];
Spring
  • 11,333
  • 29
  • 116
  • 185

2 Answers2

2

All depends on your web service class name etc as wsdl2objc makes up alot of your NSObjects and methods based upon this, however, suggesting that you are using soap 1.2 bindings and your web service was called 'SimpleService', the following would call a web method named 'MobileTestService and return back the integer value from the xml generated.

-(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, 

    }

}
Charan
  • 4,940
  • 3
  • 26
  • 43
Abhilash
  • 638
  • 4
  • 11
  • 28
  • thanks now recently I decided to use simple http post and I can receive send the xml with no problem, do you think there is a good reason why I should use a library like this? considering that it is complex and not well documented? I will parse my xml edit and post it back..? – Spring Jul 07 '11 at 10:36
  • @xDeveloper u mean u r using http for connectiona and later parse the xml?so what exactly u want to do? – Abhilash Jul 07 '11 at 11:11
  • yes thats what i do, and what i need..i need to edit xmls and send it back to web service, but wondering why all people using this kind of libraries, do i miss something? – Spring Jul 07 '11 at 11:21
  • u can go through this link http://www.iphonedevsdk.com/forum/iphone-sdk-tutorials/76730-webservice-how.html – Abhilash Jul 07 '11 at 11:23
0

In WSDL2ObjC getting data = <> and response is nill.
Code:

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)"