2012-07-21 112 views
1

我想用我的iPhone應用程序中的參數調用Web服務。如何從iphone傳遞參數給soap web服務?

該參數是一個字符串,以及我在哪裏以及如何指定使用xml調用Web服務的參數,或者它是什麼。

請告訴我,如果有人知道它。我想向Web服務發送一個狀態名稱。

請幫我解決這個問題。

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

    ]; 

回答

-1

iOS不具備任何內置的SOAP支持,所以你可能要find a library幫助創建和解釋SOAP消息。如果你自己喜歡這樣做,只需要幫助將消息發佈到服務器,就可以使用NSURLRequest和NSURLConnection。

-1

我不推薦使用SOAP。在那裏,做到這一點,這是一個艱苦的經歷。

我更喜歡使用JSON進行Web服務。 http://www.three20.info的人員有一個全面的框架來處理它。

1

簡單:

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

+ 1爲您的代碼,它爲我工作 – Pramesh 2014-01-08 15:45:19