C# axis2 client - c#

i am new to c# language.i saw that you wrote the c# client application to the axis2 web service.i also want to know how i write C# client for the axis2 application

I believe that Axis exposes WSDL in the normal way, so you should be able to use "Add Web Reference" from Visual Studio, point it at the relevant Axis WSDL URL, and use the autogenerated client proxy.
I seem to remember there are some subtleties around using null vs empty arrays, but mostly it works fine - or did when I last tried several years ago, anyway.

For any new web service development, I suggest you use WCF instead of the old-style ASMX web services framework that you would get from using "Add Web Reference". Use "Add Service Reference" instead. ASMX is next to obsolete, in the sense that only critical security fixes are expected.
Many AXIS2 services are configured with WS-Security enabled, and WCF is the only practical way to handle those.

Related

Web service written in both WCF and Java

Can I write a web service that implements the same methods and returns the same custom objects using both C#/WCF and also Java Web Services? And if so, can I then access the web services using a single web reference but with different addresses?
I'm asking because I have to host a web service that has a GetCitations and GetTerms method for publically exposing our database content. We are on IIS, so I was going to do it with WCF. However, other partners in the project also have to host an equivalent service and they are all Java based.
We are then building a software app that needs to connect to any number of these services (as defined at runtime by a user). I am expecting that we can have one set of classes to connect to these services (but with different endpoitn addresses), but am not sure whether I'm right in expecting this to work.
Is this possible?
And what considerations/restrictions are there?
Thanks.
It shouldn't be a problem, if you make sure that both services have equivalent wsdl files and you use http/soap binding.
I am not sure about using the binary (net.tcp) one with WCF, though. It might be a problem.
One way to do it is to use JAX-WS (Java 6) to expose a method as a web service.
The JAX-WS stack allows for automatically generating the correct WSDL at runtime.
The .NET team can then take that WSDL, and use standard tools to create a mock implementation of that WSDL. This mock implementation is then used as the actual .NET implementation, and you then use standard tools to generate the WSDL for that web service.
You now have to web services with the same semantics each with their own WSDL.
Both Java and .NET can implement a SOAP compliant web service, so the answer is yes, you can write a .NET and a Java webservice that implement the same WSDL.

Wcf proxy generation on windows mobile application

For my mobile app, I used the Add Web References to generate the client proxy to interact with my WCF service.
Then I read somewhere there is an equivalent of SvcUtil for compact framework: NetCFSvcUtil.
Should I be using the NetCFSvcUtil instead of going throught the Add Web References? Or the Add Web References uses NetCFSvcUtil in the background?
Any pros/cons of one or the other?
Add web reference should be old proxy based on ASMX web services whereas NetCFSvcUtil is tool to generate WCF based proxy. For basic web services there is generally no difference - both will work but if you want to use some advanced WCF features available on CF you will have to use NetCFSvcUtil.

Call web service over https

What do I need to call a web service over https in C#?
Do I need to get the certificate form the site? How do I use this to call the web service?
There's nothing special or different for calling a web service over https than over http. You generate a client proxy from the WSDL using either svcutil.exe (or Add Service Reference in VS) or wsdl.exe and invoke the method. The lower level classes HttpWebRequest and HttpWebResponse will eventually take care of the actual call and certificates but it should be transparent for your code. Of course the server hosting the web service needs to provide a valid certificate.
I take that you are using Visual Studio to create your projects, if you are it is pretty easy to do. I take that you have the url for the web service that you would like to connect to and it starts with HTTPS.
In your project in the solution explorer (assuming you using Visual Studio), you should see a node saying "References" and another one saying "Web References". Right click on the "Web Reference" and then basically follow the wizard. It is pretty straight forward. You can spec your own Namespace. I usually use the format SomethingAPI. Then use the API as you would like any other object in your project. You will get the intellisense and all.
There might occur known problems with some certificates though. See http://support.microsoft.com/kb/823177/en-us
Do you have a client certificate that has been supplied by the provider of the web service?
If so, there are various different ways of doing this depending upon which version of .NET you are using. What version are you using, and are you limited in how you can generate your client proxy classes?

Problem connecting to java ws

I've created EJB Stateless Bean and have added #WebService, #WebMethod
annotations to be able to access it as web service. I am using
NetBeans and GlassFish. When I tested web services with server console
they worked as expected. Next I've created .net application which is
supposed to be client for my web service. The problem is when I have
more than one method in the web service it does not work. When I
remove all method except one it works ok.
I also created for test purpose not EJB based web service - web
application project with added web service. This version works ok. So
am I suppose to do something at client side or server side to make the
EJB version works?
Unless explicitly told to, the web service libraries in Glassfish produce SOAP11 WSDL's, and most .NET-tools expect SOAP12.
If you cannot make your .NET-tool understand SOAP11, it appears you must adapt your sun-javaws.xml file. I have not tried this myself.
See https://metro.dev.java.net/1.4/docs/soap12.html

How much effort is required to convert an ASMX to WCF web service?

I have 2 web services with about 6 web methods in total, most of the code is ofc sitting in assemblies any way, and the web service asmx is really just calling these assembly methods and returning their return type.
How much effort is it to convert the web services from ASMX to WCF?
I pretty much at this stage control the only - non web based clients connecting to the web services, so this is not really a problem, product is in prelaunch.
Check out some of those blog posts and articles on how to do it:
Migrating ASMX to WCF (unfortunately, this link in no longer valid)
Phased Migration From ASMX to WCF
ASMX to WCF migration
and many more - search for "Migration ASMX to WCF" and you'll get a ton of hits
Marc
You should find it extremely simple to convert - especially if your existing asmx web methods are just calling into other classes. Just create a new WCF Service from Visual Studio - that way you still have your existing web services intact. It will automatically create an http end-point for your so you can just dump it straight into IIS (with a little configuration). You will need to describe your DataContract classes but that it trivially simple too.
I did this recently and it was a joy!

Categories

Resources