Announcement Announcement Module
Collapse
No announcement yet.
Validation error PayloadValidatingInterceptor Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Validation error PayloadValidatingInterceptor

    Hello everybody,

    I am using SAAJ as client to connect with my Webservice. Only i get validation errors:
    Code:
    SOAP Fault Code:   SOAP-ENV:Client
    SOAP Fault String: Validation error
    When i don't use the PayloadValidatingInterceptor the webservice works fine.
    Can anybody help me?
    XSD code:
    Code:
    <xs:element name="GetTestRequest" nillable="true" type="xs:string" />
    
    	<xs:element name="GetTestResponse" type="xs:int" />
    The following code i use to make the soap message:
    Code:
    SOAPMessage message = messageFactory.createMessage();
    		SOAPEnvelope envelope = message.getSOAPPart().getEnvelope();
    		Name getTestRequest = envelope.createName("GetTestRequest", "tns",
    				"http://localhost:8080/ServiceFarm/services/ServiceFarm.wsdl");
    		SOAPBodyElement helloTestRequest = message.getSOAPBody()
    				.addBodyElement(getTestRequest);
    		helloTestRequest.setValue("Hello");
    The error in tomcat logfile:
    Code:
    DEBUG http-8080-3 org.springframework.ws.server.MessageTracing - Sent response [<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Client</faultcode><faultstring xml:lang="en">Validation error</faultstring><detail><spring-ws:ValidationError xmlns:spring-ws="http://springframework.org/spring-ws">cvc-elt.1: Cannot find the declaration of element 'tns:GetTestRequest'.</spring-ws:ValidationError></detail></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>] for request [<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body><tns:GetTestRequest xmlns:tns="http://localhost:8080/ServiceFarm/services/ServiceFarm.wsdl">Hello</tns:GetTestRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>]
    Parts of the WSDL:
    Code:
    <xs:element name="GetTestRequest" nillable="true" type="xs:string"/>
    
    	<xs:element name="GetTestResponse" type="xs:int"/>
     <wsdl:message name="GetTestRequest">
        <wsdl:part element="schema:GetTestRequest" name="GetTestRequest">
        </wsdl:part>
      </wsdl:message>
      <wsdl:message name="GetTestResponse">
        <wsdl:part element="schema:GetTestResponse" name="GetTestResponse">
        </wsdl:part>
      </wsdl:message>
      <wsdl:portType name="ServiceFarm">
        <wsdl:operation name="GetTest">
          <wsdl:input message="schema:GetTestRequest" name="GetTestRequest">
        </wsdl:input>
          <wsdl:output message="schema:GetTestResponse" name="GetTestResponse">
        </wsdl:output>
        </wsdl:operation>
      </wsdl:portType>
      <wsdl:binding name="ServiceFarmBinding" type="schema:ServiceFarm">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="GetTest">
          <soap:operation soapAction=""/>
          <wsdl:input name="GetTestRequest">
            <soap:body use="literal"/>
          </wsdl:input>
          <wsdl:output name="GetTestResponse">
            <soap:body use="literal"/>
          </wsdl:output>
        </wsdl:operation>
      </wsdl:binding>
      <wsdl:service name="ServiceFarmService">
        <wsdl:port binding="schema:ServiceFarmBinding" name="ServiceFarmPort">
          <soap:address location="http://localhost:8080/ServiceFarm/services"/>
        </wsdl:port>
      </wsdl:service>

  • #2
    I fixed the problem:
    I remove xs: from the tags in xsd file.

    Comment

    Working...
    X