Amazon SES - Connection - amazon-web-services

I'm trying to create a template on SES sandbox version. I use the following code but I'm getting the following error. Please help me fix this.
BasicAWSCredentials basicCreds = new BasicAWSCredentials("AXXXXXXXXXXXXX", "XXXXXXXXXXXXXXXXXXXXi");
AmazonSimpleEmailService client = null;
try{
client = AmazonSimpleEmailServiceClientBuilder.standard().withRegion(Regions.US_WEST_2).withCredentials(new AWSStaticCredentialsProvider(basicCreds)).build();
} catch (Exception ex){
logger.info(ex);
}
CreateTemplateRequest ctr = new CreateTemplateRequest();
Template template = new Template();
template.setTemplateName("Sample");
template.setSubjectPart("Sample Mail");
template.setTextPart("Test Mail from Template");
ctr.setTemplate(template);
client.createTemplate(ctr);
and the exception that I get is,
Exception in thread "main" java.lang.NoSuchFieldError: SIGNING_REGION
at com.amazonaws.services.simpleemail.AmazonSimpleEmailServiceClient.executeCreateTemplate(AmazonSimpleEmailServiceClient.java:950)
at com.amazonaws.services.simpleemail.AmazonSimpleEmailServiceClient.createTemplate(AmazonSimpleEmailServiceClient.java:932)
We are using ant build. If there is a jar problem please let me know which version of the jar I should be using.
Thanks in advance.

Related

Cannot find a handler of type EndpointResolver in AWSSDKS3

This is my issue:
I am updating AWS S3 nuget package from 3.7.1.2 to 3.7.101.25
Project details:
I have API that calls Class Library in which i am creating a AmazonS3Client. In version "3.7.1.2", its working fine. But in 3.7.101.25, i am getting below error.
Error:
System.InvalidOperationException HResult=0x80131509
Message=Cannot find a handler of type EndpointResolver
Source=AWSSDK.Core
Code:
var amazonS3Config = new AmazonS3Config()
{
MaxErrorRetry = maxRetryAttempts,
Timeout = TimeSpan.FromSeconds(requestTimeoutInSecond),
ServiceURL = serviceURL
}
s3Client = new AmazonS3Client(key, secret, amazonS3Config);
I was having the same issue where AWS looks like they opened up a ticket and resolved the issue. My issue was with AmazonKinesisClient but the same error.
https://github.com/aws/aws-xray-sdk-dotnet/issues/267 - same exception but for the AmazonDynamoDBClient.
This was resolved by installing the package AWSXRayRecorder.Handlers.AwsSdk v2.11.0

System.Web.Services.Protocols.SoapException The application encountered an unhandled system exception. From binary file

I have a project in .net that accesses a GP Web Services, it works fine. However when I generate a dll from this project and try to run the same from a different project using this dll, I get the following message: System.Web.Services.Protocols.SoapException The application encountered an unhandled system exception. Contact your system administrator for details.
I think it might be a permissions issue or something like this but I'm not sure, this is how the client is created:
WSHttpBinding binding = new WSHttpBinding();
EndpointAddress ep = new EndpointAddress(new Uri("..."), new UpnEndpointIdentity("..."), (AddressHeader[])null);
DynamicsGPClient wsDynamicsGP = new DynamicsGPClient(binding, ep);

Java API for Informatica

