Having trouble formatting SOAP fot a HM request

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
Post Reply
cgrieves
Posts: 7
Joined: Wed Jan 27, 2010 8:17 am

Having trouble formatting SOAP fot a HM request

Post by cgrieves »

Hi all, I've got a webservice that responds via SOAPUI using the following XML:

Code: Select all

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tsws="http://test.com//TSWS" xmlns:tsx="http://schemas.datacontract.org/1/testAPI.Data">
	<soapenv:Header>
		<tsws:HeaderData>
			<tsx:Security>
				<tsx:LicenceKey>1234567990</tsx:LicenceKey>
			</tsx:Security>
		</tsws:HeaderData>
	</soapenv:Header>
	<soapenv:Body>
		<tsws:SearchRequest>
			<tsws:SearchRequestData>
				<tsx:StartDt>30-Dec-2020</tsx:StartDt>
				<tsx:EndDt>31-Dec-2020</tsx:EndDt>
				<tsx:AvailOnly>0</tsx:AvailOnly>
				<tsx:ServiceSearchCriteria>
					<tsx:ServiceIDs>1123</tsx:ServiceIDs>
					<tsx:AdditionalSearchFilter>0</tsx:AdditionalSearchFilter>
				</tsx:ServiceSearchCriteria>
				<PriceCriteria xmlns="http://schemas.datacontract.org/1/testapi.Data">
					<PriceReq>1</PriceReq>
					<Currency>SYNCHRONOUS</Currency>
					<DispAdltChldPrices>1</DispAdltChldPrices>
				</PriceCriteria>
				<tsx:SearchType>
					<tsx:PaxSearch>
						<tsx:ServiceOptions>
							<tsx:ServiceOption>
								<RmNum>1</RmNum>
								<tsx:OccID>2</tsx:OccID>
								<tsx:OptionID>1225</tsx:OptionID>
								<tsx:NoOfAdults>2</tsx:NoOfAdults>
								<tsx:NoOfChildren>0</tsx:NoOfChildren>
							</tsx:ServiceOption>
						</tsx:ServiceOptions>
					</tsx:PaxSearch>
				</tsx:SearchType>
				<tsx:TempSearchIndicator>0</tsx:TempSearchIndicator>
			</tsws:SearchRequestData>
		</tsws:SearchRequest>
	</soapenv:Body>
</soapenv:Envelope>
And the following header data:

Code: Select all

POST http://server1/TSWebService/TSWSSearchAccomodation.svc HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: "http://test.com//TSWS/ISearchService/SearchService"
Content-Length: 1487
Host: server1
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
But I'm having real trouble formatting the request and header data in HM (version 10.14). Whatever I try I just get an HTTP/1.1 400 Bad Request error when I click "Test". I'm using HM via an RCC connection to our HM server.

Any help much appreciated, thanks all.
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

May we see your test settings?
You may export test settings into text file using menu File -> Export to Text file.
cgrieves
Posts: 7
Joined: Wed Jan 27, 2010 8:17 am

Post by cgrieves »

Sure! Thanks for the reply.

Code: Select all

;-----------------------------------------------------------------------------
;- HostMonitor`s export/import file                                          -
;- Generated by RCC 5.14 at 03/10/2016 16:16:58                              -
;- Source file: D:\testlist.hml                                          -
;- Generation mode: Selected_Tests                                           -
;-----------------------------------------------------------------------------


; ------- Test #01 -------


Method      = SOAP
;--- Common properties ---
;DestFolder = TSWS\
Title       = SOAP tsws:SearchRequest
Comment     = SOAP http://server1/TSWebService/TSWSSearchAccomodation.svc
RelatedURL  = 
NamePattern = SOAP %object%
CmntPattern = SOAP %path%
ScheduleMode= Regular
Schedule    = 
Interval    = 60
Alerts      = 
Alerts2     = 
ReverseAlert= No
UnknownIsBad= Yes
WarningIsBad= Yes
UseCommonLog= Yes
PrivLogMode = Default
CommLogMode = Default
;--- Test specific properties ---
URL         = http://server1/TSWebService/TSWSSearchAccomodation.svc
UrlUseMacros= No
Timeout     = 1000
SoapVersion = 1.1
PostData    = <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tsws="http://test.com//TSWS" xmlns:tsx="http://schemas.datacontract.org/1/testAPI.Data"> ^M   <soapenv:Header> ^M      <tsws:HeaderData> ^M         <tsx:Security> ^M            <tsx:LicenceKey>1234567990</tsx:LicenceKey> ^M         </tsx:Security> ^M      </tsws:HeaderData> ^M   </soapenv:Header> ^M   <soapenv:Body> ^M      <tsws:SearchRequest> ^M         <tsws:SearchRequestData> ^M            <tsx:StartDt>30-Dec-2020</tsx:StartDt> ^M            <tsx:EndDt>31-Dec-2020</tsx:EndDt> ^M            <tsx:AvailOnly>0</tsx:AvailOnly> ^M            <tsx:ServiceSearchCriteria> ^M               <tsx:ServiceIDs>1123</tsx:ServiceIDs> ^M               <tsx:AdditionalSearchFilter>0</tsx:AdditionalSearchFilter> ^M            </tsx:ServiceSearchCriteria> ^M            <PriceCriteria xmlns="http://schemas.datacontract.org/1/testapi.Data"> ^M               <PriceReq>1</PriceReq> ^M               <Currency>SYNCHRONOUS</Currency> ^M               <DispAdltChldPrices>1</DispAdltChldPrices> ^M            </PriceCriteria> ^M            <tsx:SearchType> ^M               <tsx:PaxSearch> ^M                  <tsx:ServiceOptions> ^M                     <tsx:ServiceOption> ^M                        <RmNum>1</RmNum> ^M                        <tsx:OccID>2</tsx:OccID> ^M                        <tsx:OptionID>1225</tsx:OptionID> ^M                        <tsx:NoOfAdults>2</tsx:NoOfAdults> ^M                        <tsx:NoOfChildren>0</tsx:NoOfChildren> ^M                     </tsx:ServiceOption> ^M                  </tsx:ServiceOptions> ^M               </tsx:PaxSearch> ^M            </tsx:SearchType> ^M            <tsx:TempSearchIndicator>0</tsx:TempSearchIndicator> ^M         </tsws:SearchRequestData> ^M      </tsws:SearchRequest> ^M   </soapenv:Body> ^M</soapenv:Envelope>
OptHeaders  = POST http://server1/TSWebService/TSWSSearchAccomodation.svc HTTP/1.1 ^MAccept-Encoding: gzip,deflate ^MContent-Type: text/xml;charset=UTF-8 ^MSOAPAction: "http://test.com//TSWS/ISearchService/SearchService" ^MContent-Length: 1487 ^MHost: server1
IgnoreUnknCA= No
CheckContents = contain
Expression    = ZZZ
CaseSensitive = No
WholeWordsOnly= No
ExprUseMacros = No

;-----------------------------------------------------------------------------
; Exported 1 items
I've replaced the server name, schemas and some of the data elements for security.
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

Could you try leaving only SOAPAction header:
SOAPAction: "http://test.com//TSWS/ISearchService/SearchService"
Also, please check if it is correct (e.g. replace double slach with sibgle one after test.com)
cgrieves
Posts: 7
Joined: Wed Jan 27, 2010 8:17 am

Post by cgrieves »

Marvellous- that worked (can't believe I didn't try it!)

Thanks for the support!
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

You are welcome!
Post Reply