Skip to content

Conversation

@floriansimon1
Copy link

Allows you to receive the raw Response object instead of just the response as parsed by SoapClient.

…turn Response object instead of responses parsed by the SoapClient class.
@floriansimon1 floriansimon1 changed the title Clients can now be put in 'raw responses' mode. In this mode, they re… Clients can now be put in 'raw responses' mode. Sep 4, 2015
@clue
Copy link
Owner

clue commented Sep 4, 2015

Thanks for the suggestion! I'm not sure I understand the motivation for this feature though :) Can you give some use-cases on how you're planning to use this?

Thanks!

@floriansimon1
Copy link
Author

The API I'm using sets session IDs in cookies which I have to retrieve in order to rewrite the webservices URL as such :
http://service.url --> http://service.url;sessionid=$MY_SESSION_ID

As far as I know, there is no way to retrieve those cookies from the Client yet.

Florian Simon added 3 commits September 4, 2015 16:07
@clue
Copy link
Owner

clue commented Sep 4, 2015

session IDs in cookies which I have to retrieve in order to rewrite the webservices URL

This sounds like an interesting API you're having to deal with :)

I agree that this should be supported somehow. While I'm not a big fan of the initial implementation approach, I do appreciate the discussion! 👍

Personally, I feel that this approach violates SOLID design principles and separation of concerns in particular.

Cookies should be accessed on the HTTP level, not on the SOAP level.
The underlying HTTP library supports sending and receiving cookies.
However, it does currently not support remembering cookies: clue/reactphp-buzz#5. Would that solve the issue you're experiencing?

Otherwise, we may want to look into providing a way to somehow hook into the HTTP lib to get access to the last response object.

I'm curious to see what you think 👍

@floriansimon1
Copy link
Author

I agree about SOLID violation. Unfortunately, remembering cookies won't work in my case because the API I'm using works with several distinct webservices. The login service gives me a session ID that I need to add as a parameter in the URLs of other services.

Fortunately, I have found another way of dealing with that than using cookies. The session ID is also set in an attribute in the XML response. With PHP's lacking SOAPClient, you cannot access attributes, unless you get the raw XML response that you wrap yourself in a SimpleXMLElement.

What I'm about to do now is replace the behavior of this feature. Instead of returning a Response object, it's gonna return the XML as a string, which makes more sense and doesn't break SR principles anymore, I think.

What do you think ?

@floriansimon1
Copy link
Author

Can you please have a look at the failing tests. It says that FunctionalTest::waitForPromise is undefined, and I don't really understand why :/

@clue
Copy link
Owner

clue commented Mar 15, 2016

Personally, I feel that this approach violates SOLID design principles and separation of concerns in particular.

I'm sorry for having to disappoint here, but I still see this as a major issue 👎

I'm currently looking into clue/reactphp-buzz#16 which will make accessing the request and response objects much simpler. Once that one is resolved, you can probably inject a custom Browser instance which you can then use to access the last request / response and modify as required.

I hope this helps! 👍

@clue clue closed this Mar 15, 2016
@clue clue mentioned this pull request Nov 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants