致命错误:未捕获的 SoapFault 异常:[WSDL] SOAP 错误:解析架构:无法从“http://schemas.xmlsoap.org/soap/encoding/"导入架构 [英] Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing Schema: can't import schema from 'http://schemas.xmlsoap.org/soap/encoding/'

查看:38
本文介绍了致命错误:未捕获的 SoapFault 异常:[WSDL] SOAP 错误:解析架构:无法从“http://schemas.xmlsoap.org/soap/encoding/"导入架构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing Schema: can't import schema from 'http://schemas.xmlsoap.org/soap/encoding/'

首先,我很抱歉地说我把这些问题放在这里会导致 stackoverflow 中有很多相同的问题.不过好像不太适合我.

First, I am sorry to say I put these question here cause so many same question in stackoverflow. But it seems not any fit for me.

我多次使用 Magento SOAP2 API,这个错误并不经常发生.但是今天运行我的脚本时,它总是出现致命错误.

I use Magento SOAP2 API for times, this error not happed often. But it keeps make a fatal error when I run my script today.

我找了一些方法来解决这个问题,比如有些文章告诉我在/app/code/core/Mage/Api/etc/wsdl.xml中更改这段代码

I have looked up for some method to solve this problem, for example, some articles told me to change this code in /app/code/core/Mage/Api/etc/wsdl.xml

<import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemalocation="http://schemas.xmlsoap.org/soap/encoding/">
</import> 

到这里

<!-- 
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="http://schemas.xmlsoap.org/soap/encoding/" />
-->  

我遵循了这个,但它又犯了另一个错误,如下所示,

I followed this, but it make another error like below,

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing Schema: unexpected <import> in schema

然后我不知道出了什么问题,因为这个脚本总是运行得很完美,但今天我什至没有更改任何代码行.我的问题是,1、有什么办法解决吗?2、我可以把这个xmlsoap.org xml文件放到本地主机或我自己的服务器上,这样我的脚本就不会依赖我服务器上的文件.

Then I have no idea what's wrong, cause this script is always running perfectly but today and I even do not change any line of the code. My question is, 1, Any method to solve it? 2, Can I make this xmlsoap.org xml file to localhost or my own server so that my script will not depend on a file out my server.

先谢谢你!

推荐答案

首先,请不要篡改任何 Magento API V2 WSDL 配置文件的默认元素.这是基本规则.

First of all, please never tamper with the default elements of any Magento API V2 WSDL Configuration file. It's a basic rule.

请记住在每个自定义 WSDL 文件的开头写入以下元素,或确保在目标现有模块的 WSDL 文件的开头存在以下元素:-

Please keep in mind to write these following elements at the beginning of each custom WSDL file or make sure that these following elements are present at the beginning of the WSDL file of your target existing module:-

  1. "definition" 元素( - 开始标签)
  2. "types" 元素( - 开始标签)
  3. "schema" 元素( - 开始标记)
  4. "import" 元素( - 单例标签,没有结束标签)
  1. "definition" element (<definitions> - start tag)
  2. "types" element (<types> - start tag)
  3. "schema" element (<schema> - start tag)
  4. "import" element (<import /> - singleton tag, with no end tag)

然后您可以继续为该自定义模块定义 Magento API V2 的复杂数据类型.

Then you can continue with defining the Complex Data Types of the Magento API V2 for that Custom Module.

通过查看一些现有的 Magento API V2 WSDL 文件,您可以很好地了解所有这些概念.

You can very well get the concept of all these by looking into some of the existing Magento API V2 WSDL files.

现在回到你的问题......

Now coming back to your questions...

1.有什么方法可以解决吗?正如我之前所说,请在 WSDL 文件的开头维护上述元素定义.

1. Any method to solve it? As I said before, please maintain the above-mentioned elements definitions at the beginning of your WSDL file.

import"语句应该是:-
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="http://schemas.xmlsoap.org/soap/encoding/"/>
没有结束标签.属性名称也是schemaLocation"&不是schemalocation".请遵循骆驼套管.

The "import" statement should have been:-
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="http://schemas.xmlsoap.org/soap/encoding/" />
with no end tag. Also the attribute name is "schemaLocation" & not "schemalocation". Follow the Camel Casing please.

2.我可以将这个 xmlsoap.org xml 文件制作到本地主机或我自己的服务器上,这样我的脚本就不会依赖于我服务器上的文件吗?

是的,你可以,但你需要知道 &保持两个要点:-

Yes you can, but you need to know & maintain two vital points:-

  1. 两个属性namespace" &根据 W3C 规范,schemaLocation"必须是 URI 类型.因此,您还必须使用 HTTP 协议在本地浏览器中访问这两个属性的本地文件.
  2. 如果您在本地硬盘中维护它,那么您就会忘记一个升级的黄金法则,即 SOAP/1.1 编码文件的架构.这是因为如果(仅当)W3C 在同一 URI 中升级此文件,那么如果提供了通用 URI,您的 Magento 将能够自动获取它;否则,您将需要再次将升级后的文件下载到您的服务器.
  1. Both of the attributes "namespace" & "schemaLocation" must be of type URI, according to the W3C specifications. So your local files for both of these attributes must also be accessible in your local browser, using HTTP protocol.
  2. If you are maintaining it in your local hard disk, then you are forgetting about one golden rule of upgradation, for Schema of the SOAP/1.1 encoding file. This is because if (only if) W3C upgrades this file in this same URI, then your Magento will be able to take it automatically if the general URI is provided; otherwise you will need to download that upgraded file again to your server.

除了这两大点,其他都还好&你可以走了.

Other than these two major points, everything is okay & you are good to go.

尽管如此,我希望我已经回答了您的所有疑问.希望有帮助.

Nevertheless, I hope that I have answered all your queries. Hope it helps.

这篇关于致命错误:未捕获的 SoapFault 异常:[WSDL] SOAP 错误:解析架构:无法从“http://schemas.xmlsoap.org/soap/encoding/"导入架构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