在向Web服务发送SOAP请求时不会出现SOAPAction头错误

时间:2015-03-14 06:35:54

标签: xml soap

我正在向Web服务发送SOAP请求,但Web服务soapaction为null。

我的要求如下

<soapenv:Envelope soapenv:encodingStyle="http://schemas.xmlsoap.org /soap/encoding/"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<hb:getHotelValuedAvail
  xmlns:hb="http://axis.frontend.hydra.hotelbeds.com" xsi:type="xsd:string">
  <HotelValuedAvailRQ echoToken="DummyEchoToken"
    sessionId="sdff34rasdvs"
    xmlns="http://www.hotelbeds.com/schemas/2005/06/messages" version="2013/12"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.hotelbeds.com/schemas/2005/06/messages HotelValuedAvailRQ.xsd">
    <Language>ENG</Language>
    <Credentials>
      <User>xxxxxxxx</User>
      <Password>xxxxxxxx</Password>
    </Credentials>
    <PaginationData pageNumber="1"/>
    <CheckInDate date="20150513"/>
    <CheckOutDate date="20150515"/>
    <Destination code="PMI" type="SIMPLE"/>
    <OccupancyList>
      <HotelOccupancy>
        <RoomCount>1</RoomCount>
        <Occupancy>
          <AdultCount>2</AdultCount>
          <ChildCount>0</ChildCount>
        </Occupancy>
      </HotelOccupancy>
    </OccupancyList>
  </HotelValuedAvailRQ>
</hb:getHotelValuedAvail>
</soapenv:Body>

我收到肥皂动作错误。

回复如下:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Body>
 <soapenv:Fault>
 <faultcode xmlns:ns1="http://xml.apache.org/axis/">ns1:Client.NoSOAPAction</faultcode>
 <faultstring>no SOAPAction header!</faultstring>
 <detail>
 <ns2:hostname xmlns:ns2="http://xml.apache.org/axis/">we3mpf01</ns2:hostname>
 </detail>
 </soapenv:Fault>
 </soapenv:Body>
</soapenv:Envelope>

有人能建议我在这里做些什么吗?

1 个答案:

答案 0 :(得分:7)

“SOAPAction”是一个HTTP标头,您希望将其添加到该服务的SOAP请求中,以正确识别所请求的操作。 HTTP标头的值应该是正文所代表的操作的完全限定名称(即它包括命名空间)标识符。对于您提供的场景,我猜测值应该是以下值,但WSDL将为您提供特定值:

SOAPAction: "http://axis.frontend.hydra.hotelbeds.com/getHotelValuedAvail"