由于某些项目限制,我正在SOAPUI中以HTTP POST的形式发送SOAP请求。
我的要求在这里:
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>
尽管设置了SOAPAction header ,但仍然没有出现SOAPAction header 错误。
响应如下:
<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>
有人可以建议我在这里可以做什么吗?
最佳答案
似乎您发送的是不正确的soapAction header 。查看WSDL并找出要测试的服务的soapAction元素的值。
在WSDL中寻找类似于<soap:operation soapAction="http://example.com/GetLastTradePrice"/>
的行。