I am following the samples given in the java client sdk. Specifically
https://github.com/uber/cadence-java-samples/blob/master/src/main/java/com/uber/cadence/samples/hello/HelloWorkerSetup.java
Compiler is not able to resolve
Worker.Factory
I have tried to look in the client SDK code but I cannot seem to get past this error.
Has something changed in how workflows have to be registered?
Thanks
Sanjay
ClientOptions tOptions = ClientOptions.newBuilder().setHost(serverHostName).setPort(serverPort).build() ;
WorkflowServiceTChannel tChannel = new WorkflowServiceTChannel(tOptions);
WorkflowClientOptions clientOptions = WorkflowClientOptions.newBuilder().setDomain(serverDomain).build();
WorkflowClient wfClient = WorkflowClient.newInstance(tChannel,clientOptions);
WorkerFactoryOptions factoryOptions = WorkerFactoryOptions.newBuilder().build();
WorkerFactory factory = WorkerFactory.newInstance(wfClient,factoryOptions);
Related
How does one go about registering the workflows with a remote Cadence Server? Almost all examples are pointing to a local server.
Thanks
Sanjay
Replying to my own question. Wouldn't have solved this without help from Matt Anger.
ClientOptions tOptions = ClientOptions.newBuilder().setHost(serverHostName).setPort(serverPort).build() ;
WorkflowServiceTChannel tChannel = new WorkflowServiceTChannel(tOptions);
WorkflowClientOptions clientOptions = WorkflowClientOptions.newBuilder().setDomain(serverDomain).build();
WorkflowClient wfClient = WorkflowClient.newInstance(tChannel,clientOptions);
WorkerFactoryOptions factoryOptions = WorkerFactoryOptions.newBuilder().build();
WorkerFactory factory = WorkerFactory.newInstance(wfClient,factoryOptions);
// the class referred to below is from the tutorial
Worker worker = factory.newWorker("HelloWorldTaskList",
WorkerOptions.newBuilder()
.setMaxConcurrentActivityExecutionSize(100)
.setMaxConcurrentWorkflowExecutionSize(100)
.build());
worker.registerWorkflowImplementationTypes(HelloWorldImpl.class);
factory.start();
Hi all I use apache's httpclient to make restcalls, everything is working fine, When multiple thread are using this method my app crashes.
What is the implementation for this class that is MultithreadSafe.
Here is my code.
httpClient = new HttpClient();
HttpMethod method = null;
method = new GetMethod();
... method creation...
httpClient.executeMethod(method);
method.releaseConnection();
Thanks in advance. Juan
Have you looked at the HttpClient threading documentation ?
To get started one must create an instance of the
MultiThreadedHttpConnectionManager and give it to an HttpClient. This
looks something like:
MultiThreadedHttpConnectionManager connectionManager =
new MultiThreadedHttpConnectionManager();
HttpClient client = new HttpClient(connectionManager);
The issue you're having is quite common when using HttpClient out-of-the -box
I'd like to listen to traffic generated by phantomjs selenium driver in c#. The below code does not work unfortunately!
PhantomJSOptions phoptions = new PhantomJSOptions();
phoptions.AddAdditionalCapability("proxy", "http://localhost:9999");
driver = new PhantomJSDriver(phoptions);
can anyone help me what's wrong with it!
Thanks in advance
Proxy proxy = new Proxy();
proxy.HttpProxy = string.Format("127.0.0.1:9999");
var service = PhantomJSDriverService.CreateDefaultService();
service.ProxyType = "http";
service.Proxy = proxy.HttpProxy;
IWebDriver driver = new PhantomJSDriver(service);
Some quick testing showed this work for me.
You can use the CapabilityType class to set the proxy capability. Here is a modified version of your code above:
PhantomJSOptions phoptions = new PhantomJSOptions();
phoptions.AddAdditionalCapability(CapabilityType.Proxy, "http://localhost:9999");
driver = new PhantomJSDriver(phoptions);
This worked for me. Arran's answer did not work for me. For some reason, my PhantomJSDriverService class did not have a ProxyType or Proxy member.
I am working on adding WIF support to my WCF Data Services / ODATA server, and the first thing I'd like to do is create a nUnit test which passes some sort of identity to said server. I believe this falls under the category of an active client: there's no UI; I want to make a call out to a app.config established provider (Google, Yahoo, Windows Live, or some other provider) to get my identity token. Frankly, it doesn't matter what, just that it's more-or-less always accessable and has no administration to get the test running. (If there's some host app that I can include in my solution to act as an IP, I'd be perfectly happy with that.)
All of my existing tests use HttpRequest directly -- I am not using a generated client. While I'm creating my HttpRequest object, I check to see if I already have an authentication token to put in my headers. If not, I am trying something like this:
using (WSTrustChannelFactory factory = new WSTrustChannelFactory(
new UserNameWSTrustBinding(SecurityMode.TransportWithMessageCredential),
new EndpointAddress(new Uri("https://dev.login.live.com/wstlogin.srf"))))
{
factory.Credentials.UserName.UserName = "MYUSERNAME";
factory.Credentials.UserName.Password = "MYPASSWORD";
factory.TrustVersion = TrustVersion.WSTrust13;
WSTrustChannel channel = null;
try
{
var rst = new RequestSecurityToken
{
RequestType = WSTrust13Constants.RequestTypes.Issue,
AppliesTo = new EndpointAddress("http://localhost:60711/Service"),
KeyType = WSTrust13Constants.KeyTypes.Bearer,
};
channel = (WSTrustChannel)factory.CreateChannel();
return channel.Issue(rst);
}
finally
{
if (null != channel)
{
channel.Abort();
}
factory.Abort();
}
}
So to start... I don't even know if I'm aiming at the right URI for the IP, but when I changed it, I got a 404, so I figure maybe I'm on the right track there. At the moment, the channel.Issue method returns a MessageSecurityException with an inner exception of type FaultException, noting "Invalid Request". The FaultException has a Code with Name=Sender and Namespace=http://www.w3.org/2003/05/soap-envelope, which then has a SubCode with Name=InvalidRequest and Namespace=http://schemas.xmlsoap.org/ws/2005/02/trust. I don't know what to do with this information. :)
My apologies if I'm asking a very basic question. I've been looking at authentication for only a couple of days, and don't know my way around yet. Thanks for any help!
EDIT -- SOLUTION
Eugenio is right -- I am doing something a little heavyweight, and it is more of integration testing stuff. I ditched the Google/Yahoo/Live stuff, and found a modified version of SelfSTS, which I cobbled into my project. I don't fully understand what's going on just yet, but I got back a SAML token. Here is final code:
var binding = new WS2007HttpBinding();
binding.Security.Mode = SecurityMode.Message;
binding.Security.Message.ClientCredentialType = MessageCredentialType.UserName;
binding.Security.Message.EstablishSecurityContext = false;
binding.Security.Message.NegotiateServiceCredential = true;
using (var trustChannelFactory = new WSTrustChannelFactory(binding, new EndpointAddress(new Uri("http://localhost:8099/STS/Username"), new DnsEndpointIdentity("adventureWorks"), new AddressHeaderCollection())))
{
trustChannelFactory.Credentials.UserName.UserName = MYUSERNAME;
trustChannelFactory.Credentials.UserName.Password = MYPASSWORD;
trustChannelFactory.Credentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;
trustChannelFactory.TrustVersion = TrustVersion.WSTrust13;
WSTrustChannel channel = null;
try
{
var rst = new RequestSecurityToken(WSTrust13Constants.RequestTypes.Issue)
{
AppliesTo = new EndpointAddress("http://localhost:60711/Service"),
KeyType = WSTrust13Constants.KeyTypes.Bearer
};
channel = (WSTrustChannel)trustChannelFactory.CreateChannel();
GenericXmlSecurityToken token = channel.Issue(rst) as GenericXmlSecurityToken;
((IChannel)channel).Close();
channel = null;
trustChannelFactory.Close();
string tokenString = token.TokenXml.OuterXml;
return tokenString;
}
finally
{
if (null != channel)
{
((IChannel)channel).Abort();
}
trustChannelFactory.Abort();
}
}
(This code is also lifted from the same place I got the modified SelfSTS -- thanks, Wade Wegner!)
I'm not sure about the use of "adventureWorks". The version of SelfSTS that I'm using names that as the issuername in the configuration, but I haven't checked to see if there's any correlation.
So... now to hack up my actual server so that it can figure out what to do with the SAML!
Not all of those IPs support active calls. Even if they do, the protocols might not be compatible.
For example, I'm not sure Google implements WS-Trust (what WIF is using under the hood). LiveID might have a WS-Trust endpoint somewhere, but not sure if it is officially supported/documented (for example, likely the error you are getting is because LiveID doesn't know about your RP: http:// localhost:60711/Service; and thus cannot issue a token for it).
For multiple IPs like these, apps typically embed a web browser and use it for all token negotiations (using WS-Federation for example). And often they rely on a specialized STS to deal with protocol transitions (e.g. Windows Azure Access Control Service)
In any case, what you are doing sounds a little bit heavyweight for a Unit test. It sounds more like an integration test you want to automate.
Maybe you could start with a custom (fake) STS of your own. In which you can control everything and simulate different outputs (e.g. different claims, etc.)
This chapter: http://msdn.microsoft.com/en-us/library/hh446528 (and the samples) can give you more information.
I've created a WCF service project. Using the standard generated example service the project generates I create a wrapper class using wsdl.exe.
However the service times out when I use the following code:
Service1 svc = new Service1();
svc.UseDefaultCredentials = true;
svc.Url = "http://localhost:16218/Service1.svc?wsdl";
string x = svc.GetData(1, true);
When I invoke the same webmethod via a normal Service Reference it works fine. What am i missing?
Thanks in advance!
Well, if you want to call the service, you shouldn't be connecting to the WSDL endpoint!
svc.Url = "http://localhost:16218/Service1.svc?wsdl";
Use this code instead:
Service1 svc = new Service1();
svc.UseDefaultCredentials = true;
svc.Url = "http://localhost:16218/Service1.svc";
string x = svc.GetData(1, true);
But why would you use wsdl.exe to create a client side bits for WCF?? Use svcutil.exe instead! That's the right tool for the WCF job.