日期:2014-05-20  浏览次数:20798 次

org.xml.sax.SAXException: The processing instruction target matching "[xX][mM][lL]" is not allowed.
用axis做客户端调用xfire服务端web service服务是出现问题
用axis包中的wsdl2java 命令:org.apache.axis.wsdl.WSDL2Java -u d:/HelloService.wsdl 生成客户端java文件时出现如下问题

C:\Documents and Settings\Administrator.143FE7422C09420>java org.apache.axis.wsd
l.WSDL2Java -u d:/HelloService.wsdl
org.xml.sax.SAXException: Fatal Error: URI=file:///d:/HelloService.wsdl Line=1:
The processing instruction target matching "[xX][mM][lL]" is not allowed.
  at org.apache.axis.utils.XMLUtils$ParserErrorHandler.fatalError(XMLUtils
.java:723)
  at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalErro
r(Unknown Source)
  at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(
Unknown Source)
  at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(U
nknown Source)
  at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanPIData(Unknown
 Source)
  at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
l.scanPIData(Unknown Source)
  at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanPI(Unknown Sou
rce)
  at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$Prolog
Driver.next(Unknown Source)
  at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(U
nknown Source)
  at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next
(Unknown Source)
  at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
l.scanDocument(Unknown Source)
  at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(U
nknown Source)
  at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(U
nknown Source)
  at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown So
urce)
  at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown So
urce)
  at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unk
nown Source)
  at org.apache.axis.utils.XMLUtils.newDocument(XMLUtils.java:369)
  at org.apache.axis.utils.XMLUtils.newDocument(XMLUtils.java:420)
  at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.jav
a:482)
  at org.apache.axis.wsdl.gen.Parser$WSDLRunnable.run(Parser.java:361)
  at java.lang.Thread.run(Unknown Source)
请各位指教!

------解决方案--------------------
检查你的WSDL.
是不是XML声明前面有什么注释或者多余的空格.