0

I'm new on developing IOS using web service. Can anyone help me on how to create a request with array parameter in SOAP Web Service. In PHP I can create a request by doing this:

$params = array(
"authuserid" => "454",
"authpassword" => "");
$result = $client->call("EC_LOGON",$params);

please help me I'm having a hard time to find a good example how to apply that code in objective c programming.

3 Answers 3

1

The SOAP message with parameters should be as follows,

NSString *soapMessage = [NSString stringWithFormat:
                             @"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
                             "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n"
                             "<soap:Body>\n"
                             "<TestSoap xmlns=\"http://testsoap.com/\">\n"
                             "<parameterOne>%@</parameterOne >\n"
                             "<parameterTwo>%@</parameterTwo >\n"
                             "</TestSoap >\n"
                             "</soap:Body>\n"
                             "</soap:Envelope>\n", valueOne, valueTwo];
Sign up to request clarification or add additional context in comments.

Comments

0

enter image description here

iphone-programming-tutorial-intro-to-soap-web-services

Download HelloWorld Sample App

Comments

0

From your app's code, you can post an string by appending all the objects of an array one after each other and separate them by any special character (like *), now in your PHP code you can make array with the same logic.

You can convert array to string from below code:

NSString *stringToPass;

for (int i = 0; i < [yourArray count]; i++) {
    if ([stringToPass length])
    {
        stringToPass = [stringToPass stringByAppendingFormat:@"*%@",[yourArray objectAtIndex:i]integerValue]]];
    }
    else
    {
        stringToPass = [NSString stringWithFormat:@"%@",[yourArray objectAtIndex:i]integerValue]]];
    }

}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.