.asmxページを使用して.NET3.5Webサービスを開発していますが、GETおよびPOST要求でオプションのパラメーターを使用できないという事実から、アプリケーションをWCFに切り替えることを考えています。しかし、私はそれがどのように機能するかを明確に理解していませんでした。
以下のコードをWCFに変換するとどうなるか教えていただけますか?
[WebService]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
[ScriptService]
public class ws :WebService
{
#region WebMethods
//Parameters shoud be optional but it isnt possible in .asmx .NET 3.5
[WebMethod]
public XmlNode GetResult(string param1(=null), string param2(= null))
{
MyClass myClass = new MyClass();
//Get a xml string
string output = myClass.GetXmlString(param1, param2);
//Load this xml
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.LoadXml(output);
//Return this xml
return xmlDocument.DocumentElement;
}
#endregion
}