简体   繁体   English

SOAPUI SOAP模拟错误:前缀不能以XML开头:XMLSchema-instance

[英]SOAPUI SOAP Mocking error : Prefix can't begin with XML: XMLSchema-instance

I'm trying to mock some scenarios for Vmware vSphere Vcenter SOAP API (VMware-vSphereSDK-6.5.0 downloaded here: https://my.vmware.com/web/vmware/details?productId=614&downloadGroup=VS-MGMT-SDK65 ). 我正在尝试模拟Vmware vSphere Vcenter SOAP API的某些方案(VMware-vSphereSDK-6.5.0此处下载: https ://my.vmware.com/web/vmware/details?productId=614 & downloadGroup = VS-MGMT-SDK65 )。

I could mock several API operations until I ran into a problem as the WSDL refers to a namespace that generates an error apparently due to the following statement: 我可以模拟几个API操作,直到遇到问题为止,因为WSDL引用的命名空间显然由于以下语句而产生错误:

<selectSet XMLSchema-instance:type="TraversalSpec" xmlns:XMLSchema-instance="http://www.w3.org/2001/XMLSchema-instance">

Here is the exception thrown 这是抛出的异常

ERROR:com.eviware.soapui.impl.wsdl.mock.DispatchException:   org.apache.xmlbeans.XmlException: error: Prefix can't begin with XML: XMLSchema-instance
   com.eviware.soapui.impl.wsdl.mock.DispatchException: org.apache.xmlbeans.XmlException: error: Prefix can't begin with XML: XMLSchema-instance
at com.eviware.soapui.impl.wsdl.mock.WsdlMockDispatcher.dispatchPostRequest(WsdlMockDispatcher.java:242)
at com.eviware.soapui.impl.wsdl.mock.WsdlMockDispatcher.dispatchRequest(WsdlMockDispatcher.java:114)
at com.eviware.soapui.impl.wsdl.mock.WsdlMockRunner.dispatchRequest(WsdlMockRunner.java:144)
at com.eviware.soapui.monitor.JettyMockEngine$ServerHandler.handle(JettyMockEngine.java:604)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
at org.mortbay.jetty.security.SslSocketConnector$SslConnection.run(SslSocketConnector.java:713)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.xmlbeans.XmlException: error: Prefix can't begin with XML: XMLSchema-instance
at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3474)
at org.apache.xmlbeans.impl.store.Locale.parse(Locale.java:712)
at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:696)
at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:683)
at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:208)
at org.apache.xmlbeans.XmlObject$Factory.parse(XmlObject.java:633)
at com.eviware.soapui.support.xml.XmlUtils.createXmlObject(XmlUtils.java:183)
at com.eviware.soapui.impl.support.AbstractMockRequest.getRequestXmlObject(AbstractMockRequest.java:297)
at com.eviware.soapui.impl.wsdl.mock.WsdlMockDispatcher.dispatchPostRequest(WsdlMockDispatcher.java:193)
... 16 more

Here is the full body of the request for the operation of API that fails on SOAP UI (and obviously work on vSphere): 这是对API操作的完整请求,该请求在SOAP UI上失败(显然在vSphere上有效):

'<?xml version="1.0" encoding="UTF-8"?>
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Body>
    <RetrieveProperties xmlns="urn:vim25">
        <_this type="PropertyCollector">propertyCollector</_this>
        <specSet>
            <propSet>
                <type>Folder</type>
                <pathSet>name</pathSet>
                <pathSet>childType</pathSet>
            </propSet>
            <propSet>
                <type>Datacenter</type>
                <pathSet>name</pathSet>
            </propSet>
            <propSet>
                <type>VirtualMachine</type>
                <pathSet>name</pathSet>
            </propSet>
            <propSet>
                <type>Network</type>
                <pathSet>name</pathSet>
            </propSet>
            <propSet>
                <type>ComputeResource</type>
                <pathSet>name</pathSet>
                <pathSet>resourcePool</pathSet>
            </propSet>
            <propSet>
                <type>ClusterComputeResource</type>
                <pathSet>name</pathSet>
                <pathSet>resourcePool</pathSet>
            </propSet>
            <propSet>
                <type>Datastore</type>
                <pathSet>name</pathSet>
            </propSet>
            <objectSet>
                <obj type="Folder">group-d1</obj>
                <skip>true</skip>
                <selectSet XMLSchema-instance:type="TraversalSpec" xmlns:XMLSchema-instance="http://www.w3.org/2001/XMLSchema-instance">
                    <type>Folder</type>
                    <path>childEntity</path>
                    <skip>false</skip>
                </selectSet>
            </objectSet>
        </specSet>
    </RetrieveProperties>
