我必須使用多個SOAP消息才能從Web服務獲取數據。我得到了一些例子,說明如何做到這一點,但它們都具有XML(http://icodeblog.com/2008/11/03/iphone-programming-tutorial-intro-to-soap-web-services/)iPhone上的SOAP消息
// ---- LOGIN -----
NSString *soapMessage = [NSString stringWithFormat:
@"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<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\">\n"
"<soap12:Body>\n"
"<Login xmlns=\"http://tempuri.org/\">\n"
"<sUserID>USER</sUserID>\n"
"<sUserPw>PASSWORD</sUserPw>\n"
"<sDomain>SERVER</sDomain>\n"
"</Login>\n"
"</soap12:Body>\n"
"</soap12:Envelope>\n"
];
NSString *urlToSend = [[NSString alloc] initWithString:@"http://SERVER/DIRECTORY/WSDL_FILE.ASMX"];
NSString *callTOMake = [[NSString alloc] initWithString:@"http://WEBSERVER/Login"];
兩個問題: 1)是否有意義閱讀從一個類或文件到Xcode中SOAP消息?或者我可以通過代碼來定義它們嗎?
2)我用SOAPUI & .NET來查詢服務。它工作正常...但是當我從iPhone模擬器做它它返回以下內容:
2010-03-10 15:13:54.773 Hello_SOAP [91204:207] soap:ClientServer無法識別HTTP的值Header SOAPAction:http://WEBSERVER/DIRECTORY/Login
我怎樣才能找出是什麼問題導致在模擬器上說的錯誤?