Calling basic authentication java webservice with C# Client - c#

I have a c# client application calling java web services. Everything works great but now i need to send some authentication data since we are trying to restrict who calls the web service. The java web service expects basic authentication.
How do i go about providing this in my c# client? I am not using WCF or WSE, just plain webservice (using Add Web Reference).

Here's a link for the solution i found in case some one needs it. I was able to fix my issue by modifying some of the stuff in the suggested article.
http://www.c-sharpcorner.com/UploadFile/pchandraker/1052/

Related

Can a WCF SOAP service consume an external REST API?

I need to authenticate APP "A" according to APP "B" authorizations, using an existent and available login method. Just checking username and password, no token, no certificate. Basic auth.
I do not control any of that app, so I manage to create a web service to intermediate communications.
I am quite new to this, so I have starting reading about it. I have ended up some simple examples using WCF to perform it. I'm using c#.
Should I do it using WCF? What should be (conceptually) my approach?
You can do anything you want from a WCF service, as long as you keep the constraints of running as a Windows Service (either directly or through IIS) in mind.
So yes, you can just use HttpClient or RestSharp to talk to the REST API from your WCF code.

c# Webservice Consumed by PHP client

What is the best way to create WebService using Visual Studio which can be consumed by PHP or Java client?
The WebService must require authorization.
I have some expierence in creation of WCF Service with custom authentication (see: http://jaliyaudagedara.blogspot.com/2013/07/set-wcf-service-authentication-to-use.html )
and I know that PHP programmers have problems to pass credentials.
Are there any methods of protection of WebService that are compatible with PHP world?
WEB API 2 Is Microsoft's Latest technology for Hosting Web Services.
It is compatible with all official Standards. (XML, JSON, REST ) etc.
There is no reason any platform to have any difficulties connecting to such an API.
You can pass data for identification just by initiating a POST request with a JSON Object.

C# program to call existing web API

How can I call / use web API that supports SOAP and REST? I want to write a program in C# that will use this web API. I didn't get much information on the internet. So far, I have created C# project and added the web service reference (WSDL) to my program. Now how can I use the web API. How to send request or receive response? Can you please refer me some good tutorials ?
The HttpClient class is a good starting point. Also there is the EasyHttp library.
Code sample HttpClient: http://code.msdn.microsoft.com/Introduction-to-HttpClient-4a2d9cee
Introduction to EasyHttp: http://devlicio.us/blogs/hadi_hariri/archive/2011/01/16/easyhttp.aspx
Adding web service reference creates client classes that can be used to communicate with web service. All created classes will be in new namespace, You have to look for client proxy class (full name depends on WebService name). Create instance of this class. Calling its methods will call WebService. Here you can read about using Web Services in C#

how to make a service, SOAP web service in .net?

Please forgive me for this basic and a little theoretical question as I dont know much about web services.
I m not refering WCF service, I am reffering simple service in .net / C#. I want to know how to know is it soap or rest service ?
How we can change this type from Soap to Rest and vice versa ?
Thanks
XML Web Services (aka classic/legacy ASMX web services) should not be used for active development. If you must, there is a nice walkthrough on MSDN for adding Web references in more recent versions of Visual Studio (> 2005).
On the other hand, if your web service is truly Restful then you won't be able to create the equivalent of a service reference to it. You'll need to either use the HttpWebRequest, WebClient, or the new HttpClient from .NET 4.5 (also available from the Rest starter kit which is depreciated as well).
As an alternative if you are looking to implement a client that is able to handle both situations, I would recommend HttpWebRequest to POST to the SOAP (non-WCF) service. The problem with this method is you'll likely have to wrap the request in the SOAP wrapper yourself. Luckily there are examples of doing so on the net that you can at least use as a starting point.
ASMX services are build upon SOAP. REST is simply a HTTP based, You can access(or call) your business resources the way you access the normal URLs.
For ex in products catalog system, by using asmx you create set of functions to add,update,delete products. like addProduct(),updateProduct, etc..
But in REST, you will be having single point of access, like http:\mysystem\prodcuts. To retrieve,add,update,delete products, you will be using respective HTTP verbs (GET,POST,PUT,DELETE) on the same URL.
so,technically it's not possible to convert asmx(SOAP) service to rest...

Calling a php SOP webservice from c# that does not support wsdl

Can any body have idea how to consume php soap web service that have no support wsdl.
I want to add reference in .Net to generate client but failed.
When i saw in browser with ?wsdl it shows message wsdl is not supported.
Simply said: you can not. WDSL is there for development environments to know how to deal with a web service. Whoever wrote the web serivce made sure (or was ignorant enough to now know) that it is not usable from any tooling support.
You might want to consult the PHP: SOAP Manual and verify that you wrote the PHP webservice correctly.
And you can also look at this example: PHP Webservice and C# / .NET SOAP Clients
You need to configure the SOAP Service to support WSDL
(Web Services Description Language) An
XML-based language for describing Web
services and how to access them.
Otherwise .NET won't know what or how to use it.

Categories