I am creating a wcf service in .net. In the service I have added function named XYZ as:
public int XYZ(int a){
return a+a;
}
When i added the web reference of web service in my web application and accessed the function XYZ, here it requires two parameters one is of int type and second is of bool type.
But originally i had added single parameter in XYZ function in wcf service.
If someone has idea then please let me know that how to handle this. Because my wcf service will be called from flash code.
If you are adding a Web Reference to your project instead of Service Reference then you'll get "extra" parameters as described here. You should be adding a Service Reference to create a proxy for your service that matches the WCF ServiceContract description of your service. Also, the "extra" parameters only show up for ASMX-based clients. They won't be required for the Flash client to call the WCF Service.
Related
How can I get the information about WCF REST service method details on client side
For Ex: I have a method
string GetDetails(string fname)
then my client application will show what is the return type of the function(string in this case), parameters required (fname) along with the name of the function(GetDetails).
You can say I want to create a WCF Test Client application for WCF REST service.
Thanks in advance!
I have a requirement where I should write WCF service that is called by another external service, which code is not under my control. I only know that my service is called by that external service in this way:
string content = client.getData("http://localhost:1111/Service.svc", param);
My service is located at the address that is actually first parameter in external service method, which means my service was called somewhere inside the body of external service method.
So, my question is - how can I be signaled inside my service that my service was called by that external service?
1) you can create two endpoint for different clients (real client and external servise)
2) you can write specific behavior and realize functionality by additional paramert which will be only into behaviors
I have gone through following references and found that a WCF service can be called dynamically. But, i have not been able to call a service (method) accepting parameters as ref and out.
Calling a WCF service from a client without having the contract interface
Dynamic Programming with WCF
Dynamically Invoking Web Services... With WCF This Time
Invoking WCF Service without adding a Service Reference.
Is there any way to make such call with ref and out parameters?
Invoking WCF Service without adding a Service Reference. works greate provided i know the Contract. So i added the web reference first, copied the generated proxy into actual project and then removed the web refernce and simply called the method as
BasicHttpBinding binding = new BasicHttpBinding();
EndpointAddress epAddr = new EndpointAddress("http://192.168.0.233/GMS/GMSService.svc");
GMSContract.IGMSService _interface = ChannelFactory<GMSContract.IGMSService>.CreateChannel(binding, epAddr);
...
bool r = _interface.MyGMSMethod(..., ref ..., out ..., out ...);
I have a DAL where I have Entity Framework to expose entities. These entities are used in a WCF Service project and exposed to the client.
I consume these entities in the Silverlight web project via service reference. Then I am using a RIA domain service for code sharing. But I get the following error while trying to load operation:
DomainContext context= new DomainContext();
LoadOperation<Genre> lo = context.Load<Genre>(context.GetGenres());
GetGenres() is a Domain Service operation where it loads all Genres.
[Invoke]
public IEnumerable<Genre> GetGenres()
{
return proxy.GetGenres(); //proxy is wcf proxy.
}
This Query returns a List. Where Genre is the DataContract i
got from the WCFServiceReference.
Actual Error:
The type 'SL.Web.ServiceReference.Genre' cannot be used as type parameter 'TEntity' in the generic type or method
'System.ServiceModel.DomainServices.Client.DomainContext.Load(System.ServiceModel.DomainServices.Client.EntityQuery)'.
There is no implicit reference conversion from
'SL.Web.ChinookServiceReference.Genre' to
'System.ServiceModel.DomainServices.Client.Entity'.
Question is:
Can I do this way or should I have a custom class in Silverlight that maps to the WCF service datacontract and share the custom entity between the Silverlight client and Web project?
Is there a way to share entities from a service reference between Web and client using a DomainService??
The problem is that you have GetGenres marked as an Invoke operation. If you mark it as a query operation and rebuild, I think that you will be in good shape.
I have a class, in which I have a service reference (WCF) to an ASMX web service.
This obviously generates local proxy methods such as
string DoSomething(string someParameter, string someOtherParameter)
I have a method that receives a WCF message class already representing a call to this service, which I simply need to forward
I could of course use XmlDictionaryReader to extract the information from the WCF message, deserialise into the proxy classes and pass those into the proxy method, but as these will simply get serialised back it seems very wasteful
How can I call the service using the already serialised message? (I assume I will need to modify the soap action on the incoming message)
There's a two-part series on how to build a WCF router on MSDN - maybe that helps? Seems like that's more or less what you're trying to do - use a WCF service to basically route a message on to a second service (ASMX in your case).
Marc