Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/357.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 使用Jax生成代理web服务客户端时出错_Java_Web Services_Jax Ws - Fatal编程技术网

Java 使用Jax生成代理web服务客户端时出错

Java 使用Jax生成代理web服务客户端时出错,java,web-services,jax-ws,Java,Web Services,Jax Ws,我想知道我是否能在以下问题上得到一些帮助 我尝试使用jax运行以下命令以生成web服务客户端代理: wsimport http://www.holidaywebservice.com/Holidays/HolidayService.asmx?WSDL 但我得到了以下错误: Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\A

我想知道我是否能在以下问题上得到一些帮助

我尝试使用jax运行以下命令以生成web服务客户端代理:

wsimport http://www.holidaywebservice.com/Holidays/HolidayService.asmx?WSDL
但我得到了以下错误:

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\Asher>wsimport http://www.holidaywebservice.com/Holidays/HolidayService.asmx?WSDL
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 components from this namespace are not referenceable from schema document 'http://www.h
olidaywebservice.com/Holidays/HolidayService.asmx?WSDL#types?schema1'. If this is the incorrect namespace, perhaps the p
refix of 's:schema' needs to be changed. If this is the correct namespace, then an appropriate 'import' tag should be ad
ded to 'http://www.holidaywebservice.com/Holidays/HolidayService.asmx?WSDL#types?schema1'.
  line 15 of http://www.holidaywebservice.com/Holidays/HolidayService.asmx?WSDL#types?schema1

[ERROR] undefined element declaration 's:schema'
  line 15 of http://www.holidaywebservice.com/Holidays/HolidayService.asmx?WSDL

[ERROR] undefined element declaration 's:schema'
  line 36 of http://www.holidaywebservice.com/Holidays/HolidayService.asmx?WSDL

[ERROR] undefined element declaration 's:schema'
  line 74 of http://www.holidaywebservice.com/Holidays/HolidayService.asmx?WSDL

[ERROR] undefined element declaration 's:schema'
  line 97 of http://www.holidaywebservice.com/Holidays/HolidayService.asmx?WSDL

[ERROR] undefined element declaration 's:schema'
  line 120 of http://www.holidaywebservice.com/Holidays/HolidayService.asmx?WSDL

[ERROR] undefined element declaration 's:schema'
  line 131 of http://www.holidaywebservice.com/Holidays/HolidayService.asmx?WSDL


C:\Users\Asher>
首先,我做错什么了吗?最后,如果没有办法生成代理客户机,那么还有没有其他方法可以访问这个web服务&它是java中的方法。 我是java新手,非常感谢您的帮助


谢谢

您是如何创建WSDL的?您可以引用一些未在WSDL中导出的数据类型

编辑
wsdl引用了名为“s”的架构,但找不到该架构,因为其URL为
但应该是
.xsd

在更改之后,现在它还抱怨没有指向模式。您需要在WSDL副本中修复所有这些问题,然后使用它执行wsimport

我还访问了www.holidaywebservice.com,发现第二个版本位于:

您可以在wsimport上将XMLschema作为参数传递

wsimport -b  http://www.w3.org/2001/XMLSchema.xsd  http://www.holidaywebservice.com/Holidays/HolidayService.asmx?WSDL
架构的架构中存在潜在的名称冲突。 一种解决方法是使用以下内容创建customization.xjb

<bindings xmlns="http://java.sun.com/xml/ns/jaxb" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" version="2.0">
<globalBindings>
<xjc:simple/>
</globalBindings>
<bindings scd="~xsd:complexType">
<class name="ComplexTypeType"/>
</bindings>
<bindings scd="~xsd:simpleType">
<class name="SimpleTypeType"/>
</bindings>
<bindings scd="~xsd:group">
<class name="GroupType"/>
</bindings>
<bindings scd="~xsd:attributeGroup">
<class name="AttributeGroupType"/>
</bindings>
<bindings scd="~xsd:element">
<class name="ElementType"/>
</bindings>
<bindings scd="~xsd:attribute">
<class name="attributeType"/>
</bindings>
</bindings>

很遗憾,我没有创建wsdl,我无法控制它。感谢您提供使用XMLSchema.xsd作为wsimport参数的提示,我忘记了这一点,它解决了我今天的问题:)
wsimport -b  http://www.w3.org/2001/XMLSchema.xsd -b customization.xjb  http://www.holidaywebservice.com/Holidays/HolidayService.asmx?WSDL