473,386 Members | 1,943 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,386 software developers and data experts.

Web Service Over Https + x.509 Certificate(RequestSoapContext.Current = null)

Hi

I am doing application for signing of soap message with digital certificate . I am using WSE 2.0

I worte the the simple webservice & deployed it on in our server machine . To make it secured i added the certificate to IIS .

My web service code like this.



[WebMethod]
public int Add (int Num1 ,int Num2 )
{
int total=0;
SoapContext soapCntxt = RequestSoapContext.Current;

if (soapCntxt==null)
throw new Exception("Only SOAP requests are permitted.");

foreach(SecurityToken token in soapCntxt.Security.Tokens)
{
if(token is X509SecurityToken )
{
X509SecurityToken objSecurityToken = (X509SecurityToken)token;
if(objSecurityToken.Certificate.FriendlyDisplayNam e == "www.capsilon.com" )
{
total= Num1+Num2;
}
}
}
return total;
}//End Of WebMethod Add





when i am accessing the web service on client machine it show's the certificate in the browser. I deployed that certificate on my m/c in personal store & corresponding certificate in Trust store to make handshake proper.



I have done all the configuration with my client code.I make my proxy class inheritaed from Microsoft.Web.Services2.WebServicesClientProtocol

My client code looks like this.



WebReference.Service1 objProxy = new WebReference.Service1();

X509SecurityToken token = null;

token = AppBase.GetClientToken(true);

if (token == null)
throw new ApplicationException("Unable to obtain security token.");

objProxy.RequestSoapContext.Security.Tokens.Add(to ken); //Old Changes
objProxy.RequestSoapContext.Security.Elements.Add( new MessageSignature(token));


objProxy.Timeout = 2250000;
objProxy.Destination = new Microsoft.Web.Services2.Addressing.EndpointReferen ce(new Uri("http://192.168.42.23/SSLWebService/Service1.asmx"));


int strReturn = objProxy.Add(5, 10);

MessageBox.Show(strReturn.ToString());



When I make a call to webservice method , I am checking the RequestSoapContext.current it is getting null so i am throwing my own exception

also in my client program i am viewign the content of requesstSoapContext , i am getting Enevelop as null .



but at the call of method i am getting following Exception.

System.Web.Services.Protocols.SoapException: Server was unable to process request. --> Only SOAP requests are permitted.
at System.Web.Services.Protocols.SoapHttpClientProtoc ol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtoc ol.Invoke(String methodName, Object[] parameters)
at SMARTDocUploadClient.WebReference.Service1.Add(Int 32 Num1, Int32 Num2) in D:\DDTClient\SMARTDocUploadClient\Web References\WebReference\Reference.cs:line 79
at SMARTDocUploadClient.Form1.button1_Click(Object sender, EventArgs e) in D:\DDTClient\SMARTDocUploadClient\Form1.cs:line 340

Can any One help me Out as early as possible

Plese Provide Me the Solution

If any one need more details please send me mail to get details or If you are not getting the problem

Thanks & Regards

Vaibhav Chavan.
Nov 16 '07 #1
1 3560
Plater
7,872 Expert 4TB
I don't know much about https or soap, but I do know that changing computers (or even just it's name) usually invalidates the certificate.
Maybe it's gone invalid and now it won't accept your requests (defaults to only pure soap requests?)
Nov 16 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Aung | last post by:
Has anybody develop RFC1950 and RFC1951 compliant Zip utility? Any pointer will be appreciated.
3
by: John Spiegel | last post by:
Hi all, I'm working through some examples using VS2003 and the classic airport weather web service. Current topic is creating a proxy class for a web service but the wsdl.exe tool is including...
4
by: Ben Bloom | last post by:
How do I access a file in the current directory? If my web service runs Directory.GetCurrentDirectory() I get c:\winnt\system32
5
by: Buddy Ackerman | last post by:
My app is a .NET forms app that runs in the taskbar and periodically polls a web service. I have a client that wants the app to integrate with their Active Directory. They do not want the user to...
5
by: Nate | last post by:
We are attempting to make a request to a web service (we will refer to it as XXXServices) hosted on a Web Logic server from a C# SOAP client. The server responds with a 401 Unauthorized error...
0
by: Sanjaya | last post by:
Hi, I need to add application specific headers and reference parameter in the "ReplyTo" to my web service request as header elements. What is right way to do this? I'm using framework 1.1 with...
0
by: NoaGross | last post by:
Hi, I'm relly new in java and I have a problem. I'm using java applet. When using http all ok, but when trying to use https i get: Java Plug-in 1.5.0_10 Using JRE version 1.5.0_10 Java...
1
by: mike | last post by:
I am trying to implement FtpWebRequest with EnableSsl = true. The WS_FTP server has our VeriSign Server Certificate installed and with the WS_FTP Pro client am able to connect. However, with...
4
by: dgilbert | last post by:
I have a custom membership provider that I am using to authenticate users in a WCF web service hosted IIS. I want to be able to see any cookies that come across and save session variables, but I...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...

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.