Spanish Consumir Web Service ASP.NET con parametros

jramosapys

New Member
Licensed User
Longtime User
Hola

Tengo problemas al consumir un Web Service ASP.NET que recibe un parametro String, la respuesta al momento de invocar el Web Service es "Internal Server Error 500 request formar is invalid...".

Esto sucede solamente cuando el Web Service recibe parametros, en otro ejemplo al llamar a un Web Service que no recibe parametros todo funciona bien.

Mi codigo es el siguiente:
Sub ConsultarImagenWS
Dim endPoint As String
Dim requestSoapXML As String
Dim IdEmpleado As String
Dim c As String
c=Chr(34)

IdEmpleado = TxtIdEmpleado.Text

endPoint = "http://192.168.1.73/WSEncuestaRest/service.asmx/ConsultaEmpleados"

requestSoapXML="<?xml version=" & c & "1.0" & c & " encoding=" & c & "utf-8" & c & "?>" & _
"<soap:Envelope xmlns:xsi=" & c & "http://www.w3.org/2001/XMLSchema-instance" & c & " " & _
"xmlns:xsd=" & c & "http://www.w3.org/2001/XMLSchema" & c & " " & _
"xmlns:soap=" & c & "http://schemas.xmlsoap.org/soap/envelope/" & c & ">" & _
"<soap:Body><ConsultaEmpleados xmlns=" & c & "http://tempuri.org" & c & " />" & _
"<IdEmpleado>" & IdEmpleado.Trim & "</IdEmpleado>" & _
"</ConsultaEmpleados>" & _
"</soap:Body></soap:Envelope>"


TxtXMLSoap.Text = requestSoapXML

Log(requestSoapXML )

webRequest.InitializePost2(endPoint, requestSoapXML.GetBytes("UTF8"))
'webRequest.SetHeader("Content-Type", "application/soap+xml; charset=utf-8")
webRequest.SetHeader("Content-Type", "text/xml; charset=utf-8")
webRequest.Timeout = 10000
webRequest.SetHeader("SOAPAction", "http://tempuri.org/ConsultaEmpleados")
WebClientImg.Initialize("webClientImg")
If WebClientImg.Execute(webRequest, 2) = False Then Return

End Sub

Alguna sugerencia por favor?

Gracias de antemano!
 
Top