silverpop / engage-api-client Goto Github PK
View Code? Open in Web Editor NEWEngage API Client Code
License: Apache License 2.0
Engage API Client Code
License: Apache License 2.0
HI,
i am digging into the silverpop api and have just learned about the update_if_found and sync_fields flag of the addrecipient command.
is this supported? they are telling us that using a non keyed database is preferable when combing sms and email into a single DB. In order to update an existing record I went the easy route and set the UPDATE_IF_FOUND flag to true. one of the dbs i was writing to had no unique key set up and i got an error saying i needed to use SYNC_FIELDS on databases with no unique key if the UPDATE_IF_FOUND flag is set.
i don't see support for that here https://github.com/Silverpop/engage-api-client/blob/master/src/main/java/com/silverpop/api/client/command/AddRecipientCommand.java
our support rep sent over the following
`
com.silverpop.api.client.mailing.command.ScheduleMailingSubstitution#ScheduleMailingSubstitution doesn't have any parametric constructor and fields don't have any setters.
Reason: SaveMailingHeader#mailingId annotation has wrong value
@XStreamAlias("MailingId")
private Long mailingId;
Should be:
@XStreamAlias("MailingID")
private Long mailingId;
One can create new mailing template but not update it, since MailingID is required for this operation.
HI,
I found this site and downloaded to test. Ran OAuthClientDemo and got this error.
INFO: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
soap:Body
soap:Fault
soap:Client
Service Operation Identification Failure
26110
Fault Name: ServiceOperationIdentificationFailure
Error Type: Default
Description: Service Operation Identification Failure
Service: EngageApiService
Endpoint: EngageSoapApiClientService
Operation (Client):
</soap:Fault>
</soap:Body>
</soap:Envelope>
Exception in thread "main" com.thoughtworks.xstream.mapper.CannotResolveClassException: soap:Envelope
at com.thoughtworks.xstream.mapper.DefaultMapper.realClass(DefaultMapper.java:79)
at com.thoughtworks.xstream.mapper.MapperWrapper.realClass(MapperWrapper.java:30)
What am I missing?
Thanks!
Client doesn't work with the latest stream (1.4.8, http://x-stream.github.io/download.html), java7
since com.silverpop.api.client.xmlapi.util.XmlApiReflectionProvider#getFieldType is never called.
com.thoughtworks.xstream.converters.ConversionException: Cannot construct com.silverpop.api.client.ApiResult as it does not have a no-args constructor : Cannot construct com.silverpop.api.client.ApiResult as it does not have a no-args constructor
---- Debugging information ----
message : Cannot construct com.silverpop.api.client.ApiResult as it does not have a no-args constructor
cause-exception : com.thoughtworks.xstream.converters.reflection.ObjectAccessException
cause-message : Cannot construct com.silverpop.api.client.ApiResult as it does not have a no-args constructor
class : com.silverpop.api.client.ApiResult
required-type : com.silverpop.api.client.ApiResult
converter-type : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
path : /Envelope/Body/RESULT
class[1] : com.silverpop.api.client.xmlapi.response.XmlApiResponseBody
class[2] : com.silverpop.api.client.xmlapi.response.XmlApiResponseEnvelope
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:79)
at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshallField(AbstractReflectionConverter.java:474)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:406)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:257)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshallField(AbstractReflectionConverter.java:474)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:406)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:257)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:134)
at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32)
at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1185)
at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1169)
at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1040)
at com.silverpop.api.client.xmlapi.XmlApiResponse.processRequest(XmlApiResponse.java:80)
at com.silverpop.api.client.xmlapi.XmlApiResponse.buildErrorResult(XmlApiResponse.java:70)
at com.silverpop.api.client.ApiClient.extractResult(ApiClient.java:130)
at com.silverpop.api.client.ApiClient.validateSessionAndExecuteCommand(ApiClient.java:80)
at com.silverpop.api.client.ApiClient.executeCommand(ApiClient.java:54)
at com.silverpop.api.client.ApiClient.executeCommand(ApiClient.java:49)
at com.silverpop.api.client.xmlapi.XmlApiSession.executeLogin(XmlApiSession.java:106)
at com.silverpop.api.client.xmlapi.XmlApiSession.open(XmlApiSession.java:97)
at com.silverpop.api.client.ApiClient.ensureSessionIsOpen(ApiClient.java:93)
at com.silverpop.api.client.ApiClient.validateSessionAndExecuteCommand(ApiClient.java:70)
at com.silverpop.api.client.ApiClient.executeCommand(ApiClient.java:54)
at com.silverpop.api.client.ApiClient.executeCommand(ApiClient.java:49)
at info.magnolia.silverpop.SilverpopModule.stop(SilverpopModule.java:71)
at info.magnolia.module.ModuleManagerImpl.stopModule(ModuleManagerImpl.java:410)
at info.magnolia.module.ModuleManagerImpl.stopModules(ModuleManagerImpl.java:481)
at info.magnolia.init.MagnoliaServletContextListener.contextDestroyed(MagnoliaServletContextListener.java:194)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4980)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5626)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1575)
at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1564)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.thoughtworks.xstream.converters.reflection.ObjectAccessException: Cannot construct com.silverpop.api.client.ApiResult as it does not have a no-args constructor
at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.newInstance(PureJavaReflectionProvider.java:74)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.instantiateNewInstance(AbstractReflectionConverter.java:553)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:256)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
... 45 more
Some elements are not supported by current implementation:
SEND_TIME_OPTIMIZATION
WA_MAILINGLEVEL_CODE
SUPPRESSION_LISTS
PARENT_FOLDER_PATH
CREATE_PARENT_FOLD ER
CUSTOM_OPT_OUT
SUPPRESSION_LIST_ID
It seems that the API fails to handle Cyrillic letters when sending them to Engage.
Caused by a69e261.
When using com.thoughtworks.xstream.annotations.XStreamImplicit on com.silverpop.api.client.result.SelectRecipientDataResult#columns the result contains list of columns with one column and its name and value are null.
<Envelope> <Body>
<RemoveRecipient>
<LIST_ID>10000</LIST_ID>
<EMAIL>[email protected]</EMAIL>
<COLUMN>
<NAME>Customer Id</NAME>
<VALUE>123-45-6789</VALUE>
</COLUMN>
</RemoveRecipient> </Body>
</Envelope>
Hi,
When executing the following code, an exception is thrown trying to create the APIResult object. It seems to be related to XStream marhalling but i can't seem to get around it. Is this something people have come across? I am using the develop branch.
public static void main(String[] args) throws Exception {
SpringApplication.run(SPController.class, args);
String BASE_URL = "http://apiurl/XMLAPI"; // real url not shared
String clientId = "id";m //real id not shared
String clientSecret = "secret"; //real secret not shared ;)
String refreshToken = "token"; //real token not shared
XmlApiClientFactory clientFactory = new XmlApiClientFactory();
OauthSession oathSession = new OauthSession(clientFactory,BASE_URL,
clientId,clientSecret, refreshToken); //values for properly configured oath app
GetListsCommand getListsCommand = new GetListsCommand();
ApiClient myClient = clientFactory.createClient(oathSession);
GetListsResult result = new GetListsResult();
try {
result = (GetListsResult)myClient.executeCommand(getListsCommand);
} catch (ApiResultException ae) {
ae.printStackTrace();
}
}
The exception is
Exception in thread "restartedMain" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: java.lang.RuntimeException: com.thoughtworks.xstream.converters.ConversionException: Cannot construct com.silverpop.api.client.ApiResult as it does not have a no-args constructor : Cannot construct com.silverpop.api.client.ApiResult as it does not have a no-args constructor
---- Debugging information ----
message : Cannot construct com.silverpop.api.client.ApiResult as it does not have a no-args constructor
cause-exception : com.thoughtworks.xstream.converters.reflection.ObjectAccessException
cause-message : Cannot construct com.silverpop.api.client.ApiResult as it does not have a no-args constructor
class : com.silverpop.api.client.ApiResult
required-type : com.silverpop.api.client.ApiResult
converter-type : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
path : /Envelope/Body/RESULT
class[1] : com.silverpop.api.client.xmlapi.response.XmlApiResponseBody
class[2] : com.silverpop.api.client.xmlapi.response.XmlApiResponseEnvelope
version : not available
-------------------------------
at com.silverpop.api.client.xmlapi.XmlApiResponse.processRequest(XmlApiResponse.java:77)
at com.silverpop.api.client.xmlapi.XmlApiResponse.buildResult(XmlApiResponse.java:52)
at com.silverpop.api.client.ApiClient.extractResult(ApiClient.java:114)
at com.silverpop.api.client.ApiClient.validateSessionAndExecuteCommand(ApiClient.java:70)
at com.silverpop.api.client.ApiClient.executeCommand(ApiClient.java:43)
at com.silverpop.api.client.ApiClient.executeCommand(ApiClient.java:38)
at com.platformq.silverpop.SPController.main(SPController.java:104)
... 5 more
Caused by: com.thoughtworks.xstream.converters.ConversionException: Cannot construct com.silverpop.api.client.ApiResult as it does not have a no-args constructor : Cannot construct com.silverpop.api.client.ApiResult as it does not have a no-args constructor
---- Debugging information ----
message : Cannot construct com.silverpop.api.client.ApiResult as it does not have a no-args constructor
cause-exception : com.thoughtworks.xstream.converters.reflection.ObjectAccessException
cause-message : Cannot construct com.silverpop.api.client.ApiResult as it does not have a no-args constructor
class : com.silverpop.api.client.ApiResult
required-type : com.silverpop.api.client.ApiResult
converter-type : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
path : /Envelope/Body/RESULT
class[1] : com.silverpop.api.client.xmlapi.response.XmlApiResponseBody
class[2] : com.silverpop.api.client.xmlapi.response.XmlApiResponseEnvelope
version : not available
-------------------------------
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:79)
at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshallField(AbstractReflectionConverter.java:480)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:412)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:263)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshallField(AbstractReflectionConverter.java:480)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:412)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:263)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:134)
at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32)
at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1206)
at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1190)
at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1061)
at com.silverpop.api.client.xmlapi.XmlApiResponse.processRequest(XmlApiResponse.java:75)
... 11 more
Caused by: com.thoughtworks.xstream.converters.reflection.ObjectAccessException: Cannot construct com.silverpop.api.client.ApiResult as it does not have a no-args constructor
at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.newInstance(PureJavaReflectionProvider.java:74)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.instantiateNewInstance(AbstractReflectionConverter.java:559)
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:262)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
... 32 more
The XmlApiClient is not threadsafe because the constructor calls this super-constructor:
protected ApiClient(ApiCommandProcessor<REQUEST> commandProcessor, ApiSession session) {
this(commandProcessor, new HttpClient(), session);
}
The problem here is, that new HttpClient() constructs a HttpClient with a SimpleHttpConnectionManager and this can cause an Exception and this log message:
WARN org.apache.commons.httpclient.SimpleHttpConnectionManager - SimpleHttpConnectionManager being used incorrectly. Be sure that HttpMethod.releaseConnection() is always called and that only one thread and/or method is using this connection manager at a time.
In my opinion the HttpClient which is used should be injected and build and configured elsewhere. Or it should be constructed with a MultiThreadedHttpConnectionManager.
But maybe the whole ApiClient is not meant to be threadsafe - that's why I'd like to discuss this issue before implementing a fix. What do you think?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.