Necesito subir un archivo a un webservice asp.net. De hecho el webservice funciona correctamente. Este es el webservice:
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
El webservice acepta los siguientes protocolos:
HTTP POST, HTTP GET, SOAP 1.1, and SOAP 1.2.
En concreto en el test form del webservice el formato para http post seria:
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
¿Es posible subir un archivo mediante este webservice usando el objeto job.postfile?. Creo que usa http post (corrijanme si no es correcto).
He buscado por todo el foro, y unicamente encuentro ejemplos para un webservice php.
¿Alguien dispone de un pequeño ejemplo de codigo para usar el job.posfile para webservice asp.net?
Y si no es posible.¿Alguna alternativa?
			
			
			
				B4X:
			
		
		
		<WebMethod> _
    Public Function UploadFile(f As Byte(), fileName As String) As String
        ' the byte array argument contains the content of the file
        ' the string argument contains the name and extension
        ' of the file passed in the byte array
        Try
            ' instance a memory stream and pass the
            ' byte array to its constructor
            Dim ms As New MemoryStream(f)
            ' instance a filestream pointing to the
            ' storage folder, use the original file name
            ' to name the resulting file
            Dim fs As FileStream = New FileStream(System.Web.Hosting.HostingEnvironment.MapPath("~/Prueba/") + fileName, FileMode.Create)
            ' write the memory stream containing the original
            ' file as a byte array to the filestream
            ms.WriteTo(fs)
            ' clean up
            ms.Close()
            fs.Close()
            fs.Dispose()
            ' return OK if we made it this far
            Return "OK"
        Catch ex As Exception
            ' return the error message if the operation fails
            Return ex.Message.ToString()
        End Try
    End FunctionEl webservice acepta los siguientes protocolos:
HTTP POST, HTTP GET, SOAP 1.1, and SOAP 1.2.
En concreto en el test form del webservice el formato para http post seria:
			
				B4X:
			
		
		
		HTTP POST
The following is a sample HTTP POST request and response. The placeholders shown need to be replaced with actual values.
POST /prueba.asmx/UploadFile HTTP/1.1
Host: XXX.XXX.XXX.XXX
Content-Type: application/x-www-form-urlencoded
Content-Length: length
f=string&f=string&fileName=string
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://www.prueba.com/">string</string>¿Es posible subir un archivo mediante este webservice usando el objeto job.postfile?. Creo que usa http post (corrijanme si no es correcto).
He buscado por todo el foro, y unicamente encuentro ejemplos para un webservice php.
¿Alguien dispone de un pequeño ejemplo de codigo para usar el job.posfile para webservice asp.net?
Y si no es posible.¿Alguna alternativa?
			
				Last edited: 
			
		
	
								
								
									
	
								
							
							 
				 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		