Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to define type of respone for my webservice

Status
Not open for further replies.

sergiobotta

Programmer
May 2, 2014
5
UY
I am new in VB.NET webservices. I have created this WS:
Code:
<%@ WebService Language="vb" Class="Service" %>
Imports System.Web.Services
Imports System.Net
Imports System.IO
Imports System.Xml
<WebService(Namespace:="[URL unfurl="true"]http://nnn.nnn.nnn.nnn/ws/WSName")>[/URL]
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class Service
Inherits System.Web.Services.WebService 
<WebMethod()>
Public Function FunctionToCall(ByVal usuario As String, ByVal clave As String) As XmlDocument
    <my code here>
    Dim inicioXML As string = "<RespuestaDelServicio xmlns=""[URL unfurl="true"]http://nnn.nnn.nnn.nnn/ws/WSName"">"[/URL]
    Dim finXML As string = "</RespuestaDelServicio>"
    Dim xmlResponse As String = "<data>....</data>"
    Dim cuerpoXML As String = inicioXML & xmlResponse & finXML
    Dim XMLdoc2 As New XmlDocument
    XMLdoc2.LoadXml(cuerpoXML)
    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.

Image

But I don´t know how to define it on my code. Thanks a lot!
 
This is the VBScript forum, nothing to do with .net
You might want to try forum1867
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top