Question

Service SOAP: Read parameter from http header

We are implementing a Service SOAP, and one of the required input parameters can only be passed via the http header.

Is there a way to read parameters from the http header when implementing a Service SOAP, either in the request mapping or within the service acitivity?

We'd be happy for any kind of hint. Thank you

**Moderation Team has archived post**

This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.

Comments

Keep up to date on this post and subscribe to comments

September 29, 2015 - 4:53am

One option is to try Rule-Connect-Http to access the http headers.

Otherwise, you can something like below:

javax.servlet.http.HttpServletRequest req = (javax.servlet.http.HttpServletRequest) pxRequestorPage.getObject("pxHTTPServletRequest");

String YourParam = req.getHeader("YourParam");

September 30, 2015 - 4:18am
Response to AnkanC64

Hello Ankan,

we are implementing the Webservice, we are not trying to call an existing one, so I assume you mean Rule-Service-HTTP instead? That's the workaraound we are probably going for, although I'm not very happy with it.

We have tried yor Code-Snippet, but there is no 'pxHTTPServletRequest' property or object on the pxRequestor page when the service activity is executed.

Thank you anyway!

September 30, 2015 - 6:12am
Response to JohnL881

Yes John. I meant service-http. Apologies for the typo.

Let me check if I can find any more workaround. As per my knowledge, user id and password can be tracked in the header, so it might be possible to get any other parameter, although I am not sure about this. You can raise a Pega SR to check if there is any other way.

Thanks.

September 29, 2015 - 4:53am

Hi John,

This feature is not available in PRPC currently (at least till Pega 7.1.7), you need to customize 'invokeaxis2' activity. You might refer to the link below for more information on how this may be achieved.

http://blog.facilelogin.com/2011/02/adding-custom-http-headers-via-axis2.html

September 30, 2015 - 4:23am
Response to KrishnachaitanyaKondu

Hello Krishna,

we are implementing the webservice. The parameters in the http header are sent to us and we need to find a way to read them in the Pega Service Activity. From what I understand in the link you provided, it shows how to add custom http header paramaters when calling another webservice.

Thank you anyway!

September 30, 2015 - 7:06am

John,

can you please tell me is you have tried mapping the header params in the request tab of the service soap? please let me know the results SOAP.png

October 5, 2015 - 7:58am
Response to AnkanC64

Hello Ankan,

help on the rule form says that the "Request Headers" section on the Request tab of the rule form is for reading the content of the Soap-Envelopereads the content.

Complete the Request Headers section to map data from the SOAP envelope header.

That won't give us Access to the parameters passed in the http header.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header>
      <HeaderParam1>value1</HeaderParam1>
      <HeaderParam2>value2</HeaderParam2>
      <!-- and so on -->
   </soapenv:Header>
   <soapenv:Body>
      <log:SaveLogEntryRequest>
          <!-- Here our request data -->
      </log:SaveLogEntryRequest>
   </soapenv:Body>
</soapenv:Envelope>

We'd be able to read the HeaderParam 1 and 2 (from the Soap-Envelope Header), but not from the protocol-Level http header.

The SR I have submitted has changed it's type from "How-To Question" to "Enhancement Request".

I'll post updates to this as answers to my original question.

October 5, 2015 - 1:11pm
Response to JohnL881

Hi Jon,

  What is the SR number you have generated for this?

-Adi

October 5, 2015 - 1:54pm
Response to AdityaSirohi930765655

Its  SR-A9410

October 6, 2015 - 2:30am
Response to JohnL881

Okay John. Please keep us posted here in this forum. This is an interesting challenge. Thanks.

March 4, 2016 - 3:21pm

Any updates on this?

March 4, 2016 - 5:00pm
Response to MarkB208

Hi Mark Bolster

Thank you for your question. The feedback item has not yet progressed to the point that it will be included in a release.

Marissa | Community Moderator | Pegasystems Inc.

March 21, 2016 - 11:51am
Response to MarissaRogers

Thanks, Marissa!

Given the interest in  FDBK-13141, I Pulsed it with links to both this discussion and Mark Bolster's question on SA-16130 (my very late reply to him), https://pdn.pega.com/support-articles/service-soap-how-extract-values-http-header#comment-136036.

March 23, 2016 - 5:08am

We also in needed of a solution for the above mentioned requirement. Any Updates on this??