Question
Salame
Last activity: 12 May 2017 5:06 EDT
How to add HTTP header to Connect-SOAP
Hello,
How to add HTTP header to Connect-SOAP ? The fix in https://collaborate.pega.com/question/how-add-http-header-connect-soap is not working, can you please check?
Thanks,
Rosy
***Updated by moderator: Lochan to add Category***
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
Sunrise UPC GmbH
CH
Hi,
I had the same need and used the solution from
https://collaborate.pega.com/question/how-add-http-header-connect-soap
It worked for me, but I had to change the suggested code: instead than
com.pega.apache.axis2.client.Options options = new com.pega.apache.axis2.client.Options();
you should use
com.pega.apache.axis2.client.OperationClient client = (com.pega.apache.axis2.client.OperationClient) opClient;
com.pega.apache.axis2.client.Options options = client.getOptions();
Otherwise the existing options are lost
Cheers
Paolo
Pegasystems Inc.
US
Rosy,
What do you mean it is not working? Just to be clear, this is to add a custom header at http level not under <soap:header> element, which you should simply add from the request header under Connect-SOAP rule request header section (under request tab). See the results after adding the similar code as described in the article:
Salame
Kevin,
I don't want a SOAP Header, my need is a custom HTTP Header and this is not working.
Caused by: com.pega.pegarules.pub.services.RemoteApplicationException: SOAP service failed
at com.pegarules.generated.activity.ra_action_invokeaxis2_a5b9a7777f50404fc80c65edc1fd4a14.step15_circum0(ra_action_invokeaxis2_a5b9a7777f50404fc80c65edc1fd4a14.java:4040)
Kevin,
I don't want a SOAP Header, my need is a custom HTTP Header and this is not working.
Caused by: com.pega.pegarules.pub.services.RemoteApplicationException: SOAP service failed
at com.pegarules.generated.activity.ra_action_invokeaxis2_a5b9a7777f50404fc80c65edc1fd4a14.step15_circum0(ra_action_invokeaxis2_a5b9a7777f50404fc80c65edc1fd4a14.java:4040)
at com.pegarules.generated.activity.ra_action_invokeaxis2_a5b9a7777f50404fc80c65edc1fd4a14.perform(ra_action_invokeaxis2_a5b9a7777f50404fc80c65edc1fd4a14.java:308)
at com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:3510)
at com.pegarules.generated.activity.ra_action_invoke_c28ff8c27ac24045d30f5561679549d1.step8_circum0(ra_action_invoke_c28ff8c27ac24045d30f5561679549d1.java:1037)
at com.pegarules.generated.activity.ra_action_invoke_c28ff8c27ac24045d30f5561679549d1.perform(ra_action_invoke_c28ff8c27ac24045d30f5561679549d1.java:189)
at com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:3510)
at com.pegarules.generated.activity.sh_action_runqmstask_5001b593f1f1ee15e78c4ce928b36e4e.step2_circum0(sh_action_runqmstask_5001b593f1f1ee15e78c4ce928b36e4e.java:308)
at com.pegarules.generated.activity.sh_action_runqmstask_5001b593f1f1ee15e78c4ce928b36e4e.perform(sh_action_runqmstask_5001b593f1f1ee15e78c4ce928b36e4e.java:94)
at com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:3510)
at com.pega.pegarules.session.internal.mgmt.Executable.doAction(Executable.java:3243)
at com.pegarules.generated.activity.ra_action_pyrunrecordexecute_0f739eeb61a9046be9a6d286a73f151a.step1_circum0(ra_action_pyrunrecordexecute_0f739eeb61a9046be9a6d286a73f151a.java:175)
at com.pegarules.generated.activity.ra_action_pyrunrecordexecute_0f739eeb61a9046be9a6d286a73f151a.perform(ra_action_pyrunrecordexecute_0f739eeb61a9046be9a6d286a73f151a.java:69)
at com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:3510)
at com.pega.pegarules.session.internal.mgmt.Executable.invokeActivity(Executable.java:10587)
at com.pegarules.generated.activity.ra_action_pzrunrecordexecute_f73998920c112079b42c8cca0a4e44ad.step11_circum0(ra_action_pzrunrecordexecute_f73998920c112079b42c8cca0a4e44ad.java:1009)
at com.pegarules.generated.activity.ra_action_pzrunrecordexecute_f73998920c112079b42c8cca0a4e44ad.perform(ra_action_pzrunrecordexecute_f73998920c112079b42c8cca0a4e44ad.java:245)
at com.pega.pegarules.session.internal.mgmt.Executable.doActivity(Executable.java:3510)
at com.pega.pegarules.session.internal.mgmt.base.ThreadRunner.runActivitiesAlt(ThreadRunner.java:646)
... 49 more
Caused by: java.lang.ClassCastException: com.pega.apache.commons.httpclient.Header cannot be cast to com.pega.apache.axis2.context.NamedValue
Regards,
Rosy
Pegasystems Inc.
US
Rosy,
What version of pega are you using? It is possible your envionment is loading some undesirable version of the class com.pega.apache.axis2.context.NamedValue. As a first step of troubleshooting, use SMA tool >> Advanced >> ETier runtime to look up where this class is loaded from, here is example from my environment:
Salame
Kevin, I'm using PRPC 7.2 and the same version of praxis2 as yours.
Regards,
Rosy
Updated: 10 Aug 2016 23:55 EDT
Self
US
Kevin, Could you please share which tool were you referring to when tracing a soap request which shows header information, Looks neater.
Capgemini
IN
Ashwin,
You can use tools like TCP Monitor to intercept the request and view the details.
As an alternative, you can also turn on the logger - httpclient.wire.header to view the header details in the PegaRules log file
Capgemini
IN
Rosy,
If you want to set the value for SOAPAction HTTP header, then it can be done directly from the Connect-SOAP rule form (Service tab --> SOAPAction Header field).
For other headers, you can follow the article that you were referring to
Salame
Guys,
I don't want a SOAP Header, my need is a custom HTTP Header and this is not working.
Regards,
Rosy
Labb
GB
Hey Rosy,
did you ever get a solution for this? i'm also running into the issue.
thanks,
Leigh
Accepted Solution
Sunrise UPC GmbH
CH
Hi,
I had the same need and used the solution from
https://collaborate.pega.com/question/how-add-http-header-connect-soap
It worked for me, but I had to change the suggested code: instead than
com.pega.apache.axis2.client.Options options = new com.pega.apache.axis2.client.Options();
you should use
com.pega.apache.axis2.client.OperationClient client = (com.pega.apache.axis2.client.OperationClient) opClient;
com.pega.apache.axis2.client.Options options = client.getOptions();
Otherwise the existing options are lost
Cheers
Paolo