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>
Nous ne pouvons pas vous dire pourquoi Spring-WS a été mal configuré si vous nous donnez pas d'informations sur votre configuration – skaffman
question @skaffman modifiée –