cancel
Showing results for 
Search instead for 
Did you mean: 

Passing Soap Header in Web Service

Former Member
0 Kudos

Hi Team,

In our application, we have used web service through webservice proxy wizard using the WSDL file.  Now due to security reasons we need to pass Soap Header in the webservice call. Can you please help on how to pass soap header in the webservice call ?

Please find the below webservice code/

Long ll_ret

edpmdata ll_ReturnVal
edpmreq lnv_Request_data
//filter lnv_filter
Datawindowchild dwc_child
str_pass l_str_pass

long l_l_row_count, l_l_row
String l_s_code, l_s_modify, l_l_ret
String str_proxy_name = "sohedpmservice"
String l_s_delivery_pref, l_s_email
String ls_url, l_s_ini_file

l_s_ini_file = g_nv_ini.fnv_get_name ()
ls_url = ProfileString(l_s_ini_file,"External", "EDPM_URL", "")
Soapconnection lsc_Conn
sohedpmservice lproxy_obj
lsc_Conn = create Soapconnection
SetPointer (Hourglass!)
Try
ll_ret = lsc_Conn.CreateInstance(lproxy_obj, str_proxy_name, ls_url)
Catch (SoapException e )
Error.fnv_error("0001", This, "ue_process_fields","Error Creating Instance","",FALSE,1,0)
Message.ReturnValue = -1
RETURN -1
end try

IF ll_ret <> 0 THEN
Error.fnv_error("0001", This, "ue_process_fields","Error Creating Instance","",FALSE,1,0)
Message.ReturnValue = -1
RETURN -1
END IF
Try
lnv_Request_data = create edpmreq
lnv_Request_data.value = l_s_party_key
ll_ReturnVal = lproxy_obj.getcommpref(lnv_Request_data)

If ll_ReturnVal.ws_serviceresult.resultcode = '5' Then
   Error.fnv_error("0001", This, "ue_process_fields",String(ll_returnval.ws_serviceresult.ws_resultinfo) ,"Error Response ", FALSE, 1,0)
   Message.ReturnValue = -1
RETURN -1
End if
l_s_delivery_pref = ll_ReturnVal.deliverymethod
l_s_email = ll_ReturnVal.emailaddr
i_str_pass.s[86] =  l_s_delivery_pref
i_str_pass.s[87] =  l_s_email
i_str_pass.s[88] = l_s_party_key

Catch ( SoapException a )
Error.fnv_error("0001", This, "ue_process_fields","Error Response","Error Response",FALSE,1,0)
Message.ReturnValue = -1
RETURN -1
end try
Destroy lsc_Conn

Return 1

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member190719
Active Contributor
0 Kudos

What version of PowerBuilder?

PB.Net or Classic?

Are you using the SOAP or .Net Engine (if using Classic)?

What kind of header?

There is limited support for passing custom headers in the .Net engine in Classic.  The header would need to be defined in the WSDL for the service.

Anything beyond that (e.g., WS-Security) would need to be handled in a WCF client in PB.Net.