WCF Service using Request and Response

Please post public support tickets here. Note: for private support tickets, please send an email to support@cshtml5.com instead.
bhroberts52
Posts: 7
Joined: Wed Nov 25, 2015 5:56 pm
Location: Pittsburgh, PA, USA

WCF Service using Request and Response

Postby bhroberts52 » Mon Apr 18, 2016 8:01 am

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

bhroberts52
Posts: 7
Joined: Wed Nov 25, 2015 5:56 pm
Location: Pittsburgh, PA, USA

Re: WCF Service using Request and Response

Postby bhroberts52 » Mon Apr 18, 2016 10:14 am

I see how to do it now. Your ToDo sample project shows how to do it. Thanks.

hamej
Posts: 37
Joined: Thu Oct 01, 2015 8:41 am

Re: WCF Service using Request and Response

Postby hamej » Thu Apr 21, 2016 6:54 am

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?

bhroberts52
Posts: 7
Joined: Wed Nov 25, 2015 5:56 pm
Location: Pittsburgh, PA, USA

Re: WCF Service using Request and Response

Postby bhroberts52 » Thu Apr 21, 2016 7:16 am

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;

hamej
Posts: 37
Joined: Thu Oct 01, 2015 8:41 am

Re: WCF Service using Request and Response

Postby hamej » Thu Apr 21, 2016 7:47 am

Thank you for your answer. I am sorry the code was missing. Please see attached doc. Is different from, what you describe?
Attachments
2016-04-15 B DBReference request.zip
(10.2 KiB) Downloaded 394 times

bhroberts52
Posts: 7
Joined: Wed Nov 25, 2015 5:56 pm
Location: Pittsburgh, PA, USA

Re: WCF Service using Request and Response

Postby bhroberts52 » Thu Apr 21, 2016 8:19 am

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);

hamej
Posts: 37
Joined: Thu Oct 01, 2015 8:41 am

Re: WCF Service using Request and Response

Postby hamej » Fri Apr 22, 2016 3:28 am

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.

bhroberts52
Posts: 7
Joined: Wed Nov 25, 2015 5:56 pm
Location: Pittsburgh, PA, USA

Re: WCF Service using Request and Response

Postby bhroberts52 » Fri Apr 22, 2016 6:14 am

I'm sorry I can't help, since I am in the same boat as you for now.

rkmore
Posts: 55
Joined: Mon Dec 07, 2015 1:53 pm

Re: WCF Service using Request and Response

Postby rkmore » Sun Apr 24, 2016 11:26 am

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

bhroberts52
Posts: 7
Joined: Wed Nov 25, 2015 5:56 pm
Location: Pittsburgh, PA, USA

Re: WCF Service using Request and Response

Postby bhroberts52 » Mon Apr 25, 2016 8:12 am

I have written a more detailed explanation of the problem in the bug reports forum.


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 37 guests

 

 

cron