Callign these services...

Topics: General Discussion Forum, July and December Releases Forum
Feb 11, 2008 at 2:25 PM
I have created a WCF Services using the webservice software factory december 2006 release, how can i use it in the website which i am goign to make...
whether i have to create new solution or can i use the same solution which is used to create the WCF services.
What is the procedure i have to follow...?

Can anybody help me regarding this issue ?

Thanks and Regards
Nimesh Prabhakar
Feb 11, 2008 at 3:29 PM
Fist one quick suggestion about WSSF version. You may try using version 3 (Nov-2007) that gives you all the new "Modeling" features provided by DSL.
Regarding the usage, you can use your already created solution as described here:
Feb 18, 2008 at 8:03 AM

Hi Charly,
I have created a WCF service using WSSF Dec-2006 release, here i would like to call this service from my websites, page namely Default.aspx.

for that purpose i add web service reference, by giving the path http://localhost:XXXX/HelloWorld.Host/HelloWorld.svc?wsdl

From the Default.aspx page, i tried to call it using the mentioned codes to diaply it in a label,

HelloWorldService.HelloWorld proxy = new HelloWorldService.HelloWorld();
label.text= proxy.Operation("hai CF");

Here, HelloWorldService si my Service Reference,
HelloWorld is my service contract
Operation is my Opration Contract.

While i am viewing the default.aspx page in the browser, i am getting an exception call THE OPERATION HAS TIMED OUT.
do either of one
1. add debug=true here, <%@ServiceHost language="c#" Debug="true" Service="HelloWorld.ServiceImplementation.HelloWorld" %>
2. <system.web>
<compilation debug="true"/>

even though its added here, but its showing an error like this....

What i have to do inorder to solve this ? Whether my codes are correct or not ? if no, what i have tio modify....

Feb 18, 2008 at 11:21 AM
Did you check that your WS host is up and running? I seems that your service host is not responding (may be is down or hang for some reason).
You can also cross check that your service URL is right, checking you web.config file in the appropiate url variable name.
Feb 18, 2008 at 12:15 PM
Edited Feb 18, 2008 at 12:34 PM

Hi cf,
I checked my service url, it seems to be correct...
while viewing in browser, i get following...

World Service-------------------------> here this is my service name
You have created a service.
To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax:
svcutil.exe http://localhost:1994/HelloWorld.Host/World.svc?wsdl

Before goign into depth, let me tell what i have done so far,
To understand the working of webservices, i have created a small wcf project using wssf.
1>>>> i created a service contract named world, in which operations are NewOperation.
from the website i have to pass a string God through proxy.
2>>>> i exposed the service, world.svc file generated.
3>>>> then i created a website, named newclient.
4>>>> After that i have to add web service reference, right clicked the website solution and add webservice reference.
5>>>> then i could see a wizard,

Start Browsing for Web Services
Use this page as a starting point to find Web services. You can click the links below, or type a known URL into the address bar.

*Browse to:
Web services in this solution
Web services on the local machine
Browse UDDI Servers on the local network *

6>>> i clicked the first option which results in ....<<<None - No Web services were found in the current solution. >>>
7>>> then i copied the URL ,clciked Go button
8>>> it shows the method on the left hand side, i click add reference by giving the name as webHello, inside the webHello folder in the solution i could see 4 files generating.
9>> aftr that i started coding in mu default.aspx page.

codes are given below :

public partial class _Default : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
webHello.World proxy = new webHello.World();
Label1.Text = proxy.NewOperation("GOD");


while viewing the particular aspx page, it is taking a lot of time to load, and will throw an error as such ;;;;

Server Error in '/NewClient' Application.

The operation has timed out
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.WebException: The operation has timed out

Source Error:

The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:

1. Add a "Debug=true" directive at the top of the file that generated the error. Example:

<%@ Page Language="C#" Debug="true" %>


2) Add the following section to the configuration file of your application:

<compilation debug="true"/>

Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.

Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.

