2010-01-28 13 views
1

J'utilise soapUI pour tester quelques WebServices.Problème de paramétrage du schéma de réponse WS

En MockService disponible en soapUI je reçois cette réponse par défaut

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://www.someurl.com/schemas"> 
     <soapenv:Header/> 
     <soapenv:Body> 
      <sch:Response> 
       <sch:Something>?</sch:Something> 
      </sch:Response> 
     </soapenv:Body> 
    </soapenv:Envelope> 

Lorsque le vrai Webservice est appelé, je ne suis pas xmlns: sch = "http://www.someurl.com/schemas" et les éléments à l'intérieur de la réponse ne sont pas fournis avec le préfixe 'sch'. Voici ce que je reçois:

 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> 
      <soapenv:Header/> 
      <soapenv:Body> 
       <Response> 
        <Something>something</Something> 
       </Response> 
      </soapenv:Body> 
     </soapenv:Envelope> 

J'utilise Java avec spring-ws. Et en utilisant Castor pour marshall xml to Java Object.

Comment inclure le schéma dans la réponse?

EDIT: Ajout de détails de configuration.

monApplication-servlet.xml est comme ce

<bean id="payloadMapping" 
     class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping"> 
     <property name="endpointMap"> 
      <map> 
       <entry 
        key="{http://www.someurl.com/schemas}MyRequest" 
        value-ref="myEndpoint"/>     
      </map> 
     </property> 
    </bean> 

<bean id="myEndpoint" 
     class="foo.bar.myEndpoint"> 
     <constructor-arg ref="messageSource" /> 
     <property name="marshaller" ref="marshaller" /> 
     <property name="unmarshaller" ref="marshaller" /> 
    </bean> 

<bean id="myWsdlDefinition" 
     class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition"> 
     <property name="schema"> 
      <bean class="org.springframework.xml.xsd.SimpleXsdSchema"> 
       <property name="xsd" value="/MyXsd.xsd" /> 
      </bean> 
     </property> 
     <property name="portTypeName" value="myPortTypeName" /> 
     <property name="locationUri" value="http://anotherUrl:8080/services" /> 
    </bean> 

<bean id="marshaller" class="org.springframework.oxm.castor.CastorMarshaller"> 
     <property name="mappingLocation" value="classpath:mapping.xml" /> 
    </bean> 

<bean id="messageSource" 
     class="org.springframework.context.support.ResourceBundleMessageSource"> 
     <property name="basename" value="errors" /> 
    </bean> 
+0

Nous ne pouvons pas vous dire pourquoi Spring-WS a été mal configuré si vous nous donnez pas d'informations sur votre configuration – skaffman

+0

question @skaffman modifiée –

Répondre

1

Dans le fichier de mappage je dois mettre ns-préfixe dans la carte à l'élément.

<map-to xml="Response" ns-prefix="sch" /> 
+0

Pouvez-vous poster comment votre fichier de configuration ressemble maintenant, pls? – Chepech