致命错误:未捕获的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/'

查看:658
本文介绍了致命错误:未捕获的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文件制作到localhost还是我自己的服务器上,以便我的脚本不会依赖于我服务器上的文件.

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"元素(<definitions>-起始标签)
  2. "types"元素(<types>-开始标记)
  3. "schema"元素(<schema>-开始标记)
  4. "import"元素(<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文件制作为localhost或我自己的服务器,以便我的脚本不依赖于我服务器上的文件吗?

是的,但是您需要了解&保持两个要点:-

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天全站免登陆