在nusoap中传递base64Binary类型
我在 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'
I am using NuSOAP in PHP and using a web service built in Java.
When calling NuSOAP, I pass this argument:
$args[]=array('name'=>'content', 'value'=>base64_encode($content), 'type'=>'Base64Binary');
However, when examining the SOAPXML, I see the following:
<content xsi:type="xsd:string">PD94bWwgdmVywIiBlbmNvZ....cmQ+DQoNCg==</content>
Note:^^^^^^
In nusoap.php, I see the following:
/*
$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')
);
Note that in all instances,
'base64Binary'=>'string'
Which is probably why I'm facing this error! Why is this conversion of type taking place and is it safe for me to modify this file and do:
'base64Binary'=>'base64Binary'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
php base64_encode 功能返回一个字符串。所以 nusoap 正在正确读取类型。尝试先引用内容而不对其进行编码。
C.
The php base64_encode functionality returns a string. So nusoap is reading the type correctly. try referencing the content without encoding it first.
C.