2014-04-16 11 views
9

के रूप में SOAP अनुरोध भेजने में कोई SOAPAction हेडर त्रुटि नहीं प्राप्त हो रहा है, इसलिए मैं कुछ परियोजना बाधाओं के कारण SOAPUI में HTTP पोस्ट के रूप में एक SOAP अनुरोध भेज रहा हूं। मेरा अनुरोध यहाँ है:HTTP पोस्ट

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 हैडर निर्धारित किया था, फिर भी मैं कोई 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> 

किसी को भी मुझे बता सकते हैं कि हम यहाँ क्या कर सकते हैं?

+0

एक लाइन जो '<साबुन तरह दिखता है के लिए अपने डबल्यूएसडीएल नज़र में: आपरेशन soapAction =" http://example.com/GetLastTradePrice "/>'। 'HelpDesk_Query_Service' ऑपरेशन के बराबर साबुन क्रिया क्या है? –

उत्तर

15

ऐसा लगता है कि आप गलत साबुनएक्शन हेडर भेज रहे हैं। डब्लूएसडीएल को देखें और परीक्षण की जा रही सेवा के लिए साबुन तत्व तत्व के लिए मूल्य का पता लगाएं।

डब्लूएसडीएल में <soap:operation soapAction="http://example.com/GetLastTradePrice"/> जैसी लाइन की तलाश करें।

3
request.Headers.Add("SOAPAction", YOUR SOAP ACTION); 
+0

एक httpwebrequest बनाएं और फिर इसे करने के लिए शीर्ष लेख जोड़ने HttpWebRequest = HttpWebRequest.Create रूप 'code'Dim bs = Encoding.UTF8.GetBytes (" साबुन ") मंद wr (" XX ") wr.Headers.Add (" उर साबुन एचडीआर "," xxx ") wr.ContentType =" text/xml; charset = utf-8 " wr.Method =" POST " wr.ContentLength = bs.Length मंद एसडीएस स्ट्रीम के रूप में = wr.GetRequestStream () sds.Write (बी एस, 0, bs.Length) sds.Close() मंद wr के रूप में WebResponse = wr.GetResponse() एसडीएस = wr.GetResponseStream() मंद sr StreamReader = नई StreamReader के रूप में (एसडीएस) स्ट्रिंग के रूप में मंद strResult = sr.ReadToEnd() txtResult .Text = strResult sds.Close() sr.Close() wr.Close() 'code' –

0

मैं जवाब ynneh ने सुझाव दिया में टिप्पणी जोड़ने के लिए कोशिश की, लेकिन कोड पठनीय नहीं था। उसका उत्तर उपयोगी है लेकिन बहुत छोटा है।

httpwebrequest बनाएं और फिर इसमें हेडर जोड़ें। निम्नलिखित पूरा उदाहरण है:

Dim bytSoap = System.Text.Encoding.UTF8.GetBytes("soap content") 

     Dim wrRequest As HttpWebRequest = HttpWebRequest.Create("xxxxx") 

     wrRequest.Headers.Add("your soap header", "xxx") 

     wrRequest.ContentType = "text/xml; charset=utf-8" 
     wrRequest.Method = "POST" 
     wrRequest.ContentLength = bytSoap.Length 

     Dim sDataStream As Stream = wrRequest.GetRequestStream() 
     sDataStream.Write(bytSoap, 0, bytSoap.Length) 
     sDataStream.Close() 

     Dim wrResponse As WebResponse = wrRequest.GetResponse() 
     sDataStream = wrResponse.GetResponseStream() 
     Dim srReader As StreamReader = New StreamReader(sDataStream) 
     Dim strResult As String = srReader.ReadToEnd() 
     txtResult.Text = strResult 
     sDataStream.Close() 
     srReader.Close() 
     wrResponse.Close() 
0

// डेल्फी

var 
xmlhttp : IXMLHTTPRequest; // unit MSXML2_TLB 
begin 
xmlhttp := CoXMLHTTP.Create; 
xmlhttp.open('POST', Edit7.Text, False, EmptyParam, EmptyParam); 
xmlhttp.setRequestHeader('SOAPAction','POST') 
संबंधित मुद्दे