【问题标题】:"Missing <soap-env:Header> in <soap-env:Envelope>" - Sabre Webservice Consumer in Mule 4“<soap-env:Envelope> 中缺少 <soap-env:Header>”- Mule 4 中的 Sabre Web 服务使用者
【发布时间】:2020-03-05 20:17:24
【问题描述】:

尝试调用 Sabre Web 服务但收到上述 SOAP 错误。显然,标题没有丢失。到这里就懵了。

传入的参数被传递到转换消息处理器,有效负载被转换为 XML 并传递给 Web 服务使用者以进行外部调用。 Consumer 配置使用 Sabre 提供的 WSDL。

我确定我错过了一些简单的东西。任何帮助表示赞赏。

Transform 处理器中的 Dataweave 代码:

%dw 2.0
output application/xml
ns soapenv http://schemas.xmlsoap.org/soap/envelope/
ns eb http://www.ebxml.org/namespaces/messageHeader
ns wsse http://schemas.xmlsoap.org/ws/2002/12/secext
---
{
    soapenv#Envelope: {
        soapenv#Header: 
            eb#MessageHeader: {
                eb#From: {
                    eb#PartyId: {}
                },
                eb#To: {
                    eb#PartyId: {}
                },
                eb#CPAId: "XX",
                eb#ConversationId: vars.responseVars.conversationId,
                eb#Service: "DisplayInventoryRecordLLSRQ",
                eb#Action: "DisplayInventoryRecordLLSRQ",
                eb#MessageData: {
                    eb#MessageId: {},
                    eb#Timestamp: {},
                    eb#TimeToLive: {}
            },
            wsse#Security: {
                wsse#BinarySecurityToken: vars.responseVars.securityToken
            }
        },
        soapenv#Body: {
            DisplayInventoryRecordRQ: {
                POS: {
                    Source: {
                        PseudoCityCode: vars.requestVars.origin
                },
                FlightNumber: vars.requestVars.flightNumber,
                DepartureDate: vars.requestVars.departureDate,
                DepartureAirport: {
                    LocationCode: "ALL"
                },
                ArrivalAirport: {
                    LocationCode: vars.requestVars.destination, 
                    CodeContext: "IATA"
                    }   
                }           
            }       
        }
    }
}

XML 传递给消费者:

<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header>
        <eb:MessageHeader xmlns:eb="http://www.ebxml.org/namespaces/messageHeader">
            <eb:From>
                <eb:PartyId/>
            </eb:From>
            <eb:To>
                <eb:PartyId/>
            </eb:To>
            <eb:CPAId>XX</eb:CPAId>
            <eb:ConversationId>### Masked ###</eb:ConversationId>
            <eb:Service>DisplayInventoryRecordLLSRQ</eb:Service>
            <eb:Action>DisplayInventoryRecordLLSRQ</eb:Action>
            <eb:MessageData>
                <eb:MessageId/>
                <eb:Timestamp/>
                <eb:TimeToLive/>
            </eb:MessageData>
            <wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext">
                <wsse:BinarySecurityToken>### Masked ###</wsse:BinarySecurityToken>
            </wsse:Security>
        </eb:MessageHeader>
    </soapenv:Header>
    <soapenv:Body>
        <DisplayInventoryRecordRQ>
            <POS>
                <Source>
                    <PseudoCityCode>XXX</PseudoCityCode>
                </Source>
                <FlightNumber>###</FlightNumber>
                <DepartureDate>2020-03-05</DepartureDate>
                <DepartureAirport>
                    <LocationCode>ALL</LocationCode>
                </DepartureAirport>
                <ArrivalAirport>
                    <LocationCode>XXX</LocationCode>
                    <CodeContext>IATA</CodeContext>
                </ArrivalAirport>
            </POS>
        </DisplayInventoryRecordRQ>
    </soapenv:Body>
</soapenv:Envelope>

错误信息:

