The concept of the module, integrated with the rules and workflow is really great for our purpose !
Problem is that the providers web services' wsdl refers to an incorrect http endpoint (soap). As we couldn't find any endpoint url's in the database to change, we are considering entering a search - replace statement in the module to amend the incorrect part of the url. What would be the best strategy for resolving this issue?

Thank for the great work and hopefully your reaction to this :-)

Leo

Comments

dman’s picture

Yeah, I had a client that did that to us also. Due to their service being inside their intranet and then exposed to us via some routing, what the thing thought it was was different from what we had to call it.
Can't remember what I did about it at the time. Initially I copied the WSDL(s) locally, then replaced the URLs in them there I think. Then eventually we came up with another work-around.

This sounds like a case for a hook_wsclient_service_alter() in the module here though... could be done

LeoVe’s picture

dman,

Thanks for your quick feedback, great! And... always good to see one is not the only one ... :-)
I had a look in the file wsclient.api.php and couldn't find hook_wsclient_service_alter() to implement the replace? Could you please tell me where to find it?

dman’s picture

This is a *case* for something like that to be added. It does not yet exist. I describe it as what we need in the code, so that you can do what you need...

georgir’s picture

An alter could make sense for things that are dynamic and depend on some runtime value, but in this particular case I think you can just fix the original definition of the service (at least if it's defined in code and not through the UI, otherwise try export-change-import or export it to a feature and change that). Haven't tested, but from reading the docs, seems like setting $service->settings['options']['location'] should do it.

dman’s picture

Real-world-case:
* We as outsiders are given a tunnel into someones system http://backdoor.companyname:8086/webservice?wsdl
* We successfully retrieve the wsdl, containing 15 service definitions, each of which claim their endpoint is http://companyname.intranet/webservice/process etc
* These changes are accurately described by their wsdl, and we have no need to define anything in code.

* Need to be able to rewrite those endpoints back to resemble our tunnel address before we can use them. After that they work fine.
* ALSO need to be able to safely refresh the WSDL at any time as the endpoint changes its definitions over time etc.

The last reason is why I'm not keen on exporting, editing, and re-importing code to replace that is currently just a matter of pasting in one endpoint URL and hitting 'refresh'

georgir’s picture

rewrite those endpoints

That's exactly what the location option to SoapClient does, I think.
The rest of the WSDL will still get used and updated according to your WSDL cache options.

dman’s picture

Status: Active » Closed (fixed)

Closing this as fixed with #2428131: Arguments and response alterers before invoking endpoint

An example on how to change the URL manually can be seen at
https://www.drupal.org/node/2428131#comment-9651851