</Body>

My view is that this is an interpretation of the XML specs related to checking xml namespace correct syntax which was discussed and apparently fixed in that bug report (in a jdom context): https://github.com/hunterhacker/jdom/issues/126 我的观点是,这是对与检查xml命名空间正确语法有关的XML规范的解释,该错误报告(在jdom上下文中)对此进行了讨论并进行了修复: https : //github.com/hunterhacker/jdom/issues/ 126

Indeed, in their api, vmware folks refer to a namespace starting with XML (XMLSchema-Instance) and maybe should not (I'm not enough an XML expert to judge) but the specs https://www.w3.org/TR/REC-xml-names/#xmlReserved seems to cleary say that this MUST NOT be treated as an error. 确实,在他们的api中,vmware员工指的是以XML(XMLSchema-Instance)开头的名称空间,也许不应该(我不足以判断XML专家),而是使用规范https://www.w3.org/TR / REC-xml-names /#xmlReserved似乎很清楚地说这绝不能视为错误。

Any idea on how to bypass (or fix) this issue is welcome. 任何关于如何绕过(或修复)此问题的想法都欢迎。 Thx a lot. 多谢。

The first edition of the XML Namespaces recommendation simply said that prefixes starting "xml" were reserved for use in future specifications; XML命名空间建议的第一版只是说,以“ xml”开头的前缀被保留以供将来使用; it didn't say what parsers should do if such prefixes were encountered. 它没有说如果遇到这样的前缀,解析器应该怎么做。

Some products interpreted the rule by rejecting documents containing such a prefix. 一些产品通过拒绝包含此类前缀的文档来解释该规则。 That would confound the intent of reserving them because if any new standard adopted such a name, documents using that name would not work with old software. 这会混淆保留它们的意图,因为如果有任何新标准采用这样的名称,那么使用该名称的文档将无法与旧软件一起使用。 So in the second edition of XML Namespaces, it was clarified what the rule meant: applications should not use such names, but parsers should not reject them. 因此,在第二版XML命名空间中,阐明了规则的含义:应用程序不应使用此类名称,而解析器不应拒绝它们。

But of course that was too late; 但是,当然为时已晚。 software was already out there with a different interpretation of the rules, and some of it has not been updated. 该软件已经有了对规则的不同解释,并且其中一些尚未更新。

How to solve the problem? 如何解决问题? You either have to change the document, or change the software. 您必须更改文档或更改软件。 I would try putting the document through an XSLT transformation that changes the prefix. 我会尝试通过更改前缀的XSLT转换来放置文档。

暂无
暂无

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

相关问题 我不能在XML模式中包含属性。 (使用http://www.w3.org/2001/XMLSchema-instance) - I can't include attribute in my XML Schema. (http://www.w3.org/2001/XMLSchema-instance used) 没有schemaLocation的XMLSchema和XMLSchema实例名称空间 - XMLSchema and XMLSchema-instance namespaces without schemaLocation xmlns:xsi =“http://www.w3.org/2001/XMLSchema-instance”是XML中的一个特例吗? - Is xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” a special case in XML? 错误:属性声明的非法命名空间:http://www.w3.org/2001/XMLSchema-instance - Error: Illegal namespace for attribute declaration: http://www.w3.org/2001/XMLSchema-instance 是否可以在父标记以及子标记中写入XMLSchema-instance? - Is it possible to write XMLSchema-instance in parent tag as well as child tag? 删除 p2:type="&lt;<type> &gt;" xmlns:p2="http://www.w3.org/2001/XMLSchema-instance" 来自 xml</type> - Remove p2:type="<<type>>" xmlns:p2="http://www.w3.org/2001/XMLSchema-instance" from xml 我如何使用JAXB抑制xsi:nil =“ true” xmlns:xsi =“ http://www.w3.org/2001/XMLSchema-instance” - How can i suppress xsi:nil=“true” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” using JAXB 从名称空间&#39;http://www.w3.org/2001/XMLSchema-instance&#39;期望元素&#39;CustomerLeads&#39; - Expecting element 'CustomerLeads' from namespace 'http://www.w3.org/2001/XMLSchema-instance' 使用 DataContractSerializer 时删除 xmlns:i=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; - remove xmlns:i=“http://www.w3.org/2001/XMLSchema-instance” when using DataContractSerializer 避免在.Net DataContractSerializer中使用“http://www.w3.org/2001/XMLSchema-instance”命名空间 - Avoiding using the “http://www.w3.org/2001/XMLSchema-instance” namespace with .Net DataContractSerializer
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM