Can't Add mailing with API 2

Use this forum for all questions related to the source code of OpenEMM

Moderator: moderator

Can't Add mailing with API 2

Postby paul » Thu Feb 14, 2013 5:20 pm

Hello,

I'm trying to use the new openemm API, with given PHP class WsseSoapClient and example.

Methods like ListMailinglists, ListMailings or AddMailingFromTemplate work fine.
But with AddMailing (and Update), i have a exception from the server ([SOAP-ENV:Server] Unknown error in ...)

When i read the openemm-ws logs, i found exceptions corresponding to this error:
Code: Select all
2013-02-14 16:51:14,147: ERROR [http-8080-8] org.agnitas.dao.impl.CompanyDaoImpl - Error processing company 1: Property 'sessionFactory' is required
java.lang.IllegalArgumentException: Property 'sessionFactory' is required
   at org.springframework.orm.hibernate3.HibernateAccessor.afterPropertiesSet(HibernateAccessor.java:314)
   at org.springframework.orm.hibernate3.HibernateTemplate.<init>(HibernateTemplate.java:139)
   at org.agnitas.dao.impl.CompanyDaoImpl.getCompany(CompanyDaoImpl.java:43)
   at org.agnitas.util.AgnTagUtils.processTag(AgnTagUtils.java:188)
   at org.agnitas.beans.impl.MailingImpl.scanForLinks(MailingImpl.java:524)
   at org.agnitas.beans.impl.MailingImpl.scanForLinks(MailingImpl.java:317)
   at org.agnitas.beans.impl.MailingImpl.buildDependencies(MailingImpl.java:1458)
   at org.agnitas.beans.impl.MailingImpl.buildDependencies(MailingImpl.java:1430)
   at org.agnitas.emm.core.mailing.service.impl.MailingServiceImpl.addMailing(MailingServiceImpl.java:94)
   at sun.reflect.GeneratedMethodAccessor230.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
   at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:50)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:160)
   at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy15.addMailing(Unknown Source)
   at org.agnitas.emm.springws.endpoint.mailing.AddMailingEndpoint.invokeInternal(AddMailingEndpoint.java:48)
   at org.springframework.ws.server.endpoint.AbstractMarshallingPayloadEndpoint.invoke(AbstractMarshallingPayloadEndpoint.java:131)
   at org.springframework.ws.server.endpoint.adapter.MessageEndpointAdapter.invoke(MessageEndpointAdapter.java:41)
   at org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:228)
   at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:170)
   at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:88)
   at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:57)
   at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:230)
   at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
   at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:615)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
   at java.lang.Thread.run(Thread.java:662)
2013-02-14 16:51:14,147: ERROR [http-8080-8] org.agnitas.emm.core.mailing.service.impl.MailingServiceImpl -
java.lang.NullPointerException
   at org.agnitas.util.AgnTagUtils.processTag(AgnTagUtils.java:188)
   at org.agnitas.beans.impl.MailingImpl.scanForLinks(MailingImpl.java:524)
   at org.agnitas.beans.impl.MailingImpl.scanForLinks(MailingImpl.java:317)
   at org.agnitas.beans.impl.MailingImpl.buildDependencies(MailingImpl.java:1458)
   at org.agnitas.beans.impl.MailingImpl.buildDependencies(MailingImpl.java:1430)
   at org.agnitas.emm.core.mailing.service.impl.MailingServiceImpl.addMailing(MailingServiceImpl.java:94)
   at sun.reflect.GeneratedMethodAccessor230.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
   at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:50)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:160)
   at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy15.addMailing(Unknown Source)
   at org.agnitas.emm.springws.endpoint.mailing.AddMailingEndpoint.invokeInternal(AddMailingEndpoint.java:48)
   at org.springframework.ws.server.endpoint.AbstractMarshallingPayloadEndpoint.invoke(AbstractMarshallingPayloadEndpoint.java:131)
   at org.springframework.ws.server.endpoint.adapter.MessageEndpointAdapter.invoke(MessageEndpointAdapter.java:41)
   at org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:228)
   at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:170)
   at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:88)
   at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:57)
   at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:230)
   at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
   at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:615)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
   at java.lang.Thread.run(Thread.java:662)
