繁体   English   中英

在nusoap中传递base64Binary类型

[英]Passing base64Binary type in nusoap

我在PHP中使用NuSOAP,并使用Java内置的Web服务。

调用NuSOAP时,我传递以下参数:

$args[]=array('name'=>'content', 'value'=>base64_encode($content), 'type'=>'Base64Binary');

但是,在检查SOAPXML时,我看到以下内容:

<content xsi:type="xsd:string">PD94bWwgdmVywIiBlbmNvZ....cmQ+DQoNCg==</content>
                  Note:^^^^^^

在nusoap.php中,我看到以下内容:

/*
$Id: nusoap.php,v 1.123 2010/04/26 20:15:08 snichol Exp $

NuSOAP - Web Services Toolkit for PHP
...
*/
...
    /**
    * XML Schema types in an array of uri => (array of xml type => php type)
    * is this legacy yet?
    * no, this is used by the nusoap_xmlschema class to verify type => namespace mappings.
    * @var      array
    * @access   public
    */
    var $typemap = array(
    'http://www.w3.org/2001/XMLSchema' => array(
        'string'=>'string','boolean'=>'boolean',...,'base64Binary'=>'string', ...),
    'http://www.w3.org/2000/10/XMLSchema' => array(...,'base64Binary'=>'string','base64'=>'string','ur-type'=>'array'),
    'http://www.w3.org/1999/XMLSchema' => array(...,'base64Binary'=>'string','base64'=>'string','ur-type'=>'array'),
    'http://soapinterop.org/xsd' => array('SOAPStruct'=>'struct'),
    'http://schemas.xmlsoap.org/soap/encoding/' => array('base64'=>'string','array'=>'array','Array'=>'array'),
    'http://xml.apache.org/xml-soap' => array('Map')
    );

请注意,在所有情况下,

'base64Binary'=>'string'

这可能就是为什么我遇到这个错误! 为什么会发生这种类型的转换,对我来说修改该文件并执行以下操作是安全的:

'base64Binary'=>'base64Binary'

php base64_encode功能返回一个字符串。 因此,nusoap正在正确读取类型。 尝试引用内容而不先对其进行编码。

$args[]=array('name'=>'content', 'value'=>$content, 'type'=>'Base64Binary');

C。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM