How to fix "Element not allowed (strict wildcard, and no definition found)" error when validating WS response?

Sergio 1 Reputation point

I am new in VB.NET webservices. I have created this WS:

<%@ WebService Language="vb" Class="Service" %>  
Imports System.Web.Services  
Imports System.Net  
Imports System.IO  
Imports System.Xml  
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _  
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _  
Public Class Service  
Inherits System.Web.Services.WebService   
Public Function FunctionToCall(ByVal usuario As String, ByVal clave As String) As XmlDocument  
    <my code here>  
    Dim inicioXML As string = "<RespuestaDelServicio xmlns=""http://nnn.nnn.nnn.nnn/ws/WSName"">"  
    Dim finXML As string = "</RespuestaDelServicio>"  
    Dim xmlResponse As String = "<data>....</data>"  
    Dim cuerpoXML As String = inicioXML & xmlResponse & finXML  
    Dim XMLdoc2 As New XmlDocument  
    Dim xmldecl As XmlDeclaration  
    xmldecl = XMLdoc2.CreateXmlDeclaration("1.0", Nothing, Nothing)  
    xmldecl.Encoding = "UTF-8"    
    xmldecl.Standalone = "yes"  
    Dim root As XmlElement = XMLdoc2.DocumentElement   
    XMLdoc2.InsertBefore(xmldecl, root)  
    Return XMLdoc2  
End Function  

When I try it in SoapUI, the result seems to be Ok, but If I validate it using ALT+V I receive the error: "line 5: Element not allowed (strict wildcard, and no definition found)". It seems that I have to define processContents to 'lax' so SoapUI does not try to validate my response against a XSD file.


But I don´t know how to define it on my code.

Is it neccessary to create and attach a XSD?

Thanks a lot!

Microsoft Technologies based on the .NET software framework.
3,638 questions
0 comments No comments
{count} votes