473,769 Members | 6,799 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Att achments.Add(di meAttach);

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.S ervices2 from C:\Program Files\Microsoft
WSE\v2.0\Micros oft.Web.Service s2.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 = ResponseSoapCon text.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(st ring FileSpec)
{
SoapContext respContext = ResponseSoapCon text.Current;
DimeAttachment dimeAttach = new DimeAttachment( "file/unknown",
TypeFormat.Medi aType, FileSpec);
respContext.Att achments.Add(di meAttach);
return respContext.Att achments.Count;
}
Nov 23 '05 #1
5 4877
It was a nice thought, but no dice.
Inspiration! A minimum of debugging shows that immediately after executing

SoapContext respContext = ResponseSoapCon text.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 = ResponseSoapCon text.Current;

ResponseSoapCon text.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
ResponseSoapCon text. What am I missing?

Thanks for your help!

- Joe Geretz -

"Joseph Geretz" <jg*****@nospam .com> wrote in message
news:eL******** ******@TK2MSFTN GP10.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.Att achments.Add(di meAttach);

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.S ervices2 from C:\Program Files\Microsoft
WSE\v2.0\Micros oft.Web.Service s2.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 = ResponseSoapCon text.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(st ring FileSpec)
{
SoapContext respContext = ResponseSoapCon text.Current;
DimeAttachment dimeAttach = new DimeAttachment( "file/unknown",
TypeFormat.Medi aType, FileSpec);
respContext.Att achments.Add(di meAttach);
return respContext.Att achments.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
ResponseSoapCon text reference. Why not?

Thanks for your help,

- Joe Geretz -

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

<configSections >
<section name="microsoft .web.services2"
type="Microsoft .Web.Services2. Configuration.W ebServicesConfi guration,
Microsoft.Web.S ervices2, Version=2.0.0.0 , Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5" />
</configSections>

<system.web>
<webServices>
<soapExtensionT ypes>
<add type="Microsoft .Web.Services2. WebServicesExte nsion,
Microsoft.Web.S ervices2, Version=2.0.0.0 , Culture=neutral ,
PublicKeyToken= 31bf3856ad364e3 5" priority="1" group="0" />
</soapExtensionTy pes>
</webServices>
</system.web>

<microsoft.web. services2>
<diagnostics>
<detailedErro rs enabled="true" />
</diagnostics>
</microsoft.web.s ervices2>

<compilation defaultLanguage ="c#" debug="true" />
<customErrors mode="RemoteOnl y" />
<authenticati on mode="Windows" />
<identity impersonate="tr ue" userName="" password="" />
<authorizatio n>
<allow users="*" />
</authorization>
<trace enabled="false" requestLimit="1 0" pageOutput="fal se"
traceMode="Sort ByTime" localOnly="true " />
<sessionState mode="InProc" stateConnection String="tcpip=1 27.0.0.1:42424"
sqlConnectionSt ring="data source=127.0.0. 1;Trusted_Conne ction=yes"
cookieless="fal se" timeout="20" />
<globalizatio n requestEncoding ="utf-8" responseEncodin g="utf-8" />

</configuration>

"Joseph Geretz" <jg*****@nospam .com> wrote in message
news:%2******** **********@TK2M SFTNGP09.phx.gb l...
It was a nice thought, but no dice.
Inspiration! A minimum of debugging shows that immediately after
executing

SoapContext respContext = ResponseSoapCon text.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 = ResponseSoapCon text.Current;

ResponseSoapCon text.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
ResponseSoapCon text. What am I missing?

Thanks for your help!

- Joe Geretz -

"Joseph Geretz" <jg*****@nospam .com> wrote in message
news:eL******** ******@TK2MSFTN GP10.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.Att achments.Add(di meAttach);

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.S ervices2 from C:\Program Files\Microsoft
WSE\v2.0\Micros oft.Web.Service s2.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 = ResponseSoapCon text.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(st ring FileSpec)
{
SoapContext respContext = ResponseSoapCon text.Current;
DimeAttachment dimeAttach = new DimeAttachment( "file/unknown",
TypeFormat.Medi aType, FileSpec);
respContext.Att achments.Add(di meAttach);
return respContext.Att achments.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******** ******@TK2MSFTN GP10.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.Att achments.Add(di meAttach);

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.S ervices2 from C:\Program Files\Microsoft
WSE\v2.0\Micros oft.Web.Service s2.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 = ResponseSoapCon text.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(st ring FileSpec)
{
SoapContext respContext = ResponseSoapCon text.Current;
DimeAttachment dimeAttach = new DimeAttachment( "file/unknown",
TypeFormat.Medi aType, FileSpec);
respContext.Att achments.Add(di meAttach);
return respContext.Att achments.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.Att achments.Add(di meAttach);

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.S ervices2 from C:\Program Files\Microsoft
WSE\v2.0\Micros oft.Web.Service s2.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 = ResponseSoapCon text.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(st ring FileSpec)
{
SoapContext respContext = ResponseSoapCon text.Current;
DimeAttachment dimeAttach = new DimeAttachment( "file/unknown",
TypeFormat.Medi aType, FileSpec);
respContext.Att achments.Add(di meAttach);
return respContext.Att achments.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 = ResponseSoapCon text.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 = ResponseSoapCon text.Current;

ResponseSoapCon text.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
ResponseSoapCon text. What am I missing?

Thanks for your help!

- Joe Geretz -

"Joseph Geretz" <jg*****@nospam .com> wrote in message
news:eL******** ******@TK2MSFTN GP10.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.Att achments.Add(di meAttach);

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.S ervices2 from C:\Program Files\Microsoft
WSE\v2.0\Micros oft.Web.Service s2.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 = ResponseSoapCon text.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(st ring FileSpec)
{
SoapContext respContext = ResponseSoapCon text.Current;
DimeAttachment dimeAttach = new DimeAttachment( "file/unknown",
TypeFormat.Medi aType, FileSpec);
respContext.Att achments.Add(di meAttach);
return respContext.Att achments.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
RequestSoapCont ext.Current from the proxy. And on the Web Service you
use the ResponseSoapCon text.Current property.

So it would be something like this:
Client:

<code>

WebbService proxy = new WebService();
SoapContext ctx = proxy.RequestSo apContext.Curre nt;

/* build attach here */

ctx.Attachments .Add (attach);
proxy.MethodCal l();

</code>

WebService:

<code>

public void MethodCall()
{
SoapContext ctx = RequestSoapCont ext.Current;
DimeAttachment = ctx.Attachments[0];
...
}
</code>
Another thing is you have to verify in the client if the proxy class
derives from Microsoft.Web.S ervices2.WebSer vicesClientProt ocol.
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
1988
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 DimeAttachment("application/DIME", TypeFormatEnum.MediaType, @"c:\temp\" + filename); sc.Attachments.Add(dimeFile);
4
6385
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 attachment: MyDimeService svc = new MyDimeService(); svc.CreateDimedImage(); if (svc.ResponseSoapContext.Attachments.Count == 1) {
3
3607
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 5-20MB!!!! Q1. How do I send DIME attachments to the WebSvc from my Portal?
2
2155
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 appreaciated. And, if DIME is to be dropped, what will be used instead for file attachments with SOAP? I know about encoding everything in base64 but this is a very inneficient method for large attachments. ...
0
1077
by: Ero | last post by:
Hello, I have a simple webmethod to send Dime attachments using WSE 2 : public void CreateDimedImage() {
0
955
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()> _ Public Sub CreateDimedApplication(ByVal FileName As String)
3
5108
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 the client can store it and also read from it. I am trying out with C# and ASP.NET. Server Side Web Method: -----------------------
1
2447
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 had asked this question earlier, and got the reply that the data is tranferred in binary format on the wire. I read the stream, and convert it to string, but I get some junk characters in my textbox. I am writing my code below, so that you can see...
1
2195
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, which allows for DIME to be used and everything is set up correctly as far as I know. My code is:
0
9590
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9424
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10051
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8879
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3968
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3571
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.