I modified a WebService to include a public property and a public class, rebuild, updated the service in my client app. Neither are accessible by the client app for some reason. When I launch the test page, I can see them there; but when I use them in code, building breaks. It seems like the WebService is ignoring my changes or not regenerating.
Thanks for help!!
Web-services only support calling methods, not properties.
You'll have to create GetPropertyName and SetPropertyName methods to wrap up your property.
Related
I am facing issue while adding asmx service in .NetCore Console application. I am using WCF Connected Service extension as add web reference is not available. So,I followed the same steps which was suggested in following link
https://blogs.msdn.microsoft.com/webdev/2016/06/26/wcf-connected-service-for-net-core-1-0-0-and-asp-net-core-1-0-0-is-now-available/
After completing all step it provided auto-generated reference class which contains all method as async method. My asmx service required username and password authentication for each method and we pass credential as first parameter of any method.
for example, using web reference my method looks like GetData(Credential credential) but here auto generated class shows this method like
GetDataAsync() so I used the below mention code to pass the credentials before calling my web service method
client.ClientCredentials.UserName.UserName = "myusername";
client.ClientCredentials.UserName.Password = "mypassword";
It's giving me Not Authorized error, after putting the breakpoints I found that credential was not getting at asmx service.
Please suggest some solution.
Previous Approach I Took:
I ran into a similar issue. I have an MVC Core web application (targeting .NET Framework 4.6.1) and was not able to add a Web Reference the way I used to be able to within previous (non-Core) applications. I was not able to get Connected Services to add a reference to an asmx and allow for the passing of credentials.
To work around this, I created an additional project (a class project also targeting .NET Framework 4.6.1). From there I was able to add a Web Reference the way one could in the past. Within this project I created a class with a publicly accessible method that calls the asmx service.
Then, within my MVC Core project, I set a reference to this additional project and am able to call the public method on the other project.
Latest and Best Approach I Have Found:
I fully updated VS 2017 as well as going to this site to get the latest WCF Connected Services extension (https://marketplace.visualstudio.com/items?itemName=WCFCORETEAM.VisualStudioWCFConnectedService).
The AuthorizationSoapHeader was easy to access and set.
MySoapClient.EndpointConfiguration endpoint = new MySoapClient.EndpointConfiguration();
MySoapClient myService = new MySoapClient(endpoint, myURL);
AuthorizationSoapHeader MyAuthHeader = new AuthorizationSoapHeader();
MyAuthHeader.AppName = FDSServiceAppName;
MyAuthHeader.AppID = Guid.Parse(MyAppID);
Entry[] entries = MyService.GetUsers().Result;
I faced the same problem and i resolved it owning to github issues :
In Reference.cs substitute
System.ServiceModel.BasicHttpBinding result = new System.ServiceModel.BasicHttpBinding()
for
System.ServiceModel.BasicHttpBinding result = new System.ServiceModel.BasicHttpBinding(System.ServiceModel.BasicHttpSecurityMode.TransportCredentialOnly);
result.Security.Transport.ClientCredentialType = System.ServiceModel.HttpClientCredentialType.Basic;
This really worked in .net core client app for soap web services
I'm working on a project with JAX-WS.
When I annotate my endpoint class with #WebService the WSDL is marked in console like
.../<context-root>/XXXService?wsdl
When I add #Stateless on those endpoints the WSDL is not marked in console and the actual address is
.../XXXService/XXXEndpoint?wsdl
Is this normal or expected?
Update
For further readers.
I couldn't find any resolution. I decided not to use mixed #Stateless+#WebService. I split those #EJBs and #WebServices for clear module separation.
What youre experiencing is expected behaviour. It's a different matter if the service s not functional. When an EJB 3.x stateless bean is deployed as a WS, it's naming defaults to what you see there,
Servername/SIBnameService/SIBName.
The reason for this is obvious: EJBs don't operate within the context of a web application and so cannot be addressed as such. You can customise the default name using the serviceName attribute on the #WebService annotation
Look at this from apache
I am trying to consume an existing web-service from another company and have troubles to find a solution to use the same web-service from different location.
An existing web-service is available at the address http://url.to.A/webservice/ and I am able to generate a C++ proxy class for this service using sproxy.exe from the ATL tools.
Using that class, I can consume the web-service without any problem.
Now I need to consume the same web-service but from another URL (let's say http://url.to.B/webservice/) and the previously created proxy class is not working. The SendRequest method inside one of method proxy always returns an erroneous HRESULT code. Generating a new proxy specifically for this second service gives a working solution BTW.
When I say that the services are the same I mean that they expose exactly the same methods so that their respective wsdl definition files differ only by the service URL.
I've tried to change the URL property of the generated proxy class instance but it doesn't help.
Given that I am tied to use unmanaged C++ for the consuming part and that I would like to be able to specify the service endpoint at runtime, is there a viable solution to my problem?
Thanks for your help.
Generate a separate proxy class for each server/service.
Then do a diff on the generated code. That should let you know what the differences are.
It finally turned out that it's not possible, using sproxy.exe, to generate a class that can be dynamically assigned to a webservice endpoint.
I have an existing web service built using C#. It implements a standardized interface which I cannot change. I would like to add a second interface to the web service but I am unclear on the coding mechanics. For the first interface and have written a class to implement the functions.
Question 1: For the second interface, do I create a new class to implement its functions, or add them to the class defined for the first Interface?
Question 2: What modifications are needed the the configuration file of the service's host program so that it recognizes the new interface?
If you need them in the same web service, then you could write an interface which extends the compulsory, standardised interface, and then expose that through the web service. It can be consumed by a client expecting either your interface or the simpler one. On the service side, just configure this as implementing your new interface, and you should not break connectivity for a client expecting just the simpler one.
I am using Flex4 to connect to a SOAP web service. I'm generating the ActionScript classes using the Introspection Wizard in Flash Builder. That all works.
However, the web service is itself under development, so I need to periodically regenerate those AS classes to pick up the new methods or changed method signatures. The only way I've found to do that is to delete the existing classes, and re-run the wizard. HOWEVER, when I do that I also need to give the service a new name, or I see an error saying that the service already exists.
Is there any way to 'refresh' existing web service class definitions WITHOUT having to delete, come up with a new name, and re-create?
Thanks
Got it -- Show View -> Data/Services. You can refresh the service there and choose which methods to generate code for...