2011-11-22 44 views
0

對於除了作爲參數的對象之外的wcf webservice方法的請求應該如何?我有一個接受類employee的對象的方法。下面的請求給出了一個錯誤:服務器無法處理請求。 --- >未將對象引用設置爲對象的實例。將對象傳遞給iphone中的wcf webservice

int id1=100; 

NSString *soapMsg = [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>" 
        "<TestEmployee xmlns=\"http://body.com/\">" 
        "<Employee>" 
        "<id>%d</id>" 
        "<Name>%@</Name>" 
        "</Employee>" 
        "</TestEmployee>" 
        "</soap:Body>" 
        "</soap:Envelope>",id1,@"abc"]; 

回答

1

對於web服務,我總是喜歡使用可用here的工具。在這裏是你可以提供你的web服務的鏈接,它會創建你要測試的類和例子。 我希望這會對你有所幫助。

+0

非常感謝UPT!這是有益的.. – Kunila

1

SudzC(引用的鏈接UPT)適用於WCF服務。您可以將工具指向可通過Web訪問的WSDL或本地工具。首先將SudzC指向國家氣象服務WSDL http://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl,以便測試已知的SOAP服務並熟悉SudzC,可能會有所幫助。

另一個有用的鏈接,確定SOAP消息的結構是 http://www.w3schools.com/webservices/tempconvert.asmx?op=CelsiusToFahrenheit

這至少應該讓你在正確的方向。

+0

謝謝MTurner! – Kunila

相關問題