An error occurred when verifying security for the message

How can a .Net program access a WCF Service

Can someone provide with with an example

[92 byte] By [WVJohn] at [2008-1-2]
# 1

Your question is a bit too vague. If you mean how does a stand-alone application call a web service implemented in WCF follow the following steps and look at the samples in the Windows SDK.

1) Use the context menu on the "References" entry in your project to add a web reference.

2) In the dialog select the URL for your service and it will import the WSDL and create the client stub for the service named <service>Client.

3) The stub will have methods on it that let you call the web service operations on the service.

MichaelLatta at 2007-9-13 > top of Msdn Tech,Visual Studio Orcas,Windows Communication Foundation (Indigo)...
# 2
From my client I clicked on "Add Web Reference" and entered the HTTP address of the SOAP server. The screen (showing info returned to browser) displayed the following msg:

The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.

XML document must have a top level element. Error processing resource 'http://localhost:8080/InOut'.

The box on the upper right reported:

The document at the url http://localhost:8080/InOut was not recognized as a known document type.
The error message from each known type may help you fix the problem:
- Report from 'DISCO Document' is 'Root element is missing.'.
- Report from 'WSDL Document' is 'There is an error in XML document (0, 0).'.

Because of this, The "Add Reference" button is deactivated (greyed out)., and I am not allowed to proceed.

This happened because the SOAP server was pinged without a XML document. The tool just apparently pinged the SOAP server without any data.

Is there a way in which I can get around this.

Better yet, is there a way in which I can do this manually.

Could someone send me an example of an annotation of to reference a non-WCF SOAP server (how to reference the call with a servicecontract and an operation contract, and the necessary config code. Could someone please send me an example of such a client ?

WVJohn at 2007-9-13 > top of Msdn Tech,Visual Studio Orcas,Windows Communication Foundation (Indigo)...
# 3

You may have to do it form first principals , if it the service does not support retreiving the wsdl . This is more in the .NEt world anyway ( real programers code all XML and web services proxies by hand ;-) )

Please note i had the same issue with a WCF server that it crashed when there was an empty message so i changed the server . Supporting proxies is crtical unless you want to spend a month doing it from scratch.

You really need to get a hold of the wsdl of the server either as a file or sometimes you can go 'http://localhost:8080/InOut?wsdl ' this works on .NET asmx web services and WCF web services,

If you have the wsdl as a file you can use the wsdl.exe tool to create a proxy from it.

Regards,

Ben

BenK at 2007-9-13 > top of Msdn Tech,Visual Studio Orcas,Windows Communication Foundation (Indigo)...
# 4

What features does the service use - what binding, etc.

If you are using the wsHttpBinding then that uses features that the standard SOAP proxy (SoapHttpClientProtocol) doesn;t support - you will need to install WCF on the client machine - then you can use Add Service Reference rather than Add Web Reference.

Also, is the service serving metadata? RC1 of WCF removed the automatic generation of metadata by the service and this has to be enabled via a serviceMetadata behavior

Regards

Richard Blewett

RichardBlewett at 2007-9-13 > top of Msdn Tech,Visual Studio Orcas,Windows Communication Foundation (Indigo)...
# 6

Simple scenario: I want non-WCF clients (wsdl.exe-generated clients) to be able to call my WCF service, using username tokens. I've got my basicHttpBinding set up as follows:

<basicHttpBinding>
<
binding name="basicHttpBindingConfiguration">
<
security mode="TransportWithMessageCredential">
<transport />
<
message clientCredentialType="UserName"/>
</
security>
</
binding>

The WCF client works like a champ using hte basicHttpBinding. WSDL-based clients blow up with the "An error occurred when verifying security for the message" message. I am handling the ServicePointManager.ServerCertificateValidationCallback to handle my imperfect makecert-made certificate.

JasonToTheH at 2007-9-13 > top of Msdn Tech,Visual Studio Orcas,Windows Communication Foundation (Indigo)...
# 7
I am trying to use an ASP.Net application to communicate with a WCF service. I am able to reference the web service in my client. But when I invoke the WCF service, it just times out. I tried to consume the same service using a windows app and did not have any problems. Is there some configuration i am missing?

Abhishek

Abhishek172 at 2007-9-13 > top of Msdn Tech,Visual Studio Orcas,Windows Communication Foundation (Indigo)...
# 8
How I call WCF service from ASP.NET website ? Please tell me step-by-step because I cannot instantiate onject from .cs which generated from Svcutil.exe.
Petchtykun! at 2007-9-13 > top of Msdn Tech,Visual Studio Orcas,Windows Communication Foundation (Indigo)...
# 9

Hi Jason,

Do you need TransportWithMessageCredential ? most non WCF clients only support transport (https) as basic http binding is not WS compliant. This is the error you got... the client did not include the information. Pre WS there was no support for any authentication/user identification so i used to just put it in a SOAP header.

What clients are you trying to get up and running ? You mention wsdl is generating the proxy is this .NET1.0 , 2.0 , WSE or WCF . Only WSE and WCF support username authentication for web services.

Regards,

Ben

BenK at 2007-9-13 > top of Msdn Tech,Visual Studio Orcas,Windows Communication Foundation (Indigo)...
# 10

Hi Abhishek,

I am also trying to use an ASP.Net application to communicate with a WCF service. I am able to reference the web service in my client. But when I invoke the WCF service, it just times out.

Do you have the solution for this problem?

Thanks & Regards

Shweta

ShwetaPatel at 2007-9-13 > top of Msdn Tech,Visual Studio Orcas,Windows Communication Foundation (Indigo)...
# 11
I am not sure if you are having the same problem as I did some months ago. I was trying to make my web application to talk to my (WCF service) 3.0 web service the same way I used to make the web application talk to my 2.0 web service. This method works if your application is a windows application but does not work for a web application. But here is what I had to do to make it work:

1. Use svcutil.exe on the command line to create the web proxy file and the app.config file.

2. Rename the app.config file to web.config file.

3. Copy the web.config file into the Visual studio application.

4. Copy the web proxy file into the webreference folder in your application.

Let me know if that works.

Abhishek

Abhishek172 at 2007-9-13 > top of Msdn Tech,Visual Studio Orcas,Windows Communication Foundation (Indigo)...

Visual Studio Orcas

Site Classified