我正在使用Apache CXF制作Spring SOAP服务,我不明白如何从头部获取数据(UserContext),我在wsdl中的标题如下所示:
<soap:Header>
<v1:UserContext>
<userContext>
<com:systemName>?</com:systemName>
<com:userName>?</com:userName>
<com:userRoleId>?</com:userRoleId>
<!--Optional:-->
<com:isUserRoleSystemWide>?</com:isUserRoleSystemWide>
<com:userRights>
<!--1 or more repetitions:-->
<com:userRightId>?</com:userRightId>
</com:userRights>
<com:jobExecutionId>?</com:jobExecutionId>
<!--Optional:-->
<com:hostIp>?</com:hostIp>
<!--Optional:-->
<com:hostName>?</com:hostName>
</userContext>
</v1:UserContext>
我的实现服务方法如:
@Service("serviceV1")
public class ServiceImpl implements Service {
@Override
public ServiceResponse getDataFromHeader(ServiceRequest request) {
// I need to use data from Header (In request object does't contain it (header data))
}
}
我认为需要实现拦截器,但是如何将数据移动到SOAP方法中呢?