У меня есть мыльный веб-сервис, который успешно разворачивается, и все операции могут выполняться успешно, пока я не добавлю аннотацию @SchemaValidation в @WebService.
Исключение:
javax.xml.ws.WebServiceException: org.xml.sax.SAXParseException: Attribute "xsd" bound to namespace "http://www.w3.org/2000/xmlns/" was already specified for element "xsd:schema".
at com.sun.xml.ws.server.ServerSchemaValidationTube.<init>(ServerSchemaValidationTube.java:100)
at com.sun.xml.ws.api.pipe.ServerTubeAssemblerContext.createValidationTube(ServerTubeAssemblerContext.java:218)
at weblogic.wsee.jaxws.tubeline.standard.StandardTubelineDeploymentListener$17.createServer(StandardTubelineDeploymentListener.java:191)
at weblogic.wsee.jaxws.WLSTubelineAssemblerFactory$TubelineAssemblerImpl.createServer(WLSTubelineAssemblerFactory.java:216)
at com.sun.xml.ws.server.WSEndpointImpl.<init>(WSEndpointImpl.java:179)
XSD:
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.mycompany.com/04/02/2010/V1.0/MyService.xsd"
attributeFormDefault="qualified"
elementFormDefault="qualified"
targetNamespace="http://www.mycompany.com/04/02/2010/V1.0/MyService.xsd">
<xs:element name="getStuffRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="accountNumber">
<xs:simpleType>
<xs:restriction base="xs:string">
<!-- One or more characters that consists of any combination of lower case or upper case letters, numbers, hyphens, or a space -->
<xs:pattern value="[a-zA-Z0-9\- ]+"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="numberOfDays" type="xs:integer"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="getStuffResponse">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="person" type="personType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="myFault">
<xs:complexType>
<xs:sequence>
<xs:element name="code" type="xs:int"/>
<xs:element name="description" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="personType">
<xs:sequence>
<xs:element name="firstName" type="xs:string"/>
<xs:element name="lastName" type="xs:string"/>
<xs:element name="middleInit" type="xs:string"/>
<xs:element name="collectionDate" type="xs:date"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
WSDL:
<?xml version='1.0' encoding='UTF-8'?>
<WL5G3N0:definitions name="myServiceAccess" targetNamespace="http://www.mycompany.com/04/02/2010/V1.0/MyServiceAccess.wsdl" xmlns="" xmlns:WL5G3N0="http://schemas.xmlsoap.org/wsdl/" xmlns:WL5G3N1="http://www.mycompany.com/04/02/2010/V1.0/MyServiceAccess.xsd" xmlns:WL5G3N2="http://www.w3.org/2001/XMLSchema" xmlns:WL5G3N3="http://www.mycompany.com/04/02/2010/V1.0/MyServiceAccess.wsdl" xmlns:WL5G3N4="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:WL5G3N5="http://schemas.xmlsoap.org/wsdl/mime/">
<xsd:schema xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:mlab="http://www.mycompany.com/04/02/2010/V1.0/MyServiceAccess.xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.mycompany.com/04/02/2010/V1.0/MyServiceAccess.wsdl" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://www.mycompany.com/04/02/2010/V1.0/MyService.xsd" schemaLocation="MyService.xsd"/>
</xsd:schema>
</WL5G3N0:types>
<WL5G3N0:message name="getStuffRequest">
<WL5G3N0:part element="WL5G3N1:getStuffRequest" name="getStuffRequest"/>
</WL5G3N0:message>
<WL5G3N0:message name="getStuffResponse">
<WL5G3N0:part element="WL5G3N1:getStuffResponse" name="getStuffResponse"/>
</WL5G3N0:message>
<WL5G3N0:message name="myFault">
<WL5G3N0:part element="WL5G3N1:myFault" name="myFault"/>
</WL5G3N0:message>
<WL5G3N0:portType name="myServicePortType">
<WL5G3N0:operation name="getStuff">
<WL5G3N0:documentation>
Do stuff
</WL5G3N0:documentation>
<WL5G3N0:input message="WL5G3N3:getStuffRequest"/>
<WL5G3N0:output message="WL5G3N3:getStuffResponse"/>
<WL5G3N0:fault message="WL5G3N3:myFault" name="getStuffFault"/>
</WL5G3N0:operation>
</WL5G3N0:portType>
<WL5G3N0:binding name="myServiceSOAPBinding" type="WL5G3N3:myServicePortType">
<WL5G3N4:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<WL5G3N0:operation name="getStuff">
<WL5G3N4:operation soapAction="http://www.mycompany.com/04/02/2010/V1.0/MyServiceAccess.wsdl/getStuff"/>
<WL5G3N0:input>
<WL5G3N4:body use="literal"/>
</WL5G3N0:input>
<WL5G3N0:output>
<WL5G3N4:body use="literal"/>
</WL5G3N0:output>
<WL5G3N0:fault name="getStuffFault">
<WL5G3N4:fault name="getStuffFault" use="literal"/>
</WL5G3N0:fault>
</WL5G3N0:operation>
</WL5G3N0:binding>
<WL5G3N0:service name="myServiceAccessService">
<WL5G3N0:port binding="WL5G3N3:myServiceSOAPBinding" name="myServiceSOAPPort">
<WL5G3N4:address location="http://www.example.org/"/>
</WL5G3N0:port>
</WL5G3N0:service>
</WL5G3N0:definitions>
Кажется, он жалуется на атрибуты пространства имен в элементе xsd: schema.Я не понимаю, почему xsd связан с "http://www.w3.org/2000/xmlns/" для начала. Я также не понимаю, почему эти определения пространства имен повторяются в элементе xsd: schema, когда они уже перечислены в элементе определения вверхуWSDL. Любая помощь приветствуется.