Announcement Announcement Module
Collapse
No announcement yet.
Echo Soap Request Header in Soap Response? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Echo Soap Request Header in Soap Response?

    What would be the best way to populate a SOAP response with a header obtained from the SOAP request? Is this possible in an impl of EndpointInterceptorAdapter?

  • #2
    An endpoint interceptor seems to be appropriate to implement the logic you're describing.
    EndpointInterceptorAdapter is just a convenient class that provides an empty implementation of EndpointInterceptor. If you sublass EndpointInterceptorAdapter, you don't have implement the methods you don't use.
    Be aware though of thread saftey issues if you decide to store the request headers in instance fields of your interceptor.

    Comment


    • #3
      I have tried to add a header using the following code. this clearly does not work. can anyone provide some assistance? what am I missing?

      public boolean handleResponse(MessageContext messageContext, Object endpoint) {
      Object header = messageContext.getProperty(messageContextHeaderPro pertyName);

      if(header != null) {
      MyHeader myheader = (MyHeader) header;
      QName qname = QNameUtils.getQNameForNode(myheader.getDomNode());

      SoapMessage response = (SoapMessage) messageContext.getResponse();
      SoapHeaderElement she = response.getSoapHeader().addHeaderElement(qname);
      DOMResult domresult = (DOMResult) she.getResult();
      Node n = myheader .getDomNode();
      domresult.setNode(n);
      }
      return true;
      }

      Comment

      Working...
      X