I am trying to use Java API to connect with informatica. I am tyring to run the samples at location
C:\Program Files\Informatica\PowerCenter8.6.1\MappingSDK\samples\src\com\informatica\powercenter\sdk\mapfwk\samples which uses com.informatica.powercenter.sdk.mapfwk.core.* libraries.
When I try to run CreateConnectionSample.java(simple connection to repository) I am getting exception.
code:
CachedRepositoryConnectionManager rpMgr = new CachedRepositoryConnectionManager(
new PmrepRepositoryConnectionManager());
Repository rep = new Repository();
RepoProperties repoProp = new RepoProperties();
repoProp.setProperty(RepoPropsConstant.PC_CLIENT_INSTALL_PATH,
"C:\\Program Files\\Informatica\\PowerCenter8.6.1\\client\\bin");
repoProp.setProperty(RepoPropsConstant.TARGET_REPO_NAME, "EDW_DEV_REPO");
repoProp.setProperty(RepoPropsConstant.REPO_SERVER_DOMAIN_NAME, "DOM_GWM_DEV01");
repoProp.setProperty(RepoPropsConstant.SECURITY_DOMAIN, "MSSB_INFA_DVLPR_DEV");
repoProp.setProperty(RepoPropsConstant.ADMIN_USERNAME, "Username");
repoProp.setProperty(RepoPropsConstant.ADMIN_PASSWORD, "Password");
repoProp.setProperty(RepoPropsConstant.TARGET_FOLDER_NAME,"CORE");
rep.setProperties(repoProp);
rep.setRepositoryConnectionManager(rpMgr);
ConnectionObject connObj = new ConnectionObject("Con", ConnectionAttributes.CONN_TYPE_RELATION);
rep.createConnection(connObj);
I am getting exception
com.informatica.powercenter.sdk.mapfwk.exceptions.ConnectionFailedException: Failed to list connections in PowerCenter Repository
Have anyone done this earlier? Can anyone help me to setup the Java API.
Well, this is really old, and hopefully you ended up getting connected using the SDK. Here's some recent code I put together to get a connection and query some stuff about workflows.
public static void main(String[] args) throws Exception {
if(System.getenv("INFA_DOMAINS_FILE") == null) // make sure .infa file exists
throw new Exception("INFA_DOMAINS_FILE path not set in environment variables.");
Repository rep = new Repository();
RepoConnectionInfo rci = new RepoConnectionInfo();
rci.setRepoServerHost("your host DNS name"); // set host URI
rci.setRepoServerPort("your host port number"); // host port
rci.setRepoServerDomainName("your-domain-name"); // repository domain name
rci.setTargetRepoName("your-repository"); // repository
rci.setSecurityDomain("e-directory"); // security type
rci.setAdminUsername("your-credentials"); // uid
rci.setAdminPassword(getPassword()); // pwd (stored in environment variable -- encoded so it's not cleartext)
rci.setPmrepCacheFolder("c:\\users\\your-credentials\\Informatica\\"); // some cache folder that must be set
rci.setPcClientInstallPath("C:\\Informatica\\9.0.1\\clients\\PowerCenterClient\\client\\bin\\");
rep.setRepoConnectionInfo(rci); // provide connection info to rep object
RepositoryConnectionManager repmgr = new PmrepRepositoryConnectionManager(); // set up repository connection manager
rep.setRepositoryConnectionManager(repmgr); // tell repository to use connection manager
System.out.println("Folders:");
System.out.println("===========================================================================");
List<Folder> folders = rep.getFolders();
for(Folder f: folders) { System.out.println(f);}
}

Exception When Jetty Server Started Remotely- java.net.BindException: Cannot assign requested address: bind

