Has anyone come across the problem where the ResponseSoapContext.Current is null? I have configured the WSE using the Visual Studio add-in and it has modified the web.config as follows:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="microsoft.web.services2" type="Microsoft.Web.Services2.Configuration.WebServicesConfiguration, Microsoft.Web.Services2, Version=2.0.0.0, Culture=neutral, PublicKeyToken1bf3856ad364e35" />
</configSections>
<system.web>
<webServices>
<soapExtensionTypes>
<add type="Microsoft.Web.Services2.WebServicesExtension, Microsoft.Web.Services2, Version=2.0.0.0, Culture=neutral, PublicKeyToken1bf3856ad364e35" priority="1" group="0" />
</soapExtensionTypes>
</webServices>
</system.web>
<microsoft.web.services2>
<diagnostics />
</microsoft.web.services2>
</configuration>
The code is quite simple. It just tries to add an attachment to the message:
private void AttachBinaryToResponse(string key, string completeBinPath){
SoapContext respContext = ResponseSoapContext.Current; // Comes back as null.
DimeAttachment dimeAttach = new DimeAttachment(key, "applications/octet-stream", TypeFormat.AbsoluteUri, completeBinPath);
// And because SoapContext is null this of course throws an exception:
// Object reference not set to an instance of an object.
respContext.Attachments.Add(dimeAttach);
}
Any tips greatly appreciated.
Thanks,
Sam

Signature
_______________________________
Sam Santiago
ssantiago@n0spam-SoftiTechture.com
http://www.SoftiTechture.com
_______________________________
Sam Santiago - 17 Feb 2005 08:08 GMT
Never mind ;-). I was trying a quick test from the web page Visual Studio generates with the service methods, so apparently no SoapContext is present. After I wrote a small tester client that derived the generated proxy class from the WebServicesClientProtocol class and invoked the method all worked as anticipated.
Thanks,
Sam
Has anyone come across the problem where the ResponseSoapContext.Current is null? I have configured the WSE using the Visual Studio add-in and it has modified the web.config as follows:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="microsoft.web.services2" type="Microsoft.Web.Services2.Configuration.WebServicesConfiguration, Microsoft.Web.Services2, Version=2.0.0.0, Culture=neutral, PublicKeyToken1bf3856ad364e35" />
</configSections>
<system.web>
<webServices>
<soapExtensionTypes>
<add type="Microsoft.Web.Services2.WebServicesExtension, Microsoft.Web.Services2, Version=2.0.0.0, Culture=neutral, PublicKeyToken1bf3856ad364e35" priority="1" group="0" />
</soapExtensionTypes>
</webServices>
</system.web>
<microsoft.web.services2>
<diagnostics />
</microsoft.web.services2>
</configuration>
The code is quite simple. It just tries to add an attachment to the message:
private void AttachBinaryToResponse(string key, string completeBinPath){
SoapContext respContext = ResponseSoapContext.Current; // Comes back as null.
DimeAttachment dimeAttach = new DimeAttachment(key, "applications/octet-stream", TypeFormat.AbsoluteUri, completeBinPath);
// And because SoapContext is null this of course throws an exception:
// Object reference not set to an instance of an object.
respContext.Attachments.Add(dimeAttach);
}
Any tips greatly appreciated.
Thanks,
Sam
--
_______________________________
Sam Santiago
ssantiago@n0spam-SoftiTechture.com
http://www.SoftiTechture.com
_______________________________