Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Soap Trace Options #2153

Open
nickhagen opened this issue Nov 6, 2020 · 1 comment
Open

Soap Trace Options #2153

nickhagen opened this issue Nov 6, 2020 · 1 comment

Comments

@nickhagen
Copy link
Contributor

So it seems the way that the SOAP driver functions is to call set_defaults() during the execute() function, this seems to be problematic for the debugging functions found here: https://fuelphp.com/docs/classes/request/soap.html

  • get_request_xml
  • get_request_headers
  • get_response_xml
  • get_response_headers

These function all require the trace option to be enabled, however, the data from these functions only gets populated AFTER the call executes! So if you try to print get_request_xml before you execute it is always null, if you call this function after execute, then the trace option gets reset on soap.php line 148 with $this->set_defaults();

Commenting out line 148 "fixes" the trace function and allows these functions to seemingly work properly, however, I am not sure why you would want to call set_defaults after a request is executed enough. Perhaps you are calling execute() multiple times in a row ... but i would think you would still change the function and the parameter or headers that need to change before making the next couple calls?

Test case

$soap = Request::forge('https://api.cvent.com/soap/V200611.asmx?WSDL', 'soap');
$soap->set_function('Login');
$soap->set_option('trace', true);
$soap->set_option('connection_timeout', 45);
$soap->set_params([[
     'AccountNumber' => '123456',
     'UserName' => 'TestAccount',
     'Password' => 'thisCantBeCorrect',
]]);

$soap->execute();
nickhagen pushed a commit to nickhagen/core that referenced this issue Nov 6, 2020
Remove resetting the parameters and options after executing the soap request.
@WanWizard
Copy link
Member

It is indeed to use the same soap object for multiple requests, instead of forging a new one for each request.

If you pass "trace" as one of the options in the forge() request, it is considered a default option for the request, while set_option() is a runtime option, and only active for that request (execute call).

So you need to use

$soap = Request::forge('https://api.cvent.com/soap/V200611.asmx?WSDL', array('driver'=>'soap', 'trace' => true));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants