RE: SOAP (SOAP_Server/SOAP_Client) and DIME

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

 



After some more digging, and a lot more error_log()ing, here's what I've
found:

In SOAP_Client, when you specify 
	'style' => 'document'
in the options, the client assumes that you have already constructed the
$params array exactly as you want it passed to the server.  Therefore, it
does NOT wrap the parameters in the method name.  This is why my outgoing
message had no method name element.

In fact, this will happen whenever you specify 'style' and set it to
*anything* other than 'rpc'.


In order to force the SOAP_Client to wrap the parameters (as it does in the
rpc style), you must pass an additional option like this:
        $options = array(
        			'namespace' => $this->_namespace,
        			'soapaction' => '',
        			'style' => 'document',
        			'use' => 'literal',
        			'attachments' => 'DIME',
        			'parameters' => true
        			);
this extra 'parameters' key tells the SOAP_Client code that you want the
parameters in the $params array to be wrapped in the same way they would be
had you specified 'style'=>'rpc'.

The relevant code that handles this is SOAP_Client::__generate method.
(Specifically, it is the code after this line:
	if (!isset($this->__options['style']) || $this->__options['style']
== 'rpc') {
)

hope this helps.  I'll look into adding some docs for this in the published
comments.

dave.

-----Original Message-----
From: Viner, David [mailto:dviner@yahoo-inc.com]
Sent: Friday, March 12, 2004 12:13 PM
To: soap@lists.php.net
Subject: RE:  SOAP (SOAP_Server/SOAP_Client) and DIME


after digging into the SOAP_Server code, here's what I've found:

I can easily send DIME messages like Brodie suggests.  My client code looks
like:

        $v = new SOAP_Attachment('img',$mime,$imageFileName);
        $params = array($v,$path,$this->_property,$sig);
        $options = array(
        			'namespace' => $this->_namespace,
        			'soapaction' => '',
        			'style' => 'document',
        			'use' => 'literal',
        			'attachments' => 'DIME'
        			);
        $res = $this->_client->call('addImage',$params,$options);

The information going out on the wire looks like:

[BINARY DIME HEADER]
<?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>

<img href="cid:86459d860f164088cdf1b239be7a9874"/>
<item>/i/us/he/b/hemast_3.gif</item>
<item>mie</item>
<item>602dfbd4092c4e7bfd819b8481a097b0</item>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
[BINARY DIME ATTACHMENT]

My SOAP_Server dispatch map looks like:
        $inargs = array('img' => 'string',
                        'url' => 'string',
                        'property' => 'string',
                        'sig' => 'string'
                        );
        $outargs = array('out' => 'boolean');
        $map['addImage'] = array('in' => $inargs, 'out' => $outargs);

The problem comes in the SOAP/Server.php class' parseRequest method.
Specifically, this check fails:

        if (!$this->methodname ||
!$this->validateMethod($this->methodname,$this->method_namespace)) {
            $this->_raiseSoapFault("method
'{{$this->method_namespace}}$this->methodname' not defined in
service",'','','Server');
            return NULL;
        }

the validateMethod function returns false.  In my case, the values passed
are:
	$this->methodname = 'img'
	$this->method_namespace =
'http://schemas.xmlsoap.org/soap/envelope/'

It seems as tho the decoding of the DIME attachment by the server has
changed the target function name from 'addImage' to 'img'.  

The problem may in fact lie in the SOAP_Client code or in the Net_DIME code.
It appears that the original client message being sent by SOAP_Client is
simply inaccurate.  The XML message is missing the element which specifies
the method to invoke.

Has anyone else seen this?

dave
-----Original Message-----
From: Viner, David [mailto:dviner@yahoo-inc.com]
Sent: Wednesday, March 03, 2004 11:37 AM
To: soap@lists.php.net
Subject: RE:  SOAP (SOAP_Server/SOAP_Client) and DIME


cool... thanks.

any ideas on how to write the SOAP server to accept/require a DIME
attachment?  I have a feeling this will be specified in a __dispatch_map
parameter, but I can't seem to find which one.

thanks
dave


-----Original Message-----
From: Brodie Thiesfield [mailto:brodie@crosslanguage.co.jp]
Sent: Tuesday, March 02, 2004 5:34 PM
To: soap@lists.php.net
Subject: Re:  SOAP (SOAP_Server/SOAP_Client) and DIME


Viner, David wrote:
> What's the standard way of sending and receiving DIME attachments using
> PEAR's SOAP_Server and SOAP_Client?

The way that I do it (PEAR SOAP as client, gSoap as server) is:

$oParams = new SOAP_Value(
	'{'.CR_NAMESPACE_SCHEMA.'}TranslateDocument',
	'TranslateDocument',
	array(
		'options' => $a_nOptions,
		new SOAP_Attachment(
			'originalDoc',
			'application/octet-stream',
			'',
			$a_strOriginal
			)
		)
	);
$this->call( 'TranslateDocument', $oParams, $this->m_rgSoapParams );

Where m_rgSoapParams are:

     var $m_rgSoapParams =
             array(
                 'namespace'     => CR_NAMESPACE_SCHEMA,
                 'soapaction'    => '',
                 'style'         => 'document',
                 'use'           => 'literal',
                 'attachments'   => 'DIME'
                 );

Cheers
Brodie

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

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

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

-- 
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