Re: Attachments.Add - Object reference not set to an instance of an object.



I have got this figured out now. Evidently, when you run client and
webservice projects in a signle solution, Visual Studio does not create the
proxy. I removed the webservice project and instead added a reference to the
webservice to the client project; Voila! Visual Studio created the proxy
class for me. Of course, I still had to tweak the proxy class, but getting
the proxy class created was 90% of the solution.

- Joe Geretz -

"Joseph Geretz" <jgeretz@xxxxxxxxxx> wrote in message
news:eL6YnIyrFHA.2008@xxxxxxxxxxxxxxxxxxxxxxx
> Here's my first attempt at DIME (code below signature). I'ts basically
> straight out of Microsoft's online sample:
>
> For some reason, the statement
>
> respContext.Attachments.Add(dimeAttach);
>
> trips the following error:
>
> Object reference not set to an instance of an object.
>
> I've seen some of the solutions to this problem but they don't seem to
> apply. I've gone to Project | Right Click | WSE 2.0 | General and
> confirmed that both Enable this project for Web Service Enhancements and
> Enable Microsoft Web Service Enhancement SOAP Extension are checked.
> (Actually, I did not set these explicitly. I simply added a reference to
> Microsoft.Web.Services2 from C:\Program Files\Microsoft
> WSE\v2.0\Microsoft.Web.Services2.dll. Subsequently when diagnosing this
> problem, I came across this dialog and saw that these options were both
> enabled.
>
> Inspiration! A minimum of debugging shows that immediately after executing
>
> SoapContext respContext = ResponseSoapContext.Current;
>
> respContext shows up as <undefined value>
>
> I'm testing this function through the default Web Page which is provided
> as a test for Web Services. Can DIME be tested via a Browser request? Or
> do I actually have to build a software client to test this?
>
> Thanks for any help you can provide!
>
> - Joe Geretz -
>
> [WebMethod]
> public int DropDIMEOnMe(string FileSpec)
> {
> SoapContext respContext = ResponseSoapContext.Current;
> DimeAttachment dimeAttach = new DimeAttachment("file/unknown",
> TypeFormat.MediaType, FileSpec);
> respContext.Attachments.Add(dimeAttach);
> return respContext.Attachments.Count;
> }
>


.



Relevant Pages

  • RE: SOAP .Net client wrapper questions
    ... on the client side or the web service side? ... for the web service and that didn't produce any result. ... automatic Proxy setting detection, and that seems like it might be involved. ... Microsoft MSDN Online Support Lead ...
    (microsoft.public.dotnet.framework.webservices)
  • 1st invocation of Web Service from client is very slow - solution?
    ... people complaining that 1st invocation of a Web Service can be very ... writing the client proxy yourself). ... remote methods do not change signature, and get the proxy to compile ...
    (microsoft.public.dotnet.framework.webservices)
  • XsdObjectGen classes in Web Service Client Proxy
    ... Does anyone know how I can get a web service client proxy to use classes ... class and not the more user-friendly XsdObjectGen class. ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Re: Windows Client using Generated WS Proxy
    ... > The solution I used was to generate one proxy using the tool and then I ... > we had very good designs on our webservices before we started client side ... >> that represent the data that goes to and from the web service. ... the typical sort of thing is a Customer or an Account. ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • RE: Windows Client using Generated WS Proxy
    ... The solution I used was to generate one proxy using the tool and then I ... > How many people are using a windows client to talk to their web service? ... > that represent the data that goes to and from the web service. ... the typical sort of thing is a Customer or an Account. ...
    (microsoft.public.dotnet.framework.aspnet.webservices)