Re: [SOAP] WSDL with attributes?

[email protected] (Andrew Ettinger)
Newsgroups php.soap
Message-ID <[email protected]>
Thanks for the response! I'm not sure if that's what I need as that  
seems mostly for callback and I think I have a data structure problem  
in the PHP SOAP extension itself (although it's most likely my error =).

To elaborate a little further, I need to make a call to the sever  
like the following:

<soap-env:body>
	<myDatatype attr="myAttrValue">
		<otherContent>
			<value>myValue</value>
		</otherContent>
	</myDataType>
</soap-env:body>

I've redone wsdl2php to provide me with the classes directly from the  
WSDL such that it will parse a WSDL so that I can call:

<?
	$service = new SOAPSomeServiceDefinedInAWsdl();
	$myDataType = new SOAPMyDataType();
	$myDataType->otherContent = new SOAPOtherContent();
	$myDataType->otherContent->myValue = "myValue";
	$service->callSomeMethodOnTheirSoapServer($myDataType);
?>

But this only produces:

<soap-env:body>
	<myDatatype>
		<otherContent>
			<value>myValue</value>
		</otherContent>
	</myDataType>
</soap-env:body>

MyDataType is missing it's attribute myAttr! The wsdl2php PHP  
generator does keep track of attributes defined in the WSDL now  
(well, in my version at least), so if there's a way to make the call  
properly using those attributes I should be able to do it. I can  
tweak it so that it sets defaults on attributes if they are  
available, but I'm not sure if that's always going to be reliable.

I assume I'm missing something like call_user_func_array, but I don't  
see how that helps exactly... It seems like it's a data structure  
problem inherent in the call... ?

Thanks for the help Claus =)

~ Andrew

On May 1, 2007, at 6:27 PM, Claus Jørgensen wrote:
Hey

You have to use call_user_func_array if you wish to call a method  
with a dynamical array of parameters.

$service->method() is threated like normal objects in PHP.

2007/5/2, Andrew Ettinger <[email protected]>:
How can I set up attributes? I know I can do:

$result = $service->method(array("param1"=>"value",
"param2"=>"value2"));

But this doesn't set up attributes. Does this have to be done in an
override of the __doRequest method call or something?







-- 
Sincerely
   Claus Jørgensen, Denmark
   Mobil: +45 30 13 27 32
    http://www.dragons-lair.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.