从WSDL生成javacode

时间:2016-02-20 08:09:16

标签: java soap wsdl wsdl2java wsimport

我想从这个wsdl生成java代码: http://www.cbr.ru/CreditInfoWebServ/CreditOrgInfo.asmx?WSDL

我使用命令:

wsimport -d C:\test http://www.cbr.ru/CreditInfoWebServ/CreditOrgInfo.asmx?WSDL -Xnocompile

由于许多此类错误

  

[错误]未定义的元素声明' s?schema'     http://www.cbr.ru/CreditInfoWebServ/CreditOrgInfo.asmx?WSDL

的第55行

更新

我试过undefined element declaration 'xs:schema' 使用命令>>

  

wsimport -b http://www.w3.org/2001/XMLSchema.xsd -b customization.xjb CreditOrgInfo.wsdl

并收到错误:

  

org.xml.sax.SAXParseException; systemId:w3.org/2001/XMLSchema.xsd; lineNumber:67; columnNumber:11;外部DTD:无法读取外部DTD' XMLSchema.dtd',因为' http'由于accessExternalDTD属性设置的限制,不允许访问。

1 个答案:

答案 0 :(得分:0)

无论如何,我能够用你的命令生成代码。我的输出是提供的。文件在文件系统中生成。

> wsimport   -b http://www.w3.org/2001/XMLSchema.xsd -b customization.xjb http://www.cbr.ru/CreditInfoWebServ/CreditOrgInfo.asmx?WSDL -Xnocompile
parsing WSDL...

[WARNING] src-resolve.4.2: Error resolving component 's:schema'. It was detected that 's:schema' is in namespace 'http://www.w3.org/2001/XMLSchema', but compone
nts from this namespace are not referenceable from schema document 'http://www.cbr.ru/CreditInfoWebServ/CreditOrgInfo.asmx?WSDL#types?schema1'. If this is the i
ncorrect namespace, perhaps the prefix of 's:schema' needs to be changed. If this is the correct namespace, then an appropriate 'import' tag should be added to
'http://www.cbr.ru/CreditInfoWebServ/CreditOrgInfo.asmx?WSDL#types?schema1'.
  line 55 of http://www.cbr.ru/CreditInfoWebServ/CreditOrgInfo.asmx?WSDL#types?schema1

[WARNING] Ignoring SOAP port "CreditOrgInfoSoap12": it uses non-standard SOAP 1.2 binding.
You must specify the "-extension" option to use this binding.
  line 2449 of http://www.cbr.ru/CreditInfoWebServ/CreditOrgInfo.asmx?WSDL

generating code...