473,326 Members | 2,136 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

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

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;
}
Nov 23 '05 #1
5 4834
It was a nice thought, but no dice.
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?
I built a software client to test this. When stepping through this line of
code in the IDE

SoapContext respContext = ResponseSoapContext.Current;

ResponseSoapContext.Current evaluates to <undefined value>. Naturally, this
value is passed along to respContext.

Obviously, I'm not going to get very far until I can get ahold of a valid
ResponseSoapContext. What am I missing?

Thanks for your help!

- Joe Geretz -

"Joseph Geretz" <jg*****@nospam.com> wrote in message
news:eL**************@TK2MSFTNGP10.phx.gbl... 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;
}

Nov 23 '05 #2
Maybe something wrong with my Web.Config file (included below)? For some
reason the ASP.NET runtime isn't providing my Web Service with a
ResponseSoapContext reference. Why not?

Thanks for your help,

- Joe Geretz -

<?xml version="1.0" encoding="utf-8"?>
<configuration>

<configSections>
<section name="microsoft.web.services2"
type="Microsoft.Web.Services2.Configuration.WebSer vicesConfiguration,
Microsoft.Web.Services2, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" />
</configSections>

<system.web>
<webServices>
<soapExtensionTypes>
<add type="Microsoft.Web.Services2.WebServicesExtension ,
Microsoft.Web.Services2, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35" priority="1" group="0" />
</soapExtensionTypes>
</webServices>
</system.web>

<microsoft.web.services2>
<diagnostics>
<detailedErrors enabled="true" />
</diagnostics>
</microsoft.web.services2>

<compilation defaultLanguage="c#" debug="true" />
<customErrors mode="RemoteOnly" />
<authentication mode="Windows" />
<identity impersonate="true" userName="" password="" />
<authorization>
<allow users="*" />
</authorization>
<trace enabled="false" requestLimit="10" pageOutput="false"
traceMode="SortByTime" localOnly="true" />
<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
cookieless="false" timeout="20" />
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />

</configuration>

"Joseph Geretz" <jg*****@nospam.com> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
It was a nice thought, but no dice.
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?


I built a software client to test this. When stepping through this line of
code in the IDE

SoapContext respContext = ResponseSoapContext.Current;

ResponseSoapContext.Current evaluates to <undefined value>. Naturally,
this value is passed along to respContext.

Obviously, I'm not going to get very far until I can get ahold of a valid
ResponseSoapContext. What am I missing?

Thanks for your help!

- Joe Geretz -

"Joseph Geretz" <jg*****@nospam.com> wrote in message
news:eL**************@TK2MSFTNGP10.phx.gbl...
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;
}


Nov 23 '05 #3
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" <jg*****@nospam.com> wrote in message
news:eL**************@TK2MSFTNGP10.phx.gbl...
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;
}

Nov 23 '05 #4
Joseph Geretz wrote:
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;
}


if you test the web service from the browser the ResponseContext is
always null. the best way to test is making a test application. you do
have to build a client.
Nov 23 '05 #5
Joseph Geretz wrote:
It was a nice thought, but no dice.
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?


I built a software client to test this. When stepping through this line of
code in the IDE

SoapContext respContext = ResponseSoapContext.Current;

ResponseSoapContext.Current evaluates to <undefined value>. Naturally, this
value is passed along to respContext.

Obviously, I'm not going to get very far until I can get ahold of a valid
ResponseSoapContext. What am I missing?

Thanks for your help!

- Joe Geretz -

"Joseph Geretz" <jg*****@nospam.com> wrote in message
news:eL**************@TK2MSFTNGP10.phx.gbl...
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;
}


i don't know if this is you're problem, but you have to remember that if
you are sending a file from the Client application you have to use the
RequestSoapContext.Current from the proxy. And on the Web Service you
use the ResponseSoapContext.Current property.

So it would be something like this:
Client:

<code>

WebbService proxy = new WebService();
SoapContext ctx = proxy.RequestSoapContext.Current;

/* build attach here */

ctx.Attachments.Add (attach);
proxy.MethodCall();

</code>

WebService:

<code>

public void MethodCall()
{
SoapContext ctx = RequestSoapContext.Current;
DimeAttachment = ctx.Attachments[0];
...
}
</code>
Another thing is you have to verify in the client if the proxy class
derives from Microsoft.Web.Services2.WebServicesClientProtocol.
Otherwise you wont have access to the SoapContext
Nov 23 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Levi Wilson | last post by:
I have a web service that adds a DIME attachment: public void GetFile(string filename) { SoapContext sc = HttpSoapContext.ResponseContext; DimeAttachment dimeFile = new...
4
by: Scott, Killer of all Ninjas | last post by:
It seems incredulous to me that it is so difficult to write the contents of a memory stream to a file. I'm certain that I'm missing something simple. I am retrieving a memory stream from a DIME...
3
by: Vai2000 | last post by:
Thanks for all responses Please advice! Hi All, Clients are uploading large files to my Web Portal. I need to validate these files using a WS. Problem is file sizes are in the range of...
2
by: Bernard D | last post by:
Someone here wrote that MS has dropped its commitment to DIME (see link below). I could not find any other info on this from googling around. Has MS made this public anywhere? Links would be...
0
by: Ero | last post by:
Hello, I have a simple webmethod to send Dime attachments using WSE 2 : public void CreateDimedImage() {
0
by: Niklas | last post by:
Hi I have no problem downloading an image with Web Services Enhancements and the DIME specification, but how do I dowwnload an application? Regards /Niklas Web service: <WebMethod()> _...
3
by: Ipsita | last post by:
Hi! I am trying SOAP with DIME attachments in web services. For example say, I have a file resume.pdf stored somewhere on my server. How does the web service send the file to the client, so that...
1
by: Ipsita | last post by:
Hi! I am trying SOAP with DIME attachments in web services. The web service sends the file as attachment say "test.doc", and the client has to read that and populate it in a textbox control. I...
1
by: Matt B | last post by:
Hi all, This problem is close to driving me insane. Basically, I'm trying to use DIME to add an attachment to a SOAP message and send it to the web server. The WSE 2.0 toolkit is installed,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.