You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

C#向IBM MQ Broker提交文件报错:requestUriString参数不能为空

问题:通过IBM MQ Broker提交SOAP XML时遇到"requestUriString"空值错误

我需要将SOAP XML负载文件提交至IBM MQ Broker,由其转发至目标应用(无法直接连接目标应用,只能通过Broker传输)。旧应用可成功提交文件,因此Broker是可用的,但我对Broker不熟悉且无相关人员可咨询。当前Broker返回错误:

Value cannot be null. (Parameter 'requestUriString')

我的代码中未使用该参数名,且已传入有效URL,不清楚该参数的用途及如何在代码中配置。以下是我使用的代码:

string str = fileInfo.FullName;
XmlReader xmlReader = XmlReader.Create(str);

HttpWebRequest length = (HttpWebRequest)WebRequest.Create(BrokerService.m_strBrokerURL);

xmlReader.MoveToContent();
string str1 = XNode.ReadFrom(xmlReader).ToString();
xmlReader.Close();
byte[] bytes = (new UTF8Encoding()).GetBytes(str1);
string empty = string.Empty;

length.Method = "POST";
length.ContentType = "application/soap+xml; charset=utf-8";
length.ContentLength = (long)(checked((int)bytes.Length));

Stream requestStream = length.GetRequestStream();
requestStream.Write(bytes, 0, checked((int)bytes.Length));
requestStream.Close();

HttpWebResponse response = (HttpWebResponse)length.GetResponse();
soapResponse = (new StreamReader(response.GetResponseStream())).ReadToEnd();

排查建议

  • 确认BrokerService.m_strBrokerURL的有效性:调试输出该变量值,检查是否为null、空字符串,或缺少http/https前缀等格式问题
  • 该错误中的requestUriString大概率是Broker转发请求时需要的目标应用URI,可能你的SOAP请求未包含Broker所需的路由信息。对比旧应用的请求内容,查看是否需要在SOAP头部或请求参数中指定目标应用的地址
  • 检查SOAP XML内容:是否遗漏Broker要求的特定路由字段(如自定义SOAP Header),用于告知Broker转发目标
  • 用Postman等工具直接模拟请求到Broker,验证请求格式正确性后再调整代码

内容的提问来源于stack exchange,提问作者Rexxrally

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.27 01:05:29