I have Java dynamic web project project with name 1 in my Eclipse that contains single class:
public class a {
public String getA()
{
return "aaa";
}
}
I' using Tomcat and Axis in order to create web service. Service runs fine and a.wsdl was created on disc. But how to publish this WSDL online and what is it's address?
Related
I'm trying to deploy REST web service on WebLogic 12c. I followed the official guide to configure the Jersey runtime and deploy the service.
Everything seems to work, until I return any object from the REST method. Here is the snippet
#GET
#Produces(MediaType.APPLICATION_JSON)
public List<Foo> getFoos() {
return repo.getFoos();
}
The method returns "Internal server error" string as a payload. Oddly enough, I don't see any runtime exceptions in the server log. Same applies to any object type. However, I can return String with according media type with no problem.
Seems like there is some problem with the JSON marshalling. Do I need further configuration to enable the JSON marshaller?
On my local machine in Visual Studio 2017, I created solution based on the .NET Core Stateless Service template, and added Microsoft.ServiceFabric.Services.Remoting.Runtime package to accept remote calls through RPC.
protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners()
{
return this.CreateServiceRemotingInstanceListeners();
}
Then I added interface ITestAccUp in a separate project:
public interface ITestAccUp : IService
{
Task NotifyAsync();
}
I added implementation of the interface to the stateless service, and created one more project, a .NET Core console client to run the service. The console is going to be run outside a cluster.
static void Main(string[] args)
{
ITestAccUp testAccUpClient = ServiceProxy.Create<ITestAccUp>(new Uri("fabric:/SFAccountUpTest/Stateless1"));
testAccUpClient.NotifyAsync().Wait();
}
However, when I run it I got the error "InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'IFabricTestManagementClient4'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{B96AA7D4-ACC0-4814-89DC-561B0CBB6028}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).",
though Named Application fabric:/SFAccountUpTest/Stateless1 seems to be up and running.
I guess the problem is RPC calls are just made for calling services inside SF clusters, not outside. Is it possible to make an RPC call outside a cluster, or is it necessary to build some sort of web API to make a service call?
As long as you're on the same network, you can call Services and Actors by using SF Remoting from other applications. For example, see this demo project which does so for testing purposes.
Make sure you use the same DLL that holds the interface definition from both the client and the service project. (It works different from WCF, where a proxy could be generated independently from the service, by using wsdl.)
Maybe you're running into an issue, like this one, or this one.
I realize this question is kinda old, but the way I solved this problem was to make sure I was using the "V2" remoting stack (details here)
Basically you need to edit your ServiceManifest.xml to use this as an Endpoint:
<Resources>
<Endpoints>
<Endpoint Name="ServiceEndpointV2" />
</Endpoints>
</Resources>
And add the [assembly] attribute to your remoting interface (above namespace).
Example:
...
using Microsoft.ServiceFabric.Services.Remoting;
using Microsoft.ServiceFabric.Services.Remoting.FabricTransport;
[assembly: FabricTransportServiceRemotingProvider(RemotingListenerVersion = RemotingListenerVersion.V2, RemotingClientVersion = RemotingClientVersion.V2)]
namespace ClassLibrary1
{
public interface IMyService : IService
{
...
I am working on creating a Camel, Spring boot application that implements the OPC-UA connection. Till now, I was successfully able to run the examples obtained from Eclipse milo github repository.
Now, my task is to create a camel route that will connect to the opc-ua server that is running on a different machine, read data from there and store in a jms queue.
Till now, I am able to run the BrowseNodeExample and ReadNodeExample where I am connecting to a server simulator (Top Server V6). In the example code, when connecting to the server, the endpoint of the server is given as - "opc.tcp://127.0.0.1:49384/SWToolbox.TOPServer.V6"
Now in the camel routing piece of code, in the .configure() part, what shall I write in the .from() part. The piece of code is as -
#Override
public void configure() throws Exception {
from("opc.tcp://127.0.0.1:49384/SWToolbox.TOPServer.V6")
.process(opcConnection)
.split(body().tokenize(";"))
.to(opcBean.getKarafQueue());
}
While searching for the solution I came across one option: milo-server:tcp://127.0.0.1:49384/SWToolbox.TOPServer.V6/nodeId=2&namespaceUri=http://examples.freeopcua.github.io. I tried that but it didn't work. In both the cases I get the below error:
ResolveEndpointFailedException: Failed to resolve endpoint: (endpoint
given) due to: No component found with scheme: milo-server (or
opc.tcp)
You might want to add the camel-opc component to your project.
I've found one on Github
and also milo version on maven central for the OPC-UA connection.
Hope that helps :-)
The ResolveEndpointFailedException is quite clear, Camel cannot find the component. That means that the auto-discovery failed to load the definition in the META-INF directory.
Have you checked that the camel-milo jar is contained in your fat-jar/war?
As a workaround you can add the component manualy via
CamelContext context = new DefaultCamelContext();
context.addComponent("foo", new FooComponent(context));
http://camel.apache.org/how-do-i-add-a-component.html
or in your case
#Override
public void configure() throws Exception {
getContext().addComponent("milo-server", new org.apache.camel.component.milo.server.MiloServerComponent());
from("milo-server:tcp://127.0.0.1:49384/SWToolbox.TOPServer.V6/nodeId=2&namespaceUri=http://examples.freeopcua.github.io")
...
}
Furthermore be aware that milo-server starts an OPC UA server. As I understood your question you want to connect to an OPC UA server. Therefore you need the milo-client component.
camel-milo client at github
I am in the process of evaluating Spring cloud with Eureka and the Feign Client with Ribbon.
My sample application I've been creating has a Eureka Server that receives the Clients just fine.
However, when using the FeignClient, the RequestMapping requires the Context Path to be included.
In my initial case, I had two services with the same VIP but different IDs.
- one service at localhost:8080/
- one service at localhost:7400/HelloWorld
The reason for the different context roots is due to potential deployment structure I can't easily change.
Is this something I need to configure within my Client? or Application or is this not possible?
Here is my #FeignClient
<code>
#Autowired
HelloClient client;
#FeignClient(value = "Hello-World")
interface HelloClient {
#RequestMapping(value = "/HelloWorld", method = RequestMethod.GET)
String hello();
}
</code>
Ideally, the RequestMapping would only be the value '/'
I have implemented a restful service with WCF Web API and I want to publish it in IIS.
During developing process I was using the service as Console Application and all configuration was made through API.
Now I'm trying to publish the service as ASP.NET application and the only way I see is somehow to move all configuration into web config file.
Here the coded configuration:
var cfg = HttpHostConfiguration.Create()
.AddMessageHandlers(typeof(AllowCrossDomainRequestHandler));
using (var host = new HttpConfigurableServiceHost(typeof(RESTfulService), cfg , new Uri("http://localhost:8081")))
{
var endpoint = ((HttpEndpoint)host.Description.Endpoints[0]); //Assuming one endpoint
endpoint.TransferMode = TransferMode.Streamed;
endpoint.MaxReceivedMessageSize = 1024 * 1024 * 10; // Allow files up to 10MB
host.Open();
Console.WriteLine("Host opened at {0} , press any key to end", host.Description.Endpoints[0].Address);
Console.ReadKey();
}
How should my web.config look to reflect this configuration?
Or is there any other approach instead of using ASP.NET?
Any help is appreciated.
If you want to preserve your existing config, you can put all your config set up stuff into a method, and call it from global.asax Application_Start() method. All the Global.asax methods will get called in WCF the same as they do for ASP.NET.
Or, you can wire your services to a custom ServiceHostFactory and ServiceHost that has all the configuration in it (this is the approach I am using in my current app).