Jump to content

SoapServer with operation name with dash


Go to solution Solved by requinix,

Recommended Posts

Good afternoon,

I'm very new to php, and have to create a class for SoapServer from a very specific wsdl.  I'm trying to create functions in the class for the operation, but the operation's name has a dash in it.  I unfortunately cannot change the name of this operation.

 

Say the operation's name is "ProvideDocument-b", how do I create a function in a class to handle this?

class MySoapServerClasss {

   function ProvideDocument-b($data) {}

}

How can I create a function in my class to handle this operation?  

 

Any help would be appreciated.

  • Solution

You don't, and whoever created that WSDL was dumb to not consider potential situations like this.

You can, however, use the magic __call method to intercept calls to methods that don't exist, and create a properly-named method to do the work.

class MySoapServerClass {

	public function __call(string $method, array $args) {
		return match ($method) {
			"ProvideDocument-b" => $this->ProvideDocumentB(...$args),
		};
	}

	private function ProvideDocumentB(...) { ... }

}

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.