Re: Why is response type NOT as specified in WSDL?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Justin,
the class certainly is defined (in a separate file that I require_once
at the beginning of the client. As this is a development machine, I
have cache configured to NONE.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if (!class_exists("InsertIDResponse")) {
	/**
	 * InsertIDResponse
	 */
	class InsertIDResponse {
		/**
		 * @access public
		 * @var integer
		 */
		public $out;
		
		public function InsertIDResponse ($code)
		{
			$this->out = $code;
		}
	}
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Richard, here is the entire SoapClient class. I adapted a tutorial I
found online.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if (!class_exists("TestClient")) {
	class TestClient extends SoapClient {
	/**
	 * Default class map for wsdl=>php
	 * @access private
	 * @var array
	 */
	private static $classes = array(
		"InsertIDResponse" => "InsertIDResponse",
		"Person" => "Person",
	);

	/**
	 * Constructor using wsdl location and options array
	 * @param string $wsdl WSDL location for this service
	 * @param array $options Options for the SoapClient
	 */
	public function __construct ($wsdl="http://localhost/TestSOAP.wsdl";) {
		parent::__construct($wsdl, array ('classmap' => $classes, 'trace' => 1));
	}

	public function _checkArguments($arguments, $validParameters) {
		$variables = "";
		foreach ($arguments as $arg) {
		    $type = gettype($arg);
		
		    if ($type == "object") {
		        $type = get_class($arg);
		    }
		    $variables .= "(".$type.")";
		}
		if (!in_array($variables, $validParameters)) {
		    throw new Exception("Invalid parameter types:
".str_replace(")(", ", ", $variables));
		}
		return true;
	}

	public function InsertID($mixed = null) {
		$validParameters = array(
			"(Person)",
		);

		$args = func_get_args();
		$this->_checkArguments($args, $validParameters);

		$result = $this->__soapCall("InsertID", $args);

		return $result;
	}
}}

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I hope this isn't too bothersome.
Shmuel-Aharon

-- 
You're just jealous because the voices only talk to me.
Shmuel A. Kam
Shmuel@Kam-motion.com

-- 
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux