How to add a Transport dynamically to an Axis2 Service? - axis2

I have an Axis2 service exposed in HTTPS. I want to add HTTP transport dynamically to the service.

You can simply add a transport dynamically as bellow,
axisService.addExposedTransport("http");

Related

when do we have to create proxy service and when do we need to create Rest Api?

Soap service in wso2 esb can be created in two ways one way is via creating a custom proxy service and another way is by creating a API. by using custom proxy and Api we can create the soap service so i want to understand when do i create custom proxy and when do i create API.
Use a proxy service if you need to :
consume JMS messages (JMS Proxy)
consume files (VFS Proxy)
receive SOAP messages (publish a webService with it's WSDL)
Use an API if you need to publish a REST service (generaly, you want to send XML or JSON to such a service)
Have a look there : https://docs.wso2.com/display/ESB490/Creating+APIs
That is depend on your requirement. If you want to expose your service as a REST service (i.e expose via HTTP methods get/post/put/delete) you can use API's. Similarly if you want to expose your service as a web-service you can use proxies.
You can also proxy a REST service via proxy.

How to secure MEX endpoint WCF

suppose i have developed a WCF service with one mex endpoint. now i like to know how can i secure the mex endpoint means that if anyone know my mex endpoint address then that user may not be able to add my mex endpoint address from their VS IDE to create proxy. if user try to do so then windows auth login dialog comes.
now the question is how then any out side user will be able to call my wcf service. i will distribute my service dll or proxy class related *.cs files or WSDL. so user can add that dll or add those proxy related .cs file or add wsdl to their project to create proxy just to call & consume my service. i am not advance developer so i am not being able to understand how to develop this kind of secure wcf service where user can not add my mex endpoint.
so just guide me with little wcf sample code & config example from where i can understand what i need to to meet my requirement. thanks
This topic looks helpful
https://msdn.microsoft.com/en-us/library/aa395212%28v=vs.110%29.aspx
Initially, one would think one would just change the HTTP to HTTPS but according to the article apparently you lose some degree of freedom in configuration
If you use the mexHttpsBinding your metadata endpoint will be secure, but there is no way to modify the binding settings.

WCF with tcp.net binding testing with JMeter

I have a problem that in JMeter I can setup server / port, but my application is hosting on IIS 7.5 and WCF service is a "Application" under specific web site. So the service endpoint is
http://localhost:8002/Some.Aplication/Some.Application.svc
WCF application is supporting tcp.net binding also and I should use it(tcp.net).
Ho can I set up JMeter for sending specific packet over tcp to this endpoint ?
Thanks.
You need to use TCP Sampler, and probably write a custom TCPClient class for it for easier handling of custom reads/writes.

Fetching WCF service configuration for proxy configuration

Is there a way to fetch information from a WCF service meta-data endpoint to know how to configure the proxy client so that you don't have to configure the proxy client manually? So instead of editing the client proxy configuration, it makes a call to the target service's meta-data, fetch the bindings, etc. and caches it on the client side and so when it makes calls to the service, it should be happy.
Thanks
You can use MetadataResolver class for this purpose but be aware that this will make your service call much slower. Also it is not silver bullet. Not all features are automatically configured so using this is not very usual. Why don't you like configuring the proxy manually or by Add service reference? It is not very common for service to change its configuration frequently.

I can't access wcf service using net.tcp://<servicename>

I'm using IE8 and can't connect to my WCF service using net.tcp. I'm able to access the same service with http binding just fine. I got two binding enabled in app.config (net.tcp, http). Can anyone tell me if there is a settings that I need to set/play with for viewing service using net.tcp in IE.
You cannot connect to a WCF service using the netTcpBinding through IE.
What you need is a "real" WCF client app, or something like WCF Test Client which is shipped with WCF in the box - just find it and start using it!
Make sure you have a HTTP base address, for your service and a mexTcpBinding endpoint.