简体   繁体   English

如何将参数从iPhone传递到Soap Web服务?

[英]How to pass a parameter to soap web service from iphone?

I want call a web service with parameter from my iphone app. 我想从iPhone应用程序调用带有参数的Web服务。

The parameter is a string and where and how I have to specify the parameter calling the web service using xml or whatever it is. 该参数是一个字符串,以及在何处以及如何指定使用xml或其他参数调用Web服务的参数。

Please tell me if somebody knows about it. 请告诉我是否有人知道。 I want to send a state name to the web service. 我想将状态名称发送到Web服务。

please help me to solve this issue. 请帮助我解决此问题。

NSString *soapMessage = 
    [NSString stringWithFormat:
     @"<?xml version=\"1.0\" encoding=\"utf-8\"?>"
     "<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/\">"
     "<soap:Body>"
     "<stateWiseHospitalName  xmlns=\"http://ws.centricare.org\" />"
     "</soap:Body>"
     "</soap:Envelope>"

     ];

Simply : 简单地:

"<stateWiseHospitalName  xmlns=\"http://ws.centricare.org\" />"
"<first parameter>value</first parameter> <second parameter>value</second parameter>
...... "
"</stateWiseHospitalName> /n " 

iOS doesn't have any built-in support for SOAP, so you may want to find a library to help with creating and interpreting SOAP messages. iOS没有对SOAP的任何内置支持,因此您可能想找到一个库来帮助创建和解释SOAP消息。 If you're comfortable doing that yourself and just need help to post the message to a server, you can use NSURLRequest and NSURLConnection for that. 如果您自己愿意这样做,并且只需要帮助将消息发布到服务器,则可以使用NSURLRequest和NSURLConnection。

I don't recommend using SOAP. 我不建议使用SOAP。 Been there, done that, it's a gruelling experience. 到那里,这样做,这是一个令人痛苦的经历。

I prefer using JSON for web services. 我更喜欢将JSON用于Web服务。 The folks at http://www.three20.info have a comprehensive framework to dealing with it. http://www.three20.info上的人们有一个全面的框架来处理它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM