在nusoap中传递base64Binary类型

发布于 2024-10-03 02:53:34 字数 1694 浏览 2 评论 0原文

我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

灯角 2024-10-10 02:53:34

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

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

C.

The php base64_encode functionality returns a string. So nusoap is reading the type correctly. try referencing the content without encoding it first.

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

C.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文