BizTalk - JSON Post WebService 导致 500 内部服务器错误
BizTalk - JSON Post WebService causes 500 Internal Server Error
我在 BizTalk 中有一个要求 post 数据到 Web 服务。
此数据需要采用 JSON 格式 - 一旦 posted 我希望返回相同格式的内容,但在我收到任何内容之前,我一直遇到同样的问题。我花了大约一天的时间试图弄清楚它 - 我很确定它一定是我忽略的东西。
我已经使用 Postman 检查了端点,当我直接 post 数据时没有问题。
我收到的错误如下;
xlang/s engine event log entry: Uncaught exception (see the 'inner exception' below) has suspended an instance of service 'Orchestrations.STANDARD_OUT_WEBSERVICE(a064e1ce-3aec-fa09-9ceb-76b4447793a2)'. The service instance will remain suspended until administratively resumed or terminated. If resumed the instance will continue from its last persisted state and may re-throw the same unexpected exception. InstanceId: 3766050c-3a20-44e0-ae96-5137ab9ce270 Shape name: ShapeId: Exception thrown from: segment -1, progress -1 Inner exception: An error occurred while processing the message, refer to the details section for more information Message ID: {ABD1094C-826C-42D6-8776-AE28044B9BBC} Instance ID: {FC678BF5-BF84-4069-8385-00D0FD3547AE} Error Description: System.Net.WebException: (500) Internal Server Error at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.RequestCallback(IAsyncResult result) Exception type: XlangSoapException Source: Microsoft.XLANGs.BizTalk.Engine Target Site: Void VerifyTransport(Microsoft.XLANGs.Core.Envelope, Int32, Microsoft.XLANGs.Core.Context) The following is a stack trace that identifies the location where the exception occured at Microsoft.BizTalk.XLANGs.BTXEngine.BTXPortBase.VerifyTransport(Envelope env, Int32 operationId, Context ctx) at Microsoft.XLANGs.Core.Subscription.Receive(Segment s, Context ctx, Envelope& env, Boolean topOnly) at Microsoft.XLANGs.Core.PortBase.GetMessageId(Subscription subscription, Segment currentSegment, Context cxt, Envelope& env, CachedObject location) at Orchestrations.STANDARD_OUT_WEBSERVICE.segment1(StopConditions stopOn) at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception& exp)
留言的大致路线如下
Orchestration 1 进行一些翻译,然后以 XML 格式(使用 Xml Transmit)将消息发送到 Orchestration 2。Orchestration 2 接收 XML 格式(使用 Xml Receive)消息并使用它来构造新的 JSON 格式的消息。
HeaderBuild = @"Content-Type:application\json" + "\n" + "UserName:biztalk-service";
Endpoint = "https://www.example.com/update";
ScaleWebserviceULOut(Microsoft.XLANGs.BaseTypes.Address) = Endpoint;
ScaleWebserviceULOut(Microsoft.XLANGs.BaseTypes.TransportType) = "WCF-WebHttp";
InboundMessageWithHeaders = InboundMessage;
InboundMessageWithHeaders(WCF.Action) = Endpoint;
InboundMessageWithHeaders(WCF.SecurityMode) = "Transport";
InboundMessageWithHeaders(WCF.HttpMethodAndUrl) = "POST";
InboundMessageWithHeaders(WCF.HttpHeaders) = HeaderBuild;
此消息然后被推送到动态发送接收端口,该端口在请求上使用自定义 JSON 编码器管道,目前在响应上使用 XML 接收(因为目前我什至没有走到这一步)。
消息毫无问题地路由到端口,并且肯定正在转换为 JSON。
我已经用谷歌搜索了很多,我不确定我做错了什么。有什么想法吗?
事实证明,我收到此错误的原因是...
HeaderBuild = @"Content-Type:application\json" + "\n" + "UserName:biztalk-service";
此内容类型不正确 - 将其更改为正斜杠解决了该问题。
application/json
感谢 ste-fu 将我引向 fiddler
我在 BizTalk 中有一个要求 post 数据到 Web 服务。 此数据需要采用 JSON 格式 - 一旦 posted 我希望返回相同格式的内容,但在我收到任何内容之前,我一直遇到同样的问题。我花了大约一天的时间试图弄清楚它 - 我很确定它一定是我忽略的东西。
我已经使用 Postman 检查了端点,当我直接 post 数据时没有问题。
我收到的错误如下;
xlang/s engine event log entry: Uncaught exception (see the 'inner exception' below) has suspended an instance of service 'Orchestrations.STANDARD_OUT_WEBSERVICE(a064e1ce-3aec-fa09-9ceb-76b4447793a2)'. The service instance will remain suspended until administratively resumed or terminated. If resumed the instance will continue from its last persisted state and may re-throw the same unexpected exception. InstanceId: 3766050c-3a20-44e0-ae96-5137ab9ce270 Shape name: ShapeId: Exception thrown from: segment -1, progress -1 Inner exception: An error occurred while processing the message, refer to the details section for more information Message ID: {ABD1094C-826C-42D6-8776-AE28044B9BBC} Instance ID: {FC678BF5-BF84-4069-8385-00D0FD3547AE} Error Description: System.Net.WebException: (500) Internal Server Error at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.RequestCallback(IAsyncResult result) Exception type: XlangSoapException Source: Microsoft.XLANGs.BizTalk.Engine Target Site: Void VerifyTransport(Microsoft.XLANGs.Core.Envelope, Int32, Microsoft.XLANGs.Core.Context) The following is a stack trace that identifies the location where the exception occured at Microsoft.BizTalk.XLANGs.BTXEngine.BTXPortBase.VerifyTransport(Envelope env, Int32 operationId, Context ctx) at Microsoft.XLANGs.Core.Subscription.Receive(Segment s, Context ctx, Envelope& env, Boolean topOnly) at Microsoft.XLANGs.Core.PortBase.GetMessageId(Subscription subscription, Segment currentSegment, Context cxt, Envelope& env, CachedObject location) at Orchestrations.STANDARD_OUT_WEBSERVICE.segment1(StopConditions stopOn) at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception& exp)
留言的大致路线如下 Orchestration 1 进行一些翻译,然后以 XML 格式(使用 Xml Transmit)将消息发送到 Orchestration 2。Orchestration 2 接收 XML 格式(使用 Xml Receive)消息并使用它来构造新的 JSON 格式的消息。
HeaderBuild = @"Content-Type:application\json" + "\n" + "UserName:biztalk-service";
Endpoint = "https://www.example.com/update";
ScaleWebserviceULOut(Microsoft.XLANGs.BaseTypes.Address) = Endpoint;
ScaleWebserviceULOut(Microsoft.XLANGs.BaseTypes.TransportType) = "WCF-WebHttp";
InboundMessageWithHeaders = InboundMessage;
InboundMessageWithHeaders(WCF.Action) = Endpoint;
InboundMessageWithHeaders(WCF.SecurityMode) = "Transport";
InboundMessageWithHeaders(WCF.HttpMethodAndUrl) = "POST";
InboundMessageWithHeaders(WCF.HttpHeaders) = HeaderBuild;
此消息然后被推送到动态发送接收端口,该端口在请求上使用自定义 JSON 编码器管道,目前在响应上使用 XML 接收(因为目前我什至没有走到这一步)。
消息毫无问题地路由到端口,并且肯定正在转换为 JSON。 我已经用谷歌搜索了很多,我不确定我做错了什么。有什么想法吗?
事实证明,我收到此错误的原因是...
HeaderBuild = @"Content-Type:application\json" + "\n" + "UserName:biztalk-service";
此内容类型不正确 - 将其更改为正斜杠解决了该问题。
application/json
感谢 ste-fu 将我引向 fiddler