SOAP and PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
hfilter
Forum Newbie
Posts: 1
Joined: Thu Oct 05, 2006 1:47 am

SOAP and PHP

Post by hfilter »

Hi there

I would appreciate it if anybody could help me with this problem: I want to connect to GroupWise through SOAP in PHP. I am using the pear classes and the GroupWise wsdl file to do this. My problem is that the soap request that is generated by PEAR:SOAP is not right.

I'm using PHP4.3.11 and PEAR::SOAP-0.9.4.

Here is the PHP code that I use:

Code: Select all

$wsdl = new SOAP_WSDL('soap/gwschemas/groupwise.wsdl');
$client = $wsdl->getProxy();

$auth   = array(
  'username' => 'test',
  'password' => 'pwd'
);

$params = array('auth' => $auth);
$reslut = $client->loginRequest($params);//loginRequest is a GroupWise SOAP function
The request that is send to the SOAP server by this program looks like this:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
>
<SOAP-ENV:Body>
<loginRequest>
	<auth>
		<username>test</username>
		<password>pwd</password>
	</auth>
</loginRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
It should actually look like this:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
 xmlns:types="http://schemas.novell.com/2003/10/NCSP/types.xsd"
 >
<SOAP-ENV:Body>
<loginRequest>
	<types:auth xsi:type="types:PlainText">
		<username>test</username>
		<password>pwd</password>
	</types:auth>
</loginRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
How can I add this extra namespace and type to the soap request? Must this actually be done in the wsdl file or would it be possible to remedy the problem with some PHP/SOAP functions?

Thank you
Heinrich
Post Reply