I was wondering if i could get some help with the following issue.
I was trying to run the command below using jax to generate web service client proxy:
wsimport http://www.holidaywebservice.com/Holidays/HolidayService.asmx?WSDL
but i'm getting the following error:
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>
First of all am i doing something incorrectly? And lastly if there's no way to generate a proxy client then is there any other way to access this webservice & it's methods in java. I'm fairy new to java so any help would be greatly appreciated.
Thanks
You can pass XMLschema as parameter on wsimport
wsimport -b http://www.w3.org/2001/XMLSchema.xsd http://www.holidaywebservice.com/Holidays/HolidayService.asmx?WSDL
There are potential name conflicts in schema for schema. A workaround is to create customization.xjb with following
<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>
your ultimate call would be
wsimport -b http://www.w3.org/2001/XMLSchema.xsd -b customization.xjb http://www.holidaywebservice.com/Holidays/HolidayService.asmx?WSDL
How did you create that WSDL? It seams that you refer some data types that are not exported in your WSDL.
EDIT
The wsdl refers to a schema named 's' but this can't be found, because its URL is
http://www.w3.org/2001/XMLSchema but should be
http://www.w3.org/2001/XMLSchema.xsd
after change that now it also complains about http://www.27seconds.com/Holidays/ that isn't pointing to a schema too. You need to fix all of them in your copy of the WSDL and then do the wsimport with it.
I also gone to www.holidaywebservice.com and found there's a second version at: http://www.holidaywebservice.com/HolidayService_v2/HolidayService2.asmx?wsdl
精彩评论