Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用ApacheCamel在soap请求中添加soap头_Apache_Web Services_Soap - Fatal编程技术网

如何使用ApacheCamel在soap请求中添加soap头

如何使用ApacheCamel在soap请求中添加soap头,apache,web-services,soap,Apache,Web Services,Soap,我正在调用一个soap代理Web服务,它具有头(用于身份验证)和主体(具有有效负载)。下面是我的soap请求 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:prox="http://webservices.com/ProxyService"> <soapenv:Header> <prox:authentication>

我正在调用一个soap代理Web服务,它具有头(用于身份验证)和主体(具有有效负载)。下面是我的soap请求

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:prox="http://webservices.com/ProxyService">
    <soapenv:Header>
      <prox:authentication>
         <prox:user>admin</prox:user>
         <prox:password>admin</prox:password>
      </prox:authentication>
    </soapenv:Header>

    <soapenv:Body>
    <!-- Here is the body -->
    </soapenv:Body>
</soapenv:Envelope>

管理
管理
我正在使用apachecamel。我能够创造身体。但我无法在代理请求中添加/设置标头。在代理中,当请求发出时,它不包含任何头。它只包含信封内的主体。
请帮助我在soap请求中创建标头。

您可以像这样形成soap标头字符串

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:prox="http://webservices.com/ProxyService">
    <soapenv:Header>
      <prox:authentication>
         <prox:user>admin</prox:user>
         <prox:password>admin</prox:password>
      </prox:authentication>
    </soapenv:Header>

    <soapenv:Body>
    <!-- Here is the body -->
    </soapenv:Body>
</soapenv:Envelope>
final String soapHeader = "<wsse:Security xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\" soap:mustUnderstand=\"true\" xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\"><wsse:UsernameToken><wsse:Username>abhishek</wsse:Username><wsse:Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText\">diamond2989</wsse:Password></wsse:UsernameToken></wsse:Security>";

更改字符串以适应您的请求

您可以像这样形成soap头字符串

final String soapHeader = "<wsse:Security xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\" soap:mustUnderstand=\"true\" xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\"><wsse:UsernameToken><wsse:Username>abhishek</wsse:Username><wsse:Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText\">diamond2989</wsse:Password></wsse:UsernameToken></wsse:Security>";

更改字符串以满足您的请求

您是否可以共享SpringWebServiceConstants的maven依赖项您似乎没有使用SpringCamel上下文,请编辑您的问题以包括camel-context.xml请将xml配置粘贴到为该服务配置终结点的位置,camel还使用该服务的代码,其中exchange callI am使用spring camel上下文。甚至我也试过上面的代码。但在代理请求中,soap头不会出现。您能否共享SpringWebServiceConstants的maven依赖项?您似乎没有使用spring camel上下文,请编辑您的问题以包括camel-context.xml请将xml配置粘贴到为该服务配置终结点的位置,camel还使用该服务的代码,其中exchange callI am使用spring camel上下文。甚至我也试过上面的代码。但在代理请求中,soap头不会出现。