当我试图从部署到WebSphere 7.0的类调用(help,如果它有帮助的话)时,我会得到错误。
WSDL的片段是:
<definitions targetNamespace="http://schemas.hp.com/SM/7"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.xmlsoap.org/wsdl/ http://schemas.xmlsoap.org/wsdl/">我认为XML解析器总是知道xmlns:xsi,所以我不理解这个错误。为什么这样的错误发生在WebSphere上,而在使用com.ibm.ws.webservices.thinclient在JUnit中启动代码时却不发生。
适当的StackTrace片段是:
原因如下: javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: Problem parsing org.xml.sax.SAXParseException: das Pr fix "xsi“für Attribut "xsi:schemaLocation",Das einem Elementtyp”einem“zugeordnet ist,ist nicht gebunden。在com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(WSDLReaderImpl.java:2255) at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2330) at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2296) at org.apache.axis2.jaxws.util.WSDL4JWrapper$13.run(WSDL4JWrapper.java:745) at org.apache.axis2.java.security.AccessController.doPrivileged(AccessController.java:132) at org.apache.axis2。jaxws.util.WSDL4JWrapper.loadDefinition(WSDL4JWrapper.java:742) . 51引起的: org.xml.sax.SAXParseException: Das Pr fix "xsi“für Attribut "xsi:schemaLocation",das einem Elementtyp“定义”(在org.apache.xerces.parsers.DOMParser.parse(Unknown来源)在org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown来源)在com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(WSDLReaderImpl.java:2245) )
发布于 2013-05-22 11:30:43
错误可能不是来自于WSDL,而是来自于从WebService发送回来的XML。您可能想看一下到底返回了什么XML,并检查xsi名称空间在文档中是否正确绑定。
除此之外,每个解析器实例(服务器与JUnit)的配置可能略有不同,这导致一个解析器拒绝未绑定的命名空间,而另一个解析器忽略了所解析的XML中的“故障”。(例如,apache解析器参见setNamespaces() )。
发布于 2013-05-22 11:31:07
错误的意思就是: xsi前缀没有名称空间声明。
XML解析器对此命名空间的内置知识并不是真的。需要声明它才能使文档命名空间-格式良好。
https://stackoverflow.com/questions/16690404
复制相似问题