Can I expose a System.Collections.Generic.List<> from a asmx service.
I tried it but the reference class generated at client have converted it as Arrary[].
Have you set the option in update service reference?
You can set this by right mouse clicking on your service located in the Service References folder, then select Configure Service Reference.
And may you have set that option already and your still getting back an array then may i suggest to look here
http://johnnblade.wordpress.com/2012/06/07/service-reference-returns-array-t-instead-of-listt/
Related
We converted our projects to the 'new' SDk format csproj files. To add a new WCF webservice we right-click the project and choose: Add => Connected Service. Then we choose 'Microsoft WCF Web Service Reference Provider'. That all works, but the generated code does not contain an option to pass an endpoint name to the service-client constructor (which was an option in the older csproj add service reference option) so it would do a lookup in the web.config-file to configure the service (endpoint and behaviours e.d).
It looks configuration is all hardcoded in the generated service code file (servicereference.cs). I know it's a partial class and could just add an extra constructor accepting an endpoint name as a string like ctor(string enpointname):base(endpointname){} but i'm lazy and believe it should be able to work out of the box.
I think the question (and comments) contains the answer already. The only way to use the Config-file is to add a constructor in partial class in a new file.
I am trying to get meta of any wcf, asmx services with endpoints. I am getting meta at service level. but, not getting methods and their signature at end point levels of any wsdl ulr. can any one help for this.
Are you using visual studio?If Yes,
In Solution Explorer, right-click the name of the project that you want to add the service to, and then click Add Service Reference.
The Add Service Reference dialog box appears.
In the Address box, enter the URL for the service, and then click Go to search for the service.
In the Services list, expand the node for the service that you want to use and select an entity set.
In the Namespace box, enter the namespace that you want to use for the reference.
Click OK to add the reference to the project.
A service client (proxy) is generated, and metadata that describes the service is added to the app.config file.
I want to retrieve data from a database using a WCF service and service reference in my Silverlight project. All things that I do are:
created Linq-to-SQL file and add server connection then drag some table from server explorer to PersonDataClass.dbml file
Create WCF service
Implemented the functions defined in the interface:
created a Service Reference named DBServicesRef
but in my code I can access just one function of the WCF Service, just the getPersonComplete service method :
I searched the web but I am beginner in Silverlight :)
I clean, build, rebuild the project, update DBServiceRef (with check or uncheck reuse type in referenced assemblies ) or even delete and create files but I can not insert any value to database :( because I can not access the addPersonComplete service method to handle it .
Your addPersonRecord does not return any value. Therefor it will not get it's own event handler. It will use a generic handler.
When you've written the += after webService.addPersonCompleted just press tab twice and you should get a new function with the correct signature automatically.
I want create a ASP.NET Application (aspx site) that connection with a database and create userconnections for the internet. I get a Soap Data (soapapi.wsdl). This file have all function for create a guestuser or get Informations about who apply a GuestUser and the Time.
My Problem is that I don't know how I can add a reference to this Soap File in C# an execute this functions :( ? I search it but I don't found a good example :/
What I need for a Namespace and how i set a reference to this wsdl file ?
tarasov
Try to add Service Reference
Right click on project file ->Add Service Reference. In the dialog point to this wsdl file.
At result a proxy c# class will be generated, that allows you to call soap methods as usual code
I have a web method with a signature like this:
public string[] ToUpper(string[] values)
I am using the 'Add Service reference' in Visual Studio 2010 to generate a reference to my service. Unfortunately, this process creates a proxy class called 'ArrayOfString' and uses this type instead of the expected 'string[]' type. The generated async service call signature ends up looking like this:
public void ToUpperAsync(Demo.ServiceReference.ArrayOfString values) { }
public void ToUpperAsync(Demo.ServiceReference.ArrayOfString values, object userState) { }
I have tried all the options of the 'Collection' drop down on the config service reference form and it doesn't seem the make a difference.
This was working previously, but for some reason it suddenly stopped working, perhaps after removing another web method from the service.
How do I get the generated service reference class to use the string[] type instead of a generated ArrayOfString type? Any help on this would be greatly appreciated.
EDIT:
As #Oleg suggests, I am using ASMX web services.
this change to XmlSerializer can ben done inside the Reference.svcmap file. Open it inside the Service Reference folder and change the Serializer xml node from "Auto" to "XmlSerializer" this solves the problem!
Cheers
I could reproduce your problem when adding a "Service reference" to an ASMX style web service. However when adding "Service refernce" to a WCF service or "Web reference" to an ASMX service argument was of type string[].
According to this I think that you can fix your problem by replacing "Service reference" by "Web reference".
Press "Advanced..." button on "Add service reference dialog".
Press "Add web reference..."
Insert service url and add web reference
Too late but can help people in the future...
Use the svcutil and explicitly inform the command line util that you want the proxy class to be serialized by the XmlSerializer and not the DataContractSerializer (default). Here's the sample:
svcutil /out:c:\Path\Proxy.cs /config:c:\Path\Proxy.config /async /serializer:XmlSerializer /namespace:*,YourNamespace http://www.domain.com/service/serviceURL.asmx
Note that the web service is an ASP.NET web service ok?!