在发送SOAP请求作为HTTP POST时没有获得SOAPAction头错误

Aru*_*run 15 xml soap web-services soapui

由于一些项目限制,我在SOAPUI中发送SOAP请求作为HTTP POST.我的要求在这里:

POST httplink HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: "urn:HPD_IncidentInterface_WS/HelpDesk_Query_Service"
Content-Length: 725
Host: itsm-mt-dev
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)


<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:HPD_IncidentInterface_WS">
   <soapenv:Header>
      <urn:AuthenticationInfo>
         <urn:userName>XXXXXXXXXX</urn:userName>
         <urn:password>XXXXXXXXX</urn:password>
         <!--Optional:-->
         <urn:authentication>?</urn:authentication>
         <!--Optional:-->
         <urn:locale>?</urn:locale>
         <!--Optional:-->
         <urn:timeZone>?</urn:timeZone>
      </urn:AuthenticationInfo>
   </soapenv:Header>
   <soapenv:Body>
      <urn:HelpDesk_Query_Service>
         <urn:Incident_Number>XXXXXXXXXX</urn:Incident_Number>
      </urn:HelpDesk_Query_Service>
   </soapenv:Body>
</soapenv:Envelope>
Run Code Online (Sandbox Code Playgroud)

虽然我已经设置了SOAPAction标头,但我仍然没有收到SOAPAction标头错误.

回复如下:

<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/">itsm-mt-dev</ns2:hostname>
         </detail>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>
Run Code Online (Sandbox Code Playgroud)

任何人都可以建议我在这里做什么?

Abh*_*ana 18

看起来您发送的SOAPAction标头不正确.查看WSDL并找出正在测试的服务的soapAction元素的值.

在WSDL中查找类似于的行<soap:operation soapAction="http://example.com/GetLastTradePrice"/>.


小智 5

request.Headers.Add( "SOAPAction", YOUR SOAP ACTION );
Run Code Online (Sandbox Code Playgroud)


ank*_*kit 5

您必须添加SOAPActionadd如果发布 API。

邮递员形象


ins*_*ing 5

只需将SOAPAction参数添加到请求头中并使用空引号即可。

在此输入图像描述