我已经写了一个定制的命名空间和命名空间前缀由WCF生成的SOAP消息在这里.
但是,我找不到在Message类中重写的正确方法,以便自定义消息的SOAP标头.
我想发这个消息:
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
<s:Header>
<h:Protocol xmlns="http://www.xyz.de/Protocol" xmlns:h="http://www.xzy.de/Protocol">
<version>IFD_1.4</version>
</h:Protocol>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
</s:Body>
</s:Envelope>
Run Code Online (Sandbox Code Playgroud)
看起来像这样:
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
<s:Header>
<if:Protocol xmlns="http://www.xyz.de/Protocol" xmlns:if="http://www.xzy.de/Protocol">
<version>IFD_1.4</version>
</if:Protocol>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
</s:Body>
</s:Envelope>
Run Code Online (Sandbox Code Playgroud)
不同之处在于第一个标题的名称空间是"if"而不是"f".
有没有办法使用自定义MessageFormatter和自定义Message类来做到这一点?
我需要手动调用一些 Quartz.NET 作业并等待它们完成。请参阅下面的简化示例代码:
[HttpPost("[action]/{jobKey}")]
public async Task<IActionResult> StartJob(string jobKey)
{
await _schedulerService.Scheduler.TriggerJob(new Quartz.JobKey(jobKey));
return Ok();
}
Run Code Online (Sandbox Code Playgroud)
但是,使用 TriggerJob 也不会等待作业本身的执行完成。使用 Quartz.NET 可以实现这一点吗?我在 .NET Core 上使用它,并使用以下包:
<PackageReference Include="Quartz" Version="3.0.7" />
Run Code Online (Sandbox Code Playgroud)