将参数传递给Soap请求

时间:2012-06-08 07:32:16

标签: iphone xcode

我正在尝试将一些参数传递给SOAP服务。我尝试在下面列出的代码块的最后执行此操作。出于某种原因,我不能让这个工作。有人可以帮我一点点。提前谢谢!

    NSString *soapMessage = [NSString stringWithFormat:
                         @"<?xml version=\"1.0\" encoding=\"utf-8\"?>"
                         "<soap12:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap12=\"http://www.w3.org/2003/05/soap-envelope\">"
                         "<soap12:Body>"
                         "<UserLogin xmlns=\"http://tempuri.org/\">"
                         "<username>string</username>"
                         "<password>string</password>"
                         "</UserLogin>"
                         "</soap12:Body>"
                         "</soap12:Envelope>, %@, %@", txtUsername.text, txtPassword.text];

1 个答案:

答案 0 :(得分:2)

NSString *soapMessage = [NSString stringWithFormat:
                         @"<?xml version=\"1.0\" encoding=\"utf-8\"?>"
                         "<soap12:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap12=\"http://www.w3.org/2003/05/soap-envelope\">"
                         "<soap12:Body>"
                         "<UserLogin xmlns=\"http://tempuri.org/\">"
                         "<username>%@</username>"
                         "<password>%@</password>"
                         "</UserLogin>"
                         "</soap12:Body>"
                         "</soap12:Envelope>", txtUsername.text, txtPassword.text];