Page 1 of 1
WCF Service using Request and Response
Posted: Mon Apr 18, 2016 8:01 am
by bhroberts52
Hi
I have created a wcf service with one method that takes two string parameters and returns an object. I successfully created a service reference in my project. The service reference method, however, doesn't have the same signature as the wcf project. It is looking for a Request object as a parameter. I'm assuming in a callback I would get a Response object which I would convert to my object. But, I am not familiar with how to do this. Can you point me to an example of how to use the Request/Response pattern? (Or tell me what I should do to configure the service reference to create the method with the two string parameters returning the object directly.)
Thanks
Re: WCF Service using Request and Response
Posted: Mon Apr 18, 2016 10:14 am
by bhroberts52
I see how to do it now. Your ToDo sample project shows how to do it. Thanks.
Re: WCF Service using Request and Response
Posted: Thu Apr 21, 2016 6:54 am
by hamej
Could you be a little more specific? I assume you point to the WCF Soap sample? Where does this differ from my code shown in the attachment doc?
Re: WCF Service using Request and Response
Posted: Thu Apr 21, 2016 7:16 am
by bhroberts52
Hello hamej,
I do not see your attachment, but the way to do it is something like this given the WCF method is called MyMethod :
Code: Select all
var proxy = new Service1Client(...);
var response = await proxy.MyMethodAsync(new MyMethodRequest(new MyMethodRequestBody(param)));
return response.Body.MyMethodResult;
Re: WCF Service using Request and Response
Posted: Thu Apr 21, 2016 7:47 am
by hamej
Thank you for your answer. I am sorry the code was missing. Please see attached doc. Is different from, what you describe?
Re: WCF Service using Request and Response
Posted: Thu Apr 21, 2016 8:19 am
by bhroberts52
I'm not sure we on the same issue, but my call to the WCF service crashes if I assign the properties for the BasicHttpBinding:
Code: Select all
MaxReceivedMessageSize = 2147483647,
MaxBufferPoolSize = 524288,
MaxBufferSize = 2147483647
If that's what you having trouble with, try it with the defaults:
Code: Select all
var binding = new BasicHttpBinding(BasicHttpSecurityMode.None);
Re: WCF Service using Request and Response
Posted: Fri Apr 22, 2016 3:28 am
by hamej
No, that's not my problem. My problem is that, while running WCF requests in the simulator works fine, when I run it in browser (both IE and edge), it hangs forever in the WCF request - no matter if it is a direct call or an async call. I get no errror message, and I do have the call wrapped in a try-catch clause.
Re: WCF Service using Request and Response
Posted: Fri Apr 22, 2016 6:14 am
by bhroberts52
I'm sorry I can't help, since I am in the same boat as you for now.
Re: WCF Service using Request and Response
Posted: Sun Apr 24, 2016 11:26 am
by rkmore
So just a thought. Are you setting the origin policy on your server correctly? When you run from the browser directly off your file system this needs to be done.
If you are using a server on the same machine just disable cross origin checking during your testing.
If you are running on AZURE go to the "Configure" tab and scroll down to "Cross Origin Resource Sharing" and add your ISP's domain.
Alternatively use the "run from localhost" option in the debugger rather than running from the filesystem.
RKM
Re: WCF Service using Request and Response
Posted: Mon Apr 25, 2016 8:12 am
by bhroberts52
I have written a more detailed explanation of the problem in the bug reports forum.