Biztalk - SOAP 响应包含多重引用,因此无法对其进行处理
我使用 Biztalk 中的向导“添加生成的项目 -> 使用 WCF 服务”来使用 WCF 服务
我遇到的问题是该服务返回的响应无法被解析: 原因:解析传入文档时发生错误:“有多个根元素。第 1 行,位置 296。”
这很令人惊讶,因为我正在使用自动生成的架构
但是不是错误消息,因为服务进行了预期的操作,我认为问题与 multiRef 标记有关
响应:
<ns1:sendSmsSubmissionResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://mobicomp.com/smsexpress/webservice/server/message">
<sendSmsSubmissionReturn href="#id0" />
</ns1:sendSmsSubmissionResponse>
<multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:SubmissionStatus" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="http://mobicomp.com/smsexpress/webservice/server/message">
<id xsi:type="soapenc:string">4336723</id>
<message xsi:type="soapenc:string">Submissão enviada para processamento.</message>
<status href="#id1" />
</multiRef>
<multiRef id="id1" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">0</multiRef>
架构
<xs:schema xmlns:tns="http://mobicomp.com/smsexpress/webservice/server/message" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://mobicomp.com/smsexpress/webservice/server/message" id="sendSmsSubmissionResponse" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:include schemaLocation=".\SubmissionManagerService_mobicomp_com_smsexpress_webservice_server_message.xsd" />
<xs:annotation>
<xs:appinfo>
<schemaInfo root_reference="sendSmsSubmissionResponse" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
<b:references>
<b:reference targetNamespace="http://common.server.webservice.smsexpress.mobicomp.com" />
<b:reference targetNamespace="http://mobicomp.com/smsexpress/webservice/server/message" />
<b:reference targetNamespace="http://schemas.xmlsoap.org/soap/encoding/" />
</b:references>
</xs:appinfo>
</xs:annotation>
<xs:element name="sendSmsSubmissionResponse">
<xs:annotation>
<xs:documentation>Wrapper element for message "sendSmsSubmissionResponse" of RPC operation "sendSmsSubmission".</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="sendSmsSubmissionReturn" type="tns:SubmissionStatus" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
我该怎么做才能避免出现此错误?
谢谢!
编辑:
在架构中指定根引用为“sendSmsSubmissionResponse”并不能解决问题
I consume a WCF service in Biztalk with the wizard "Add generated Items -> Consume WCF Service"
The problem I have is the service is returning a response that can't be parsed:
Reason: An error occurred when parsing the incoming document: "There are multiple root elements. Line 1, position 296."
That's surprising since I'm using the autogenerated schemas
But is not an Error message since the service makes the expected operation, the problem I think has to do with the multiRef tag
Response:
<ns1:sendSmsSubmissionResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://mobicomp.com/smsexpress/webservice/server/message">
<sendSmsSubmissionReturn href="#id0" />
</ns1:sendSmsSubmissionResponse>
<multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:SubmissionStatus" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="http://mobicomp.com/smsexpress/webservice/server/message">
<id xsi:type="soapenc:string">4336723</id>
<message xsi:type="soapenc:string">Submissão enviada para processamento.</message>
<status href="#id1" />
</multiRef>
<multiRef id="id1" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:int" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">0</multiRef>
Schema
<xs:schema xmlns:tns="http://mobicomp.com/smsexpress/webservice/server/message" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://mobicomp.com/smsexpress/webservice/server/message" id="sendSmsSubmissionResponse" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:include schemaLocation=".\SubmissionManagerService_mobicomp_com_smsexpress_webservice_server_message.xsd" />
<xs:annotation>
<xs:appinfo>
<schemaInfo root_reference="sendSmsSubmissionResponse" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
<b:references>
<b:reference targetNamespace="http://common.server.webservice.smsexpress.mobicomp.com" />
<b:reference targetNamespace="http://mobicomp.com/smsexpress/webservice/server/message" />
<b:reference targetNamespace="http://schemas.xmlsoap.org/soap/encoding/" />
</b:references>
</xs:appinfo>
</xs:annotation>
<xs:element name="sendSmsSubmissionResponse">
<xs:annotation>
<xs:documentation>Wrapper element for message "sendSmsSubmissionResponse" of RPC operation "sendSmsSubmission".</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="sendSmsSubmissionReturn" type="tns:SubmissionStatus" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
What can I do in order I don't get this error?
thanks!
EDIT:
Specifying in the schema the root reference to be "sendSmsSubmissionResponse" didn't solve the issue
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好的,我解决了这个问题
,我将把它写下来,以防万一有人遇到同样的问题,
我创建了一个自定义接收管道,其中:
解码,首先使用 XSL 将 XML 转换为标准 onw
拆解以删除肥皂信封并只留下正文
然后 biztalk 接受 XML 消息并正常继续 我
使用的 XSL 是我找到的 此处但进行了调整:
Ok I solved it
I'm going to write it down just it case somebody runs in the same problem
I created a custom receive pipeline in which:
Decode, first transform the XML in an standard onw with an XSL
Dissasemble to remove soap Envelope and just leave body
Then biztalk accepts the XML message and I proceed normally
The XSL I used is the one I found here but tweaked:
在 BizTalk 消息处理中只能有一个根元素。有多种方法可以执行此操作,但本质上您需要对消息中的每个重复根进行分批,以便可以单独处理它,或者创建一个包装器元素以允许对其进行处理。这种类型的组件必须存在于管道阶段(自定义管道)。
您还可以将消息视为 XML 并根据大小以及是否需要为其建立索引来解析它。
You can only have a single root element in BizTalk message processing. There are multiple ways to do this, but essentially you need to debatch each repeated root in the message so that it can be processed separately or create a wrapper element to allow it to be processed. This type of component would have to exist in the pipelining stage (custom pipeline).
You can also treat the message as XML and parse it depending on the size and whether you need it indexed.