I am fairly new to Jetty and Servlet. Sorry if this sounds really basic. I am using jetty 6.1.22,jetty-util-6.1.22 and Selenium 2.0b2.
I am trying to configure the selenium server in the code so that I can avoid the manual process of starting the selenium
server on the remote host. The wiki[1] notes say- "In theory, the process is as simple as mapping the "DriverServlet" to a URL,
but it's also possible to host the page in a lightweight container, such as Jetty configured entirely in code"
[Edit#1]
Here is what I have so far, basically copy of the code from the RemoteWebDriverServer wiki [1].
If I set the remote host like below, I get bind exception.
public AppServer() throws Exception {
try {
WebAppContext context = new WebAppContext();
context.setContextPath("");
context.setWar(".");
server.addHandler(context);
context.addServlet(DriverServlet.class, "/wd/*");
SelectChannelConnector connector = new SelectChannelConnector();
connector.setHost("MyRemoteHostIPAddress");
connector.setPort(4444);
server.addConnector(connector);
server.start();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void main(String[] args) throws Exception{
new AppServer();
}
}
Here is the stack trace
2011-06-06 14:39:02.618:INFO::Logging to STDERR via org.mortbay.log.StdErrLog
2011-06-06 14:39:02.633:INFO::jetty-6.1.22
2011-06-06 14:39:02.977:WARN::failed SelectChannelConnector#MyRemoteHostIPAddress:4444: java.net.BindException: Cannot assign requested address: bind
2011-06-06 14:39:02.977:WARN::failed Server#b61fd1: java.net.BindException: Cannot assign requested address: bind
Exception in thread "main" java.net.BindException: Cannot assign requested address: bind
at sun.nio.ch.Net.bind(Native Method)
at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
at org.mortbay.jetty.nio.SelectChannelConnector.open(SelectChannelConnector.java:216)
at org.mortbay.jetty.nio.SelectChannelConnector.doStart(SelectChannelConnector.java:315)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.Server.doStart(Server.java:235)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at AppServer.main(AppServer.java:31)
[Edit#2]
Please disregard my first two comments below. I edited the question.
Is there anything I am missing or doing incorrectly?
Thanks,
-Nilesh
[1]http://code.google.com/p/selenium/wiki/RemoteWebDriverServer
I think, the problem is in line:
connector.setHost("MyRemoteHostIPAddress");
Try to replace "MyRemoteHostIPAddress" with "localhost", or direct IP.

How to solve ServiceConstructionException: Could not find definition for service?

I have a simple application with an web service created with Apache CXF. This application works when I run the server and the client (as Java applications). When I try to access the application /services URL which is mapped in web.xml, Tomcat gives me 404 error. When I run the project I receive:
org.apache.cxf.service.factory.ServiceConstructionException: Could not find definition for service {http://sendmessage/}SendMessage
If anyone has any hints related to this error I would be glad to hear them. (I searched google and couldn't find something relevant to my situation)
Thank you!
I had same error, mine was related to namespace which were different in wsdl and webservice. So I changed them to the same.
WSDL:
<wsdl:definitions name=""
targetNamespace="http://www.example.org/yourservice/"
Webservice class:
#WebService(targetNamespace = "http://www.example.org/yourservice/",
.........
Even I had a similar issue.
Fixed it by updating the jaxws:endpoint.
I added the serviceName (mapping to the name present in the WSDL file) with the name space as defined in the "targetNamespace" defined in the wsdl:definitions tag.
<jaxws:endpoint id=".." implementor="..." serviceName="s:SERVICE_NAME_IN_WSDL"
xmlns:s="TARGET_NAME_SPACE_WSDL_DEFINTIONS"></jaxws:endpoint>
edited(06Jul)
Also, I have today that, with Apache CXF 3.0.5 version this issue is not coming;
But with Apache CXF 3.1 version, this is coming.
ServiceConstructionException can occur at various stages when cxf compares the provided service, port and binding name with the wsdl it has already parsed. In this case ( and in most cases) it looks to be namespace issue.
{http://sendmessage/}SendMessage is either not present in parsed wsdl or the service name does not match with the QName present in the WSDL. There are other cases as well where binding or port does not match, one might receive the same exception. Following is a code snippit from org.apache.cxf.wsdl11.WSDLServiceFactory.create() method where it all happens.
If things are not clear why exactly it is happening your best bet is to debug this piece of code and see where it is failing and what is there in parsed wdsl definition (com.ibm.wsdl.DefinitionImpl in wsdl4j.jar).
javax.wsdl.Service wsdlService = definition.getService(serviceName);
if (wsdlService == null) {
if ((!PartialWSDLProcessor.isServiceExisted(definition, serviceName))
&& (!PartialWSDLProcessor.isBindingExisted(definition, serviceName))
&& (PartialWSDLProcessor.isPortTypeExisted(definition, serviceName))) {
try {
Map<QName, PortType> portTypes = CastUtils.cast(definition.getPortTypes());
String existPortName = null;
PortType portType = null;
for (QName existPortQName : portTypes.keySet()) {
existPortName = existPortQName.getLocalPart();
if (serviceName.getLocalPart().contains(existPortName)) {
portType = portTypes.get(existPortQName);
break;
}
}
WSDLFactory factory = WSDLFactory.newInstance();
ExtensionRegistry extReg = factory.newPopulatedExtensionRegistry();
Binding binding = PartialWSDLProcessor.doAppendBinding(definition,
existPortName, portType, extReg);
definition.addBinding(binding);
wsdlService = PartialWSDLProcessor.doAppendService(definition,
existPortName, extReg, binding);
definition.addService(wsdlService);
} catch (Exception e) {
throw new ServiceConstructionException(new Message("NO_SUCH_SERVICE_EXC", LOG, serviceName));
}
} else {
throw new ServiceConstructionException(new Message("NO_SUCH_SERVICE_EXC", LOG, serviceName));
}
PS: I know this issue was opened back in 2011 but recently I faced the same issue and was able to resolve it. I hope it help others who are facing this issue.
Caused by: org.apache.cxf.service.factory.ServiceConstructionException: Could not find definition for port {http://localhost:9990/project/wsdl/targetName}targetNameSoap12.
at org.apache.cxf.wsdl11.WSDLServiceFactory.create(WSDLServiceFactory.java:179)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:428)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:548)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:265)
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:215)
at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:102)
at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:159)
at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:211)
at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:456)
at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:334)
... 13 more
Fixed problem, define at annotation #WebService(targetNameSpace = "targetNameSoap12") in your web service interface and in the contract WSDL.
For exemplo:
...
<wsdl:service name='targetName'>
<wsdl:port binding='tns:targetNameSoap12' name='targetNameSoap12'>
...