如何在空手道中传递带有键的SOAP头

时间:2018-06-09 06:19:26

标签: soap header karate

我想用空手道打电话给下面的请求:

http://testsample.com/test?request=<REQUESTS>
<REQUEST TYPE="createClientAccount" REF_NUM="A1">
<CRM_ID>ABC_123</CRM_ID>
<CRM_SYSTEM_ID>abc</CRM_SYSTEM_ID>       
<AUTO_APPROVE>TRUE</AUTO_APPROVE>
</REQUEST>
</REQUESTS>

我尝试过以下选项,但它没有用,有人可以在这里建议什么错误吗?

Given url 'http://testsample.com/test'
And request
"""
<REQUESTS>
<REQUEST TYPE="createClientAccount" REF_NUM="A1">
<CRM_ID>ABC_123</CRM_ID>
<CRM_SYSTEM_ID>abc</CRM_SYSTEM_ID>       
<AUTO_APPROVE>TRUE</AUTO_APPROVE>
</REQUEST>
</REQUESTS>
"""
And header Content-Type = 'application/soap+xml'
When method post
Then status 200

1 个答案:

答案 0 :(得分:0)

哎呀,这看起来像一个非常设计的API。您确定要尝试将该XML作为URL的一部分发送吗?然后这样做:

* string xml = <REQUESTS><REQUEST TYPE="createClientAccount" REF_NUM="A1"><CRM_ID>ABC_123</CRM_ID><CRM_SYSTEM_ID>abc</CRM_SYSTEM_ID><AUTO_APPROVE>TRUE</AUTO_APPROVE></REQUEST></REQUESTS> 
Given url 'http://testsample.com/test'
And param request = xml
And request ''
When method post

如果您不熟悉HTTP和REST,请接受某人的帮助。