ERROR 2020-03-05 13:01:25,188 [[MuleRuntime].io.10: [proc-ix-action-server-app].main-flow.BLOCKING @72b2e7e6] [event: 1594fcb1-5f1c-11ea-b89c-8c04ba8b4cea] org.mule.runtime.core.internal.exception.OnErrorContinueHandler: 
********************************************************************************
Message               : Missing <soap-env:Header> in <soap-env:Envelope>.
Error type            : WSC:SOAP_FAULT
Element               : get-inventory-subflow/processors/0/processors/1 @ proc-ix-action-server-app:main.xml:133 (Consume)
Element XML           : <wsc:consume operation="DisplayInventoryRecordRQ" doc:name="Consume" doc:id="fbeaeba3-f04c-4d40-bf87-bd63c1a8ac34" config-ref="Web_Service_Consumer_Config"></wsc:consume>

工作邮递员要求比较:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:eb="http://www.ebxml.org/namespaces/messageHeader" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
  <SOAP-ENV:Header>
    <eb:MessageHeader SOAP-ENV:mustUnderstand="1" eb:version="1.0">
      <eb:From>
        <eb:PartyId />
      </eb:From>
      <eb:To>
        <eb:PartyId />
      </eb:To>
      <eb:CPAId>XX</eb:CPAId>
      <eb:ConversationId>### Masked ###</eb:ConversationId>
      <eb:Service>DisplayInventoryRecordLLSRQ</eb:Service>
      <eb:Action>DisplayInventoryRecordLLSRQ</eb:Action>
      <eb:MessageData>
        <eb:MessageId />
        <eb:Timestamp />
        <eb:TimeToLive />
      </eb:MessageData>
    </eb:MessageHeader>
    <wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext">
      <wsse:BinarySecurityToken valueType="String" EncodingType="wsse:Base64Binary">### Masked ###</wsse:BinarySecurityToken>
    </wsse:Security>
  </SOAP-ENV:Header>
  <SOAP-ENV:Body>
    <DisplayInventoryRecordRQ TimeStamp="2010-11-30T15:30:00-06:00" Version="1.2.1" xmlns="http://webservices.sabre.com/sabreXML/2003/07" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <POS>
            <Source PseudoCityCode="XXX"/>
        </POS>
        <FlightNumber>##</FlightNumber>
        <DepartureDate>2020-03-05</DepartureDate>
        <DepartureAirport LocationCode="XXX"/>
        <ArrivalAirport LocationCode="XXX" CodeContext="IATA"/>
    </DisplayInventoryRecordRQ>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

【问题讨论】:

  • 什么是 DisplayInventoryRecordPortType 和 DisplayInventoryRecordService ?这些只是字符串文字,还是您试图从属性文件中访问变量或值?
  • 加载到配置中时从 wsdl 文件中提取这些文件
  • 您是否尝试过将该数据编织的输出粘贴到邮递员中?会发生什么?
  • &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"&gt; &lt;soap-env:Header/&gt; &lt;soap-env:Body&gt; &lt;soap-env:Fault&gt; &lt;faultcode&gt;soap-env:Client.InvalidEbXmlMessage&lt;/faultcode&gt; &lt;faultstring&gt;Unable to internalize message&lt;/faultstring&gt; &lt;detail&gt; &lt;StackTrace&gt;javax.xml.soap.SOAPException: Unable to internalize message&lt;/StackTrace&gt; &lt;/detail&gt; &lt;/soap-env:Fault&gt; &lt;/soap-env:Body&gt; &lt;/soap-env:Envelope&gt;
  • 在 Mule 中的请求中,您的 wsse:Security 标签位于 eb:MessageHeader 内。在您的邮递员请求中,您将它放在您的 eb:MessageHeader 之外。这会导致问题吗?

标签: web-services soap dataweave sabre mulesoft


【解决方案1】:

您应该只将正文内容作为有效负载传递,而不是肥皂元素。这些是由 Web 服务使用者添加的。

【讨论】:

  • 谢谢,但我已经尝试消除 Envelope、Header 和 Body 标签,但 Mule 仍然想要某种根标签,因为它会在第一个标签上引发“尝试输出第二个根”错误。
  • 正文没有根标签?我会尝试搜索一些示例。
猜你喜欢
  • 1970-01-01
  • 2016-11-01
  • 2012-04-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-04-29
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多