2010-10-14 20 views
4

J'essaie de créer un service Web très simple et j'ai quelques difficultés à faire en sorte que le ressort génère le wsdl correct. J'ai fait de mon mieux pour copier l'exemple de ce spring tutorial. Si quelqu'un a la moindre idée de ce que je fais de mal, j'apprécierais vraiment l'aide.Problème de génération WSDL Spring-WS

En substance, il existe un seul EndPoint appelé IncidentHeaderEndpoint (qui n'a actuellement aucune fonctionnalité). Je veux appeler les clients envoient une demande xml sous la forme:

<browseIncidents> 
    <responsibleManager>foo</responsibleManager> 
</browseIncidents> 

Mon EndPoint ressemble à ceci:

public class IncidentHeaderEndpoint extends AbstractJDomPayloadEndpoint { 
    XPath respMgrExpression; 

    public IncidentHeaderEndpoint() { 
     Namespace namespace = Namespace.getNamespace("trust-service", "http://act-informatics.co.uk/trust-service/schemas"); 
     try { 
      respMgrExpression = XPath.newInstance("//trust-service:StartDate"); 
      respMgrExpression.addNamespace(namespace); 
     } catch (JDOMException e) { 
      e.printStackTrace(); 
     } 
    } 
    protected Element invokeInternal(Element request) throws Exception { 
     String respMgr = respMgrExpression.valueOf(request); 
     return null; 
    } 
} 

Quand je déploie dans tomcat je reçois les avertissements suivants:

14-Oct-2010 13:08:43 org.springframework.ws.wsdl.wsdl11.provider.DefaultMessagesProvider addMessages 
WARNING: No messages were created, make sure the referenced schema(s) contain elements 
14-Oct-2010 13:08:43 org.springframework.ws.wsdl.wsdl11.provider.AbstractPortTypesProvider createOperations 
WARNING: No operations were created, make sure the WSDL contains messages 

Ceci est ma config printemps:

<!-- TRUST WEB SERVICES --> 
<bean id="incidentHeaderEndpoint" class="co.uk.act.cics.ws.IncidentHeaderEndpoint" /> 

<!-- Routing Mapping --> 
<bean class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping"> 
    <property name="mappings"> 
     <props> 
      <prop key="{http://act-informatics.co.uk/trust-service/schemas}BrowseIncidents">incidentHeaderEndpoint</prop> 
     </props> 
    </property> 
    <property name="interceptors"> 
     <bean 
      class="org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor" /> 
    </property> 
</bean> 

<!-- WSDL Generation --> 
<bean id="browse" class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition"> 
    <property name="schema" ref="trust-schema" /> 
    <property name="portTypeName" value="TrustService" /> 
    <property name="locationUri" value="http://localhost:8080/trust-service/browseIncidents/" /> 
    <property name="targetNamespace" value="http://act-informatics.co.uk/trust-service/definitions"/> 
</bean> 

<bean id="trust-schema" class="org.springframework.xml.xsd.SimpleXsdSchema"> 
    <property name="xsd" value="/WEB-INF/trust-service.xsd" /> 
</bean> 

Ceci est mon schéma - WEB-INF/confiance service.xsd:

<?xml version="1.0" encoding="UTF-8"?>` 
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://act-informatics.co.uk/trust-service/schemas" xmlns:schemas="http://act-informatics.co.uk/trust-service/schemas"> 
    <xs:element name="browseIncidents"> 
    <xs:complexType> 
     <xs:sequence> 
     <xs:element name="responsibleManager" type="xs:string"/> 
     </xs:sequence> 
    </xs:complexType> 
    </xs:element> 
</xs:schema> 

et c'est le WSDL problématique situé à http://localhost:8080/trust-service/browseIncidents/browse.wsdl:

<?xml version="1.0" encoding="UTF-8"?> 
<wsdl:definitions xmlns:sch="http://act-informatics.co.uk/trust-service/schemas" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://act-informatics.co.uk/trust-service/definitions" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://act-informatics.co.uk/trust-service/definitions"> 
    <wsdl:types> 
    <xs:schema xmlns:schemas="http://act-informatics.co.uk/trust-service/schemas" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://act-informatics.co.uk/trust-service/schemas"> 
    <xs:element name="browseIncidents"> 
    <xs:complexType> 
     <xs:sequence> 
     <xs:element name="responsibleManager" type="xs:string"/> 
     </xs:sequence> 
    </xs:complexType> 
    </xs:element> 
</xs:schema> 
    </wsdl:types> 
    <wsdl:portType name="TrustService"> 
    </wsdl:portType> 
    <wsdl:binding name="TrustServiceSoap11" type="tns:TrustService"> 
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> 
    </wsdl:binding> 
    <wsdl:service name="TrustServiceService"> 
    <wsdl:port binding="tns:TrustServiceSoap11" name="TrustServiceSoap11"> 
     <soap:address location="http://localhost:8080/trust-service/browseIncidents/"/> 
    </wsdl:port> 
    </wsdl:service> 
</wsdl:definitions> 

Répondre

12

Les noms d'entrée et l'élément de sortie dans votre xsd devrait avoir suffixe en tant que demande et réponse. alors seulement spring-ws l'identifiera comme paramètres d'entrée et de sortie.

si vous avez des éléments OrderRequest et OrderResponse, une opération avec ordre de nom se créé avec entrée et de sortie OrderRequest et OrderResponse

+1

Merci, cela fonctionne, mais suis-je manque something.I ne vois pas documenté nulle part. –

+0

Merci! Ça marche! –