Announcement Announcement Module
Collapse
No announcement yet.
Invalid content was found starting with element Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Invalid content was found starting with element

    Hello everybody,

    I finally can start with sending soap message only i get validation errors.
    Error:
    Invalid content was found starting with element

    Error in the 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-complex-type.2.4.a: Invalid content was found starting with element 'name'. One of '{"http://localhost:8080/ServiceFarm/services/ServiceFarm.wsdl":name, "http://localhost:8080/ServiceFarm/services/ServiceFarm.wsdl":country, "http://localhost:8080/ServiceFarm/services/ServiceFarm.wsdl":postalcode, "http://localhost:8080/ServiceFarm/services/ServiceFarm.wsdl":address, "http://localhost:8080/ServiceFarm/services/ServiceFarm.wsdl":city, "http://localhost:8080/ServiceFarm/services/ServiceFarm.wsdl":email}' is expected.</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><servicefarm:AddEntryRequest xmlns:servicefarm="http://localhost:8080/ServiceFarm/services/ServiceFarm.wsdl"><name>sdfsdfdf</name><country>sdfsdfsfd</country><postalcode>fsdsdf</postalcode><address>sfsdf</address><city>sdfsdfsdf</city><email>[email protected]</email></servicefarm:AddEntryRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>]
    My xsd:
    Code:
    <element name="AddEntryRequest">
    		<complexType>
    			<all>
    				<element name="name" type="string" />
    				<element name="country" type="string" />
    				<element name="postalcode" type="string" />
    				<element name="address" type="string" />
    				<element name="city" type="string" />
    				<element name="email" type="string" />
    			</all>
    		</complexType>
    	</element>
    My code too create the soap message:
    Code:
    String namespace = "http://localhost:8080/ServiceFarm/services/ServiceFarm.wsdl";
    		QName bodyName = new QName(namespace,
    				"AddEntryRequest",prefix);
    		
    		SOAPBodyElement addEntryRequest = body.addBodyElement(bodyName);
    		
    		System.out.println(addEntryForm.getName());
    		QName childName = new QName("name");
    		SOAPElement country = addEntryRequest.addChildElement(childName);
    		country.addTextNode(addEntryForm.getName());
    		childName = new QName("country");
    		addEntryRequest.addChildElement(childName).addTextNode(addEntryForm.getCountry());
    		childName = new QName("postalcode");
    		addEntryRequest.addChildElement(childName).addTextNode(addEntryForm.getPostalcode());
    		childName = new QName("address");
    		addEntryRequest.addChildElement(childName).addTextNode(addEntryForm.getAddress());
    		childName = new QName("city");
    		addEntryRequest.addChildElement(childName).addTextNode(addEntryForm.getCity());
    		childName = new QName("email");
    		addEntryRequest.addChildElement(childName).addTextNode(addEntryForm.getEmail());
    Can anybody help me?

  • #2
    I solved my problem by cleaning up the servlet.xml

    Comment

    Working...
    X