Stack Trace:

WebException: The operation has timed out
System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request) +54
System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request) +5
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +173
webHello.World.NewOperation(String request) +47
Default.PageLoad(Object sender, EventArgs e) +43
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +13
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +45
System.Web.UI.Control.OnLoad(EventArgs e) +80
System.Web.UI.Control.LoadRecursive() +49
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3743

i have made above changes,
but after that i am getting an error :

*return: System.Xml.Serialization.XmlElementAttribute(IsNullable=true)
Line 51: public string NewOperation(System.Xml.Serialization.XmlElementAttribute(IsNullable=true) string request) {
Line 52: object[] results = this.Invoke("NewOperation", new object[] {
Line 53: request});
Line 54: return ((string)(results0));*




Feb 18, 2008 at 3:54 PM

Since you are using WSSF (Dec-2006) version (not the latest Nov-2007) the client proxy that generate the package is only for winforms apps. However, you can overcome that limitation and run that recipe with against a WinForm app and grab the generatd file and app.config and copy that to your web app. The other option is to use the latest WSSF ME (Nov2007) version and generate the proxy from the tool (read my first post in this thread).
Your current problem is related to the way you are creating the proxy (ASMX client) that calls a WCF service. In that scenario you should create the client with the cmd tool:

svcutil.exe http://localhost:1994/HelloWorld.Host/World.svc?wsdl
That will generate your proxy types (.cs file) and the app.config file that you can paste into your web.config file. After that you only need to add the references to WCF API like System.ServiceModel and System.Runtime.Serialization.

Feb 18, 2008 at 4:55 PM
Edited Feb 18, 2008 at 5:00 PM
Thanks a lot for this reply..
also i would like to clarify one more thing,
i run that command in cmd prompt...

svcutil.exe http://localhost:2759/AfterTesting.Host/OhWorld.svc?wsdl

it generates 2 files one is .cs and output.xml file...
so i pasted all the contents of output file to web config file of my web application.
how can we call this service from the web appliaction...
wheather i have to add proxy for that.... ?

How to add the references to WCF API ?
i really want a help regarding this issue...
Hope u can help me...


Feb 19, 2008 at 12:54 PM
You can also run svcutil with a switch that will merge the required WCF config section and your current web.config so you don't need to do it yourself. Then after adding the generated proxy classes, you simply reference your client proxy class from your web app with something like this:

using (localhost.Service1 proxy = new localhost.Service1())
     string result = proxy.Operation1();

And that should do the work.

Feb 19, 2008 at 2:39 PM
Edited Feb 19, 2008 at 2:43 PM
I was waiting for your reply,
Thanks a lot for your response...

i would like to know the difference between WSSF and WCSF, whether we have to use WCSF while creating service with WSSF ?

How can we merge wcf config section and my current webconfig....

Feb 19, 2008 at 4:08 PM
With WCSF you may build web apps in an extensible fashion with pluggable modules and page flow patterns (among other things) and you can also call services where you may use WSSF to create them.

Regarding the merge using svcutil, you can use something like:

svcutil.exe http://localhost:2759/AfterTesting.Host/OhWorld.svc?wsdl /config:web.config /mergeConfig
Feb 20, 2008 at 7:09 AM
Edited Feb 22, 2008 at 8:09 AM
Even though i did all the steps as per your guidance, but i am getting an error like this :

The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate,NTLM'.

i have checked both anonymous and INtegrated windows authentication in the IIS Properties. I tried hosting the service on another system and tried to add reference for that particular Service. But i am facing this error...

Do you have anys sugestion for this error.. Totali i am stuck up with this error...

i would like to know another one factor... from where can we get the svcutil, what we have to install more to get svcutil. While typing in other system i am getting a message like this:

svcutil is not recognized as an internal command,.............

Hope you can help me regarding this issues.... please reply
Note : I think i have posted this in other threads...
But as i gt the reply for thread 22454. i am continuing my buggs in this thread...