2013-02-14 16:51:14,148: DEBUG [http-8080-8] org.agnitas.emm.springws.exceptionresolver.CommonExceptionResolver - Resolving exception from endpoint [org.agnitas.emm.springws.endpoint.mailing.AddMailingEndpoint@1e54e00]: java.lang.RuntimeException: java.lang.NullPointerException
2013-02-14 16:51:14,148: ERROR [http-8080-8] org.agnitas.emm.springws.exceptionresolver.CommonExceptionResolver - Exception
java.lang.RuntimeException: java.lang.NullPointerException
   at org.agnitas.emm.core.mailing.service.impl.MailingServiceImpl.addMailing(MailingServiceImpl.java:97)
   at sun.reflect.GeneratedMethodAccessor230.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
   at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:50)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:160)
   at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy15.addMailing(Unknown Source)
   at org.agnitas.emm.springws.endpoint.mailing.AddMailingEndpoint.invokeInternal(AddMailingEndpoint.java:48)
   at org.springframework.ws.server.endpoint.AbstractMarshallingPayloadEndpoint.invoke(AbstractMarshallingPayloadEndpoint.java:131)
   at org.springframework.ws.server.endpoint.adapter.MessageEndpointAdapter.invoke(MessageEndpointAdapter.java:41)
   at org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:228)
   at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:170)
   at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:88)
   at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:57)
   at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:230)
   at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
   at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:615)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
   at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.NullPointerException
   at org.agnitas.util.AgnTagUtils.processTag(AgnTagUtils.java:188)
   at org.agnitas.beans.impl.MailingImpl.scanForLinks(MailingImpl.java:524)
   at org.agnitas.beans.impl.MailingImpl.scanForLinks(MailingImpl.java:317)
   at org.agnitas.beans.impl.MailingImpl.buildDependencies(MailingImpl.java:1458)
   at org.agnitas.beans.impl.MailingImpl.buildDependencies(MailingImpl.java:1430)
   at org.agnitas.emm.core.mailing.service.impl.MailingServiceImpl.addMailing(MailingServiceImpl.java:94)
   ... 41 more

But i don't see the relation betwenn this exception and my php source code:
Code: Select all
$client->AddMailing(array(
   'shortname' => 'shortname',
   'description' => 'description',
   'mailingType' => 'regular',
   'mailinglistID' => 47,
   'targetIDList' => 1,
   'matchTargetGroups' => 'one',
   'subject' => 'subject',
   'senderAddress' => 'xxx@xxx.de',
   'senderName' => 'etst',
   'replyToName' => 'xxx',
   'replyToAddress' => 'xxx@xxx.de',
   'charset' => 'UTF-8',
   'linefeed' => 72,
   'format' => 'text',
   'onePixel' => 'bottom'
   )
);
   )
);


... and the produced xml:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
   xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
   xmlns:ns1="http://agnitas.org/ws/schemas">
   <SOAP-ENV:Header>
      <wsse:Security
         xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
         xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
         <wsse:UsernameToken
            xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
            <wsse:Username>webservice</wsse:Username>
            <wsse:Password
               Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">DnCpB4mUGzbBSMkdk1rB+gWHtwY=</wsse:Password>
            <wsse:Nonce
               EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">NGE2OGRiMmJmNmZjMTM2YWEyOTc=</wsse:Nonce>
            <wsu:Created
               xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2013-02-14T16:12:54Z</wsu:Created>
         </wsse:UsernameToken>
      </wsse:Security>
   </SOAP-ENV:Header>
   <SOAP-ENV:Body>
      <ns1:AddMailingRequest>
         <ns1:shortname>shortname</ns1:shortname>
         <ns1:description>description</ns1:description>
         <ns1:mailinglistID>47</ns1:mailinglistID>
         <ns1:targetIDList />
         <ns1:matchTargetGroups>one</ns1:matchTargetGroups>
         <ns1:mailingType>regular</ns1:mailingType>
         <ns1:subject>subject</ns1:subject>
         <ns1:senderName>etst</ns1:senderName>
         <ns1:senderAddress>xxx@xxx.de</ns1:senderAddress>
         <ns1:replyToName>xxx</ns1:replyToName>
         <ns1:replyToAddress>xxx@xxx.de</ns1:replyToAddress>
         <ns1:charset>UTF-8</ns1:charset>
         <ns1:linefeed>72</ns1:linefeed>
         <ns1:format>text</ns1:format>
         <ns1:onePixel>bottom</ns1:onePixel>
      </ns1:AddMailingRequest>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>


Do you have any idea or solution for this problem?

Best regards,
paul
 
Posts: 3
Joined: Thu Feb 14, 2013 4:58 pm

Re: Can't Add mailing with API 2

Postby maschoff » Fri Feb 15, 2013 10:57 am

Yes, this might be a bugfix:

Open file applicationContext-dao.xml in directory /home/openemm/webapps/openemm-ws/WEB-INF and replace
Code: Select all
<bean id="CompanyDao" class="org.agnitas.dao.impl.CompanyDaoImpl"/>

with
Code: Select all
<bean id="CompanyDao" class="org.agnitas.dao.impl.CompanyDaoImpl">
  <property name="sessionFactory" ref="sessionFactory" />
</bean>

Restart OpenEMM afterwards. Does this work for you?
OpenEMM Maintainer
maschoff
Site Admin
 
Posts: 2129
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany

Re: Can't Add mailing with API 2

Postby paul » Fri Feb 15, 2013 5:39 pm

Yes it's working now!

Thank you!
paul
 
Posts: 3
Joined: Thu Feb 14, 2013 4:58 pm

Re: Can't Add mailing with API 2

Postby maschoff » Fri Feb 15, 2013 5:45 pm

Thanks for hunting down this bug! :-)
OpenEMM Maintainer
maschoff
Site Admin
 
Posts: 2129
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany

Re: Can't Add mailing with API 2

Postby faris » Mon Jan 20, 2014 1:16 pm

You can find the source code in the ZIP file in directory /src/org/agnitas/emm/plugin/mailingstatisticsexport.
faris
 
Posts: 1
Joined: Mon Jan 20, 2014 1:15 pm


Return to Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron