我必须使用这个确切的XSD,因此不可能进行任何更改。我可以将我的问题缩小到以下localisationNameType
。
在没有localisationNameType
的情况下发布web服务时,所有工作正常,soapUI可以生成请求。添加类型时,它只是一个空项目。通过浏览器访问可以打开wsdl。 (这不是代理问题,因为我在localhost上运行它。)
我也尝试使用肥皂1.2和1.1,因此也可以排除原因。
当尝试从Eclipse向导(Axis)创建Web Service Client
时,我也收到一条错误消息告诉我:
IWAB0399E Error in generating Java from WSDL: java.io.IOException: Element {http://www.ech.ch/xmlns/eCH-0129/3}localisationDescriptionIndex is referenced but not defined.
删除localisationDescriptionIndex
时,只需将下一个字段视为无效,并使用相同的错误代码/异常。正如您所看到的,Element在对象工厂中有一个实际的定义,但是例外情况说它无法找到它。
在发布具有以下类型的soap-service时,我无法使用soapUI生成请求有什么问题?
它涉及以下代码:
<xs:complexType name="localisationNameType">
<xs:sequence maxOccurs="unbounded">
<xs:element name="localisationLanguage" type="eCH-0129:localisationLanguageType" />
<xs:element name="localisationDescription" type="eCH-0129:longNameOfLocalisationType" />
<xs:element name="localisationDescriptionShort" type="eCH-0129:shortNameOfLocalisationType"
minOccurs="0" />
<xs:element name="localisationDescriptionIndex" type="eCH-0129:indexNameOfLocalisationType"
minOccurs="0" />
</xs:sequence>
</xs:complexType>
<xs:simpleType name="localisationLanguageType">
<xs:restriction base="xs:token">
<xs:enumeration value="de" />
<xs:enumeration value="fr" />
<xs:enumeration value="it" />
<xs:enumeration value="ro" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="longNameOfLocalisationType">
<xs:restriction base="xs:token">
<xs:minLength value="1" />
<xs:maxLength value="60" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="indexNameOfLocalisationType">
<xs:restriction base="xs:token">
<xs:minLength value="1" />
<xs:maxLength value="3" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="shortNameOfLocalisationType">
<xs:restriction base="xs:token">
<xs:minLength value="1" />
<xs:maxLength value="24" />
</xs:restriction>
</xs:simpleType>
Jaxb生成的内容:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "localisationNameType", propOrder = {
"localisationLanguageAndLocalisationDescriptionAndLocalisationDescriptionShort" })
public class LocalisationNameType {
@XmlElementRefs({
@XmlElementRef(
name = "localisationDescriptionIndex", namespace = "http://www.ech.ch/xmlns/eCH-0129/3",
type = JAXBElement.class),
@XmlElementRef(
name = "localisationLanguage", namespace = "http://www.ech.ch/xmlns/eCH-0129/3", type = JAXBElement.class),
@XmlElementRef(
name = "localisationDescription", namespace = "http://www.ech.ch/xmlns/eCH-0129/3", type = JAXBElement.class),
@XmlElementRef(
name = "localisationDescriptionShort", namespace = "http://www.ech.ch/xmlns/eCH-0129/3",
type = JAXBElement.class) })
protected List<JAXBElement<?>> localisationLanguageAndLocalisationDescriptionAndLocalisationDescriptionShort;
对象工厂:
/**
* Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
*/
@XmlElementDecl(
namespace = "http://www.ech.ch/xmlns/eCH-0129/3", name = "localisationDescription",
scope = LocalisationNameType.class)
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createLocalisationNameTypeLocalisationDescription(String value) {
return new JAXBElement<String>(_LocalisationNameTypeLocalisationDescription_QNAME, String.class,
LocalisationNameType.class, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
*/
@XmlElementDecl(
namespace = "http://www.ech.ch/xmlns/eCH-0129/3", name = "localisationDescriptionShort",
scope = LocalisationNameType.class)
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createLocalisationNameTypeLocalisationDescriptionShort(String value) {
return new JAXBElement<String>(_LocalisationNameTypeLocalisationDescriptionShort_QNAME, String.class,
LocalisationNameType.class, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link LocalisationLanguageType }{@code >}}
*/
@XmlElementDecl(
namespace = "http://www.ech.ch/xmlns/eCH-0129/3", name = "localisationLanguage", scope = LocalisationNameType.class)
public JAXBElement<LocalisationLanguageType> createLocalisationNameTypeLocalisationLanguage(
LocalisationLanguageType value) {
return new JAXBElement<LocalisationLanguageType>(_LocalisationNameTypeLocalisationLanguage_QNAME,
LocalisationLanguageType.class, LocalisationNameType.class, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
*/
@XmlElementDecl(
namespace = "http://www.ech.ch/xmlns/eCH-0129/3", name = "localisationDescriptionIndex",
scope = LocalisationNameType.class)
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createLocalisationNameTypeLocalisationDescriptionIndex(String value) {
return new JAXBElement<String>(_LocalisationNameTypeLocalisationDescriptionIndex_QNAME, String.class,
LocalisationNameType.class, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link LocalisationLanguageType }{@code >}}
*/
@XmlElementDecl(
namespace = "http://www.ech.ch/xmlns/eCH-0129/3", name = "localityLanguage", scope = LocalityNameLongType.class)
public JAXBElement<LocalisationLanguageType> createLocalityNameLongTypeLocalityLanguage(
LocalisationLanguageType value) {
return new JAXBElement<LocalisationLanguageType>(_LocalityNameLongTypeLocalityLanguage_QNAME,
LocalisationLanguageType.class, LocalityNameLongType.class, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
*/
@XmlElementDecl(
namespace = "http://www.ech.ch/xmlns/eCH-0129/3", name = "localityDescriptionLong",
scope = LocalityNameLongType.class)
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createLocalityNameLongTypeLocalityDescriptionLong(String value) {
return new JAXBElement<String>(_LocalityNameLongTypeLocalityDescriptionLong_QNAME, String.class,
LocalityNameLongType.class, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link LocalisationLanguageType }{@code >}}
*/
@XmlElementDecl(
namespace = "http://www.ech.ch/xmlns/eCH-0129/3", name = "localityLanguage", scope = LocalityNameShortType.class)
public JAXBElement<LocalisationLanguageType> createLocalityNameShortTypeLocalityLanguage(
LocalisationLanguageType value) {
return new JAXBElement<LocalisationLanguageType>(_LocalityNameLongTypeLocalityLanguage_QNAME,
LocalisationLanguageType.class, LocalityNameShortType.class, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}}
*/
@XmlElementDecl(
namespace = "http://www.ech.ch/xmlns/eCH-0129/3", name = "localityDescriptionShort",
scope = LocalityNameShortType.class)
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
public JAXBElement<String> createLocalityNameShortTypeLocalityDescriptionShort(String value) {
return new JAXBElement<String>(_LocalityNameShortTypeLocalityDescriptionShort_QNAME, String.class,
LocalityNameShortType.class, value);
}
如何注册Web服务:
...
Endpoint.publish(soapService.getEndpoint(), soapService);
...
服务类:
@Service
@WebService(name = "SendService")
@BindingType(value = SOAPBinding.SOAP12HTTP_BINDING)
public class SendServiceImpl implements SendService {
....
}