C# SOAP服务响应为空
我没有收到来自web服务的任何返回响应,输入消息XML正在被正常接收 试图获取并返回符合集成标准的自定义XML,这就是我使用S.S.C.Message作为参数的原因C# SOAP服务响应为空,c#,wcf,soap,C#,Wcf,Soap,我没有收到来自web服务的任何返回响应,输入消息XML正在被正常接收 试图获取并返回符合集成标准的自定义XML,这就是我使用S.S.C.Message作为参数的原因 using System.ServiceModel.Channels; [ServiceContract(Namespace = "urn:hl7-org:v3")] public interface IHL7v3 { [OperationContract(Name = "PRPA_IN201301UV02", Actio
using System.ServiceModel.Channels;
[ServiceContract(Namespace = "urn:hl7-org:v3")]
public interface IHL7v3
{
[OperationContract(Name = "PRPA_IN201301UV02", Action = "urn:hl7-org:v3:PRPA_IN201301UV02")]
Message PIXManager_PRPA_IN201301UV02(Message input);
}
public class PIXService : IHL7v3
{
public Message PIXManager_PRPA_IN201301UV02(Message input)
{
// this code is being reached and executing fine
return Message.CreateMessage(MessageVersion.Soap12, "Op", "Content"); // will be replaced by an actual XML text
}
}
服务设置代码:
Uri baseAddress = new Uri("http://192.168.2.120:31002/HL7Service");
ServiceHost selfHost = new ServiceHost(typeof(PIXService), baseAddress);
selfHost.Description.Name = "PIXManager";
selfHost.Description.Namespace = "urn:hl7-org:v3";
try
{
System.ServiceModel.Channels.Binding binder = new WSHttpBinding(SecurityMode.None);
binder.Name = "PIXManager_Binding_Soap12";
selfHost.AddServiceEndpoint(
typeof(IHL7v3),
binder,
"PIX");
ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
Console.WriteLine(smb.HttpGetUrl);
selfHost.Description.Behaviors.Add(smb);
selfHost.AddServiceEndpoint(
ServiceMetadataBehavior.MexContractName,
MetadataExchangeBindings.CreateMexHttpBinding(),
"mex"
);
selfHost.Open();
为什么
编辑:
添加了ReplyAction,仍然没有回复
[OperationContract(Name = "PRPA_IN201301UV02", Action = "urn:hl7-org:v3:PRPA_IN201301UV02", ReplyAction = "urn:hl7-org:v3:MCCI_IN000002UV01")]
// ..
return Message.CreateMessage(MessageVersion.Soap12, "urn:hl7-org:v3:MCCI_IN000002UV01", "Something");
您操作的
ReplyAction
设置为一个值(我记不清是哪个值,但它是默认值),您正在使用Op
的Action
属性创建响应消息。尝试在OperationContract
中设置ReplyAction
属性,并在创建响应消息时使用相同的值。将MessageVersion
更改为MessageVersion。Soap12WSAddressing10
return Message.CreateMessage(MessageVersion.Soap12WSAddressing10, "Op", "Content");
我已经添加了ReplyAction,仍然没有回复