when I upload a image with webservice, always succeed.
But when I upload a video, sometimes succeed, sometime failure.
When the video lasts shortly, about 2-3 seconds, succeed.
when the video lasts more than 4 seconds, failure.
maybe the video file is too much bigger to upload.
thanks
error message shows:
But when I upload a video, sometimes succeed, sometime failure.
When the video lasts shortly, about 2-3 seconds, succeed.
when the video lasts more than 4 seconds, failure.
maybe the video file is too much bigger to upload.
thanks
error message shows:
"The root element for the request could not be determined. When RoutingStyle is set to RequestElement, SoapExtensions configured via an attribute on the method cannot modify the request stream before it is read. The extension must be configured via the SoapExtensionTypes element in web.config, or the request must arrive at the server as clear text."
webservice code:
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
Imports System.IO
Imports System.Web.AspNetHostingPermission
Imports Newtonsoft.Json
Imports System.Net
' 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消注释以下行。
' <System.Web.Script.Services.ScriptService()> _
<System.Web.Services.WebService(Namespace:="webpad")> _
<Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<SoapDocumentService(RoutingStyle:=SoapServiceRoutingStyle.RequestElement)> _
<ToolboxItem(False)> _
Public Class webpad
Inherits System.Web.Services.WebService
<WebMethod> _
Public Function upfile(vstring As String, vbizno As String, vfile As String, vnet As String, vftpport As String, vdbname As String, vftplogin As String, vftpcode As String) As String
Dim iInt As Integer = 1, fileStream As FileStream = Nothing
vnet = "127.0.0.1"
If FtpFileFind("ftp://" & vnet & ":" & deCode(vftpport) & "/" & deCode(vdbname) & "/cloud/" & vbizno.Substring(0, 4) & "/" & vbizno.Substring(0, 6) & "/" & vbizno & "/", vfile, deCode(vftplogin), deCode(vftpcode)) = True Then
Return aryLast(vfile, ".")
Else
Try
Dim fileByte() As Byte = Convert.FromBase64String(vstring)
Dim mmStream As New MemoryStream(fileByte)
pathmade("ftp://" & vnet & ":" & deCode(vftpport) & "/" & deCode(vdbname) & "/cloud", vftplogin, vftpcode)
pathmade("ftp://" & vnet & ":" & deCode(vftpport) & "/" & deCode(vdbname) & "/cloud/" & vbizno.Substring(0, 4), vftplogin, vftpcode)
pathmade("ftp://" & vnet & ":" & deCode(vftpport) & "/" & deCode(vdbname) & "/cloud/" & vbizno.Substring(0, 4) & "/" & vbizno.Substring(0, 6), vftplogin, vftpcode)
pathmade("ftp://" & vnet & ":" & deCode(vftpport) & "/" & deCode(vdbname) & "/cloud/" & vbizno.Substring(0, 4) & "/" & vbizno.Substring(0, 6) & "/" & vbizno, vftplogin, vftpcode)
fileStream = New FileStream(System.Web.Hosting.HostingEnvironment.MapPath("~/" & deCode(vdbname) & "/cloud/") & vbizno.Substring(0, 4) & "/" & vbizno.Substring(0, 6) & "/" & vbizno & "/" & vfile, FileMode.Create, FileAccess.ReadWrite)
mmStream.WriteTo(fileStream)
mmStream.Close()
fileStream.Close()
fileStream.Dispose()
Return aryLast(vfile, ".")
Catch ex As Exception
Return ex.ToString ' "系统错误!"
End Try
End If
End Function
End Class
b4a code:
Dim SOAP As String,upfile As HttpJob
upfile.Initialize("upfile", Me)
SOAP="<?xml version='1.0' encoding='utf-8'?><soap12:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap12='http://www.w3.org/2003/05/soap-envelope'><soap12:Body><upfile xmlns='webpad'><vstring>" & strFile & "</vstring><vbizno>" & m00_public.pPic.Get("bizno") & "</vbizno><vfile>" & VideoFileName & "</vfile><vnet>" & m00_public.pip & "</vnet><vftpport>" & m00_public.pportftp & "</vftpport><vdbname>" & m00_public.pDbname & "</vdbname><vftplogin>" & m00_public.pftplogin & "</vftplogin><vftpcode>" & m00_public.pFtpCode & "</vftpcode></upfile></soap12:Body></soap12:Envelope>"
upfile.PostString("http://" & m00_public.pIp & ":" & m00_public.pPortWeb & "/webpad.asmx", SOAP)
upfile.GetRequest.SetHeader("SOAPAction", "http://" & m00_public.pIp & ":" & m00_public.pPortWeb & "/webpad.asmx/upfile")
upfile.GetRequest.SetContentType("text/xml; charset=utf-8")
Last edited: