For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > June 2005 > PEAR SOAP problem invoking remote method









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author PEAR SOAP problem invoking remote method
romaz

2005-06-06, 8:56 am

Hi,

I'm trying to use PEAR SOAP to access a remote Web Service written in
MS.NET. I use it in wsdl mode, so I simply do:

-- code --
$ws = new SOAP_Client('http://my.web.service/WebService.asmx?wsdl', true,
NULL, array('user' => 'myusername', 'pass' => 'mysecretpassword'));
$args = array('firstArg' => 'theFirstArgOfMethod',
'secondArg' => 'theSecondArgOfMethod');

$result = & $ws->call('MyMethod', $args);
-- end --

The SOAP Envelope should be like this:

[...]
<ns4:MyMethod>
<ns4:firstArg>theFirstArgOfMethod</ns4:firstArg>
<ns4:secondArg>theSecondArgOfMethod</ns4:secondArg>
</ns4:MyMethod>
[..]

Actually PEAR SOAP seems to create this code:

[..]
<ns4:MyMethod>
<firstArg>theFirstArgOfMethod</firstArg>
<secondArg>theSecondArgOfMethod</secondArg>
</ns4:MyMethod>
[..]

Obviously the second call doesn't work, because the server doesn't recognize
the method parameters and simply returns empty results.

I tried to make a simple patch to Client.php

444a445,446
> // set the namespace for parameters of method
> if (isset($opData['input']['namespace'])) $xmlns =

$this->_wsdl-> namespaces[$opData['input']['namespace']
];
449c451
< $xmlns = '';
---
> //$xmlns = '';

477c479,480
< if ($xmlns) $pqname = '{'.$xmlns.'}'.$name;
---
>
> if ($xmlns) $pqname = '{'.$xmlns.'}'.$name;

478a482
>


I've found that changing the Client.php code in this way seems to work, but
I'm not so deep in wsdl so please help me find out if there is something
wrong on my code.
Basically the same thing works fine using native PHP5 SOAP.

The patch applies to PEAR SOAP 0.8.1 (I've the same problem also on the last
version 0.9.1 though).

Thanks in advice for replies.
Bye,
Davide Romanini
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com