当我在柑橘框架中添加 header 时,出现错误
com.sun.xml.messaging.saaj.soap.impl.HeaderImpl addHeaderElement
SEVERE: SAAJ0131: HeaderElements must be namespace qualified
10:58:23,221 DEBUG t.TestContextFactory| Created new test context - using global variables: '{}'
10:58:23,221 DEBUG ns.CitrusAnnotations| Injecting Citrus framework instance on test class field 'citrus'
10:58:23,221 DEBUG CitrusDslAnnotations| Injecting test runner instance on test class field 'runner'
org.springframework.ws.soap.saaj.SaajSoapHeaderException: Could not access header: HeaderElements must be namespace qualified; nested exception is com.sun.xml.messaging.saaj.SOAPExceptionImpl: HeaderElements must be namespace qualified
我添加了标题,例如
runner.soap(a -> a.client(client).send().name("test").soapAction(operation_name).header("Authorization", "Bearer token").payload(new ClassPathResource(path + payload)));
谁能帮帮我。我是柑橘新手
最佳答案
默认情况下,Citrus 中的 SOAP header 需要设置命名空间。您的 header 是一个普通的 Http header ,没有命名空间。
设置 header 名称时,请使用特殊的 Http header 前缀“citrus_http_”,以便 Citrus 知道这应该是一个普通的 Http header 。然后您将使用“citrus_http_Authorization”
另请参阅https://citrusframework.org/citrus/reference/2.8.0/html/index.html#soap-http-mime-headers
关于java - 变得严重 : SAAJ0131: HeaderElements must be namespace qualified in citrus framework,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57647232/