WebReference vs ServiceReference - wcf

I have to following problem. In my application I used a service reference to a non-WCF service from some external company. I created a proxy class using svcutil.exe tool. Everything worked fine for about a year.
Yesterday however, clients reported that it's not possible to get any response from the service. I figured out that the error returned from the service was:
The formatter threw an exception while
trying to deserialize the message:
There was an error while trying to
deserialize parameter
http://serviceurl:someResponse. The
InnerException message was 'There was
an error deserializing the object of
type specificType
So, what I did I firstly updated the service reference and also generated the new proxy using svcutil.exe. The problem still occurs.
I resolve the problem by using either 1) wsdl.exe tool to generate proxy class 2) add web reference (which behind the scenes using wsdl.exe tool internally to create proxy).
My question is : Why everything worked fine for a quite long time even if I used a service reference? How can I checked whether has something changed in the web service? Any help would be appreciated.

Contact the company that provides the web service and find out what changed.

Related

Unable to add Java service reference to WCF client

I am uanble to add the below Java service reference in WCF Client
https://filetransfer.nordea.com/services/CorporateFileService
getting below error .
There was an error downloading 'https://filetransfer.nordea.com/services/CorporateFileService/$metadata'. The request failed with the error:
I opened the port 8000. still getting same issue.
Please let me know what is the issue.
Thanks
Jaya
Please note that a WCF service normally expose a file called a WSDL(Web Services Description Language) - this file explains the methods that you will use with the service
https://www.w3.org/TR/2001/NOTE-wsdl-20010315
Normally an endpoint needs to be created and be accessible for ypu to be able to view the service, what I would suggest is that if WCF doesnt seem to be doing that for you, try adding the service as a webservice Reference in your C#/Java project.
https://www.blackbaud.com/files/support/guides/infinitydevguide/Subsystems/infGC-developer-help/Content/AddingWebReference.htm

Workflow WCF Service - Can't call from application - The request object expects an argument that I can't identify

I have created a WCF service using Workflow. It works just fine. I created another Workflow application to consume it. I added the service reference to the application project and rebuilt the project. I added the component from the service to the app, but it's expecting an argument that I never specified.
I've tried rebuilding both the service and the app, generating an entirely new solution and starting from scratch - same problem. I've looked at others' code and they've structured this project the same as mine but this issue does not show up on theirs. Googling this problem seems to bring up not results.
My workflow service is defined as such: https://i.imgur.com/E8mEfs6.png
The parameters of the receive component are: https://i.imgur.com/TaNRw2y.png
But when I add it to my app, the parameters are defined as: https://i.imgur.com/tqgEwNr.png
Which is not what I had defined in my service. I can't even figure out what it wants me to pass in for _GetCityStateFromZip. It says the type is InArgument.
I was expecting it to be expecting the zipcode parameter as I specified in the service. I think I might be adding the service reference incorrectly, but I don't know how. I went to Add Service Reference in Visual Studio, then copy/pasted the path to the .xamlx file of the service on localhost.
Thank you.
I found a solution to this problem here:
https://social.msdn.microsoft.com/Forums/vstudio/en-US/5279fc5f-8a53-43e7-8ef2-3073808dc90f/configuring-workflow-services-how-to-configure-workflow-control-endpoint?forum=wfprerelease
I re-made my service using the steps listed and it works as originally intended.

Add Service Reference doesn't generate proxy

