Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Object reference not set to an instance of an object
Message
 
À
17/02/2004 16:49:43
Information générale
Forum:
ASP.NET
Catégorie:
Web Services
Divers
Thread ID:
00878121
Message ID:
00878162
Vues:
17
My guess is that either loContext or loContext.Attachements is nothing.

>When I make a call to my Web Service, I have a message:
>
>Object reference not set to an instance of an object
>
>This is my import status:
>
>
>Imports System.Web.Services
>Imports System.IO
>Imports System.XML
>Imports Microsoft.Web.Services
>Imports Microsoft.Web.Services.Dime
>
>
>And, this is the method which is concerned:
>
>
>   <WebMethod()> _
>   Public Function UTDCDownloadFile(ByVal tnNumero As Integer) As String
>      '      Return Me.GetData("2," + tnNumero.ToString, 7)
>
>      ' Get the SoapContext for the response message
>      Dim loContext As SoapContext
>      loContext = HttpSoapContext.ResponseContext
>
>      ' Get the file name
>      Dim lcFile As String
>      lcFile = "D:\IIS\Universa\About1.jpg"
>
>      ' Create a new DIME attachment using the the file name and
>      ' specifying the encoding of the attachment using the MIME media type
>      Dim loDimeAttachment As DimeAttachment
>      loDimeAttachment = New DimeAttachment("image/jpeg", TypeFormatEnum.MediaType, lcFile)
>
>      ' Generate a GUID-based URI reference for the attachment object
>      ' and assign in to the ID property of the DIME record
>      loDimeAttachment.Id = "uri:" + Guid.NewGuid().ToString()
>
>      ' Add the new DimeAttachment object to the SoapContext object
>      loContext.Attachments.Add(loDimeAttachment)
>
>      ' Return the file name of the attachment
>      Return "About1.jpg"
>
>   End Function
>
>
>The error is reported on the line:
>
>
>      loContext.Attachments.Add(loDimeAttachment)
>
>
>Anyone knows what I am missing?
Hector Correa
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform