WCF REST Service save text file while hosting using Windows services - wcf

I wrote a small test WCF REST service using C#, within the WCF service, if it receive POST info from client, the WCF will collect the HTTP Request message from client and write it to a text file. I am using Stream to collect HTTP request and using StreamWriter to write it to a text file. I can specify any folder/path for the text file.
At this point, everything is working when I host the WCF REST service using a local console app.
However, I want to host the WCF service by using Windows service, the Windows service self is fine, it can be started/stoped no issue, my issue is, when client send HTTP POST request, the WCF suppose to create the text file but I can't see the text file. I tried to search the file on the PC, I could not find it, the text file actually never generated (in my view, Windows Service is not responsible to write the file, it is still WCF responsibility)
btw, the HTTP GET works from client (means the WCF Windows service works at least for GET).
any hints are much appreciated

Related

Calling WCF service method from browser?

Since i am new to WCF and Having configured a WCF service endpoint in IIS at Virtual Directory Api ( url goes like
http://localhost/api/taskapi.svc)
i was looking for ways to make request through web browser something like
http://localhost/api/taskapi.svc/GetCompleted
would respond with returnd data .I know this requires the binding of web service with the webHttpBinding but i don't know how to do it any help would be great ?
Use WCFSVGHoST application to test WCF applications. Application enables you to key-in parameters value and execute method of your interest.
Link for the same:
http://msdn.microsoft.com/en-us/library/bb552363.aspx

CXF Apache WSDL2Java set endpoint

In the beginning I have to warn that I'm not familar with web services, I want to simply generate what I need, and learn the basics of usage.
I recived .wsdl and .xsd files (stored localy). I have generated java code using Apache CXF WSDL2Java tool (I have generated a client). I also have an endpoint (as url without '?WSDL' on the end - whatever this endding means). How can I set this endpoint?
If I use:
Blachblach_Service ss = new Blachblach_Service(new URL(recived_url));
Blachblach port = ss.getBlachblachSOAP();
I get an exception. When I use soapUI to send XMLs to web services, everything works fine.
At first you need to initialize your web service client. See my answer over here how to make this work.
?WSDL ending means that you can see the web service WSDL file in your browser, you can access the web service through SOAP protocol by providing it with some valid request.
If you need to create your web service client using Spring. Here is very good example how to do this.
Yes usually we set params like end point URL on Service class object and retrieve port from it. and from port we invoke web service methods. can you please give details of exception you are getting?

WCF service Testing Tools sending *.xml file

I have valid *.xml files generated based on WCF service. I want to test the WCF service using the *.xml file. Currently, I have to programmatically load the *.xml file, initialise service object with *.xml file, and send the request.
Is there tool that avoids programming, and can test the WCF service.
The WCF Test Client is a great tool to test your services (and you already have it)
http://msdn.microsoft.com/en-us/library/bb552364.aspx
If you need something a little more flexible and powerful, check out Storm:
http://storm.codeplex.com/
With Storm you can manipulate the requests and trace out the interaction.
Of course you could always just use Fiddler to make your own web requests.

How to call local WCF service from webpage?

I'm developing a webpage that is supposed to consume WCF webserice that is located on client's computer. First, user installs some software that hosts WCF service on his computer, then he'll view my webpage which is supposed to call the WCF service. Do you have any idea how to do it without having to use AtiveX and IE?
Add your wcf service as service reference to your web project. You have to specify the url of your wcf service. A clientproxyclass will be generated for you. In your webpages or whathever you can create a instance of this proxyclass and just code what you want.

WCF Service calling another WCF service fails with web error 400 Bad Request

We have a web service that is called when user clicks save button on web form. The 'save' web service then makes a call into another web service (different machine). The call always fails and as far as I can tell does not even attempt to cross the network because the Fiddler traffic is empty. This problem only occurs when we call the second web service from the first web service. If we call the second web service straight from the client or on page load, it works. We are using WebHTTPBinding with REST type services.
I used the WCF trace to come up with the error 'Envelope Version 'EnvelopeNone (http://schemas.microsoft.com/ws/2005/05/envelope/none)' does not support adding Message Headers.', but I don't know how to resolve it.
Any suggestions?
Possible fixes:
Check #ServiceHost directive( in
. svc file) is set to
"WebServiceHostFactory" source
WebHttpBeahvior element is added in
the endpoint behavior source
Put ORDER information in the XML
schema Class source
Check that your Data Transfer objects are
serrializable source
Check if Skype installed and make sure it
doesn't overtake the port
source
Remove SOAP message header (it is not supported for REST
WCF) source