I understand there are other similar questions, but I haven't been able to find a working response.
I create the default WCF service from the template [which comes with GetData() and GetDataUsingDataContract()].
It runs fine in the browser.
I have a separate web site to which I add this new WCF service:
I do 'Add Service Reference', enter my URL, the service comes up and I click 'OK' to add it.
Under 'App_WebReferences', I see the namespace of my added service: 'ServiceReference1', with 'References.svcmap' under it, and a couple .svcinfo/.wsdl/.xsd files under that.
No proxy files are created, but <system.serviceModel> element is added to my web.config, with what seems to be proper information.
However, with no proxy, I can't access/call any methods in my service (ie ServiceReference1.WCFMethod1())
I can call svcutil, generate the proxy, add it to my App_Code, and everything works as it should.
My question is, why isn't my proxy being created with 'Add Service Reference'?
Everything is under target framework: .NET Framework 4.
EDIT:
Just created a Console App and added the service reference and it created the proxy.
So the issue is my web site is not creating the proxy...
I had this same problem and found that unchecking Reuse types in all referenced assemblies did solve the problem. However, in my case, I needed it to reuse types from some of my referenced libraries. I found this post, covering a very similar problem. In that post, it references a Microsoft knowledge-base article which describes a fix for the the following issue:
Consider the following scenario:
You create an ASP.NET MVC4 Web API project in Visual Studio 2012.
You add a WCF service reference in the project.
In this scenario, the Reference.cs file for the service reference is empty.
Cause
This issue occurs because the DataContractSerializer class has encountered a type (Newtonsoft.Json.Linq.JToken) that it does not support. In this case, it throws an exception, and then stops generating the service reference.
I wasn't referencing that JSON library, but, based on that bug description, I surmised that one of my referenced libraries must have had a similar problem. I figured that one of the libraries that I was referencing probably contained a type that was not supported by the DataContractSerializer, it was throwing the same kind of exception, and it was therefore failing in the same way.
Sure enough, I found out that, in my case, the culprit was one of my own libraries which happened to include a public proxy for the same WCF service. I suspect it was that public proxy that was causing the trouble. In any case, by selecting Reuse types in specified referenced assemblies, and then selecting all of the assemblies except that one, the service reference automatically generated the proxy classes correctly.
When you are adding a ServiceReference : References -> Add new service reference.
Clik on advanced button and uncheck "Reuse types in all referenced assemblies".
This option sometimes causing errors.
Here is the main issue.
The issue source is when you are not able to find Add Web Reference in your visual studio. If the service is asmx, in my case it wasn't generating proxy class until I found these steps -> click on Sercice Reference -> Click on Advanced -> There you will see Add Web Reference... Provide your service URL hit OK issue resolved.
Hope this helps.

AddressFilter mismatch at the EndpointDispatcher

I have a WCF Web application that uses a WCF Class Library.
My project is a WCF Web project and I am self-hosting.
My problem is that all my web service methods hang with:
And "Unable to automatically step into the server...etc".
The error (not very helpful) returned is:
The operation has timed out
When I invoke the same method(s) using the WCF Test Client
I get the correct response and everything goes smoothly.
So, something must be wrong with my web application.
Following up on a similar post, I used the Service Trace Viewer.
I am getting the error:
The message with To
'http://localhost:8731/Design_Time_Addresses/Authentication/mex/mex'
cannot be processed at the receiver, due to an AddressFilter mismatch at the
EndpointDispatcher. Check that the sender and receiver's EndpointAddresses
agree.
After reading a related post, I tried adding:
[ServiceBehavior(AddressFilterMode=AddressFilterMode.Any)]
And recompiling my class library and updating my services to no avail... still hangs.
I have tried adding both my web service and my web project as startup projects but
I am still unable to step into the code. I also have all the appropriate DEBUG attributes
set in Web.config and App.config.
Any suggestions out there?
From my experience the mex/mex error occurs when I update a service reference in Visual Studio. I have come to the conclusion that this is just part of how Visual Studio figures out how to update the web service rere
Without knowing what your configuration looks like, it's hard to say what's wrong. However, why does your URL have /mex twice in it? Are you sure that's right?

"Add Service Reference" reference.svcmap and ServiceReference.ClientConfig empty

I have an ASMX service that I wan't to add to my Silverlight project (in the near future this will be converted to a WCF service).
When using the "Add (or Update) Service Reference" not all the files seem to be created and files under Reference.svcmap aren't created and the ServiceReferences.ClientConfig is empty.
Has anyone ever come across this before?
Not sure I have a good answer for this one. I see this every so often. Usually the problem can be traced by looking at the output window entires that occured during the attempted proxy generation.
Sometimes it is caused because invalid or unsupported Wsdl or just some silly issue with serialization of one of the types.
Try to give your client (Silverlight) application the WSDL, not just the ASMX when adding the service reference.
e.g. http://myserver.com/services/mywebservice.asmx?wsdl
Remove the service reference altogether from your client project, and try adding it again this time with the WSDL.