Four Js Development Tools Forum

Discussions by product => GWS => Topic started by: Joel S. on March 18, 2025, 03:29:02 am



Title: Adding to the header for WSDL generated code
Post by: Joel S. on March 18, 2025, 03:29:02 am
I'm using code generated from a WSDL file.

This particular partner wants a <SECURITY> tag in the header and below that tag, it wants a username tag and a password tag.

Is there some trick to getting these into the header?

There's a call that uses <call variable>.Binding.Request.Headers "

CALL WSHelper.WSHelper_SetRequestHeaders(RealTimeTransactionHTTPReq, iedi_Core_CoreSoapPortEndpoint.Binding.Request.Headers)

This Headers record is a dynamic array of Name and Value pairs.  I've tried adding my username with the value being username and same for password, but the server says I didn't supply a username.  I'm guessing that's because probably didn't know to put it under the <security> tag, it's being created under the <header> tag.

I've tried making one name/value pair called security with the value being <username>myusername</username><password>mypassword</password> thinking it will create:

<security><username>myusername</username><password>mypassword</password></security> But it's still not working. FGLWSDEBUG=3 isn't even showing me the header it's sending so I don't even know what that did.  Maybe it turned the < and > in my value into &lt; and &gt; and they don't look like XML tags so the host isn't seeing them.

Anybody got any ideas.  Or do I have to hack the WSDL generated code? Which I'd prefer not to do because it means every time I might regenerate the code for a new version or because the WSDL changes, I have to go in and re-add my "fix".  Which if this is the only way to get it done, so be it.

Or, I go the route of creating the XML from scratch, headers and all as I want them to look and just connecting and sending it.  I can probably still use the variables fglWSDL generates.  Maybe even the serialization of these variables.

Anybody have any experience with this sort of thing and how to do what I'm trying to do?


Title: Re: Adding to the header for WSDL generated code
Post by: Reuben B. on March 19, 2025, 01:02:43 am
With fglwsdl have you looked at -domHandler and callback functions
https://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_gws_handlers_client_006.html

These callback functions allow you to modify/interrogate request/response

Reuben