目前回傳的格式是
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<InvokeResponse xmlns="http://localhost/BOI/">
<InvokeResult>
<InvokeResult>true</InvokeResult>
<result>OK</result>
</InvokeResult>
</InvokeResponse>
</s:Body>
</s:Envelope>
而目標想得到的目標值是
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<boi:InvokeResponse xmlns:boi="http://localhost/BOI/">
<boi:InvokeResult>
<boi:InvokeResult>true</boi:InvokeResult>
<boi:result>OK</boi:result>
</boi:InvokeResult>
</InvokeResponse>
</s:Body>
</s:Envelope>
請問下這個前綴如何設定?
主要疑問點就是如何在節前前面加上那個點綴?
以下附帶了目前使用代碼:
namespace WcfServiceLibrary
{
public delegate string DisplayContent(string content);
// 注意: 使用“重構”選單上的“重命名”命令,可以同時更改代碼和組態檔中的類名“Service1”。
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, Namespace = "http://localhost/BOI/")]
[XmlSerializerFormat]
public class WServiceInstance : IService_Contract
{
public DisplayContent AddContent;
public BoiResult Invoke(string form, string token, string funcName, string parameters)
{
var jsonres = AddContent(form + ";" + token + ";" + funcName + ";" + parameters);
var data = new BoiResult();
data.InvokeResult = true;
data.result = jsonres;
return data;
}
}
[DataContract(Namespace = "")]
[XmlSerializerFormat]
public class BoiResult
{
[DataMember]
public bool InvokeResult;
[DataMember]
public string result;
}
}
namespace WcfServiceLibrary
{
// 注意: 使用“重構”選單上的“重命名”命令,可以同時更改代碼和組態檔中的介面名“IService_Contract”。
[ServiceContract(Namespace = "http://localhost/BOI/")]
[XmlSerializerFormat]
public interface IService_Contract
{
[OperationContract(Action = "", Name = "Invoke")]
BoiResult Invoke(string form, string token, string funcName, string parameters);
}
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/285073.html
標籤:Web Services
