WebService 2.0 SendMailing problem.

Use this forum for questions regarding adoption and functionality of OpenEMM

Moderator: moderator

ninjaemm
Posts: 1
Joined: Thu Nov 28, 2013 11:34 am

WebService 2.0 SendMailing problem.

Post by ninjaemm » Thu Nov 28, 2013 12:01 pm

Hello,

I am trying to integrate Openemm functionality in my CMS.
While multiple functions are working perfectly, I'm having trouble using the SendMailing method in Web Services 2.0

The function im using is:$this->openemm->SendMailing(5004,'T',$data->sendtime);

The error i'm getting is: 'send date is required'

I am attaching the complete log file:

Code: Select all

2013-11-28 10:39:55,156: DEBUG [http-8080-2] org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter - Accepting incoming [org.springframework.ws.transport.http.HttpServletConnection@1fe20120] to [http://test.com:8080/openemm-ws2/]
2013-11-28 10:39:55,435: DEBUG [http-8080-2] org.springframework.ws.server.MessageTracing.received - Received request [<?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><wsse:Username>admin</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">oTIbmFHWBEFNvVY8dsaoKNasdO5Muq988=</wsse:Password><wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">NjU5MmU2NdGFhNTdAzZTldsahNdasWUyMTU=</wsse:Nonce><wsu:Created>2013-11-28T10:39:51Z</wsu:Created></wsse:UsernameToken></wsse:Security></SOAP-ENV:Header><SOAP-ENV:Body><ns1:SendMailingRequest/><param1>T</param1><param2>1385636991</param2></SOAP-ENV:Body></SOAP-ENV:Envelope>]
2013-11-28 10:39:55,437: DEBUG [http-8080-2] org.agnitas.emm.springws.security.SpringDigestPasswordValidationCallbackHandler - Authentication success: org.springframework.security.providers.UsernamePasswordAuthenticationToken@89b57890: Principal: org.springframework.security.userdetails.User@ff43bd00: Username: admin; Password: [PROTECTED]; Enabled: true; AccountNonExpired: true; credentialsNonExpired: true; AccountNonLocked: true; Granted Authorities: USER_1; Password: [PROTECTED]; Authenticated: false; Details: null; Not granted any authorities
2013-11-28 10:39:55,438: DEBUG [http-8080-2] org.agnitas.emm.springws.endpoint.mailing.SendMailingEndpoint - Unmarshalled payload request to [org.agnitas.emm.springws.jaxb.SendMailingRequest@7aee513]
2013-11-28 10:39:55,438: DEBUG [http-8080-2] org.agnitas.emm.core.validator.ModelValidator - formName:sendMailing, model:org.agnitas.emm.core.mailing.service.MailingModel
2013-11-28 10:39:55,438: DEBUG [http-8080-2] org.agnitas.emm.springws.exceptionresolver.CommonExceptionResolver - Resolving exception from endpoint [org.agnitas.emm.springws.endpoint.mailing.SendMailingEndpoint@f5e12]: java.lang.IllegalArgumentException: send date is required
2013-11-28 10:39:55,439: ERROR [http-8080-2] org.agnitas.emm.springws.exceptionresolver.CommonExceptionResolver - Exception
java.lang.IllegalArgumentException: send date is required
        at org.agnitas.emm.core.validator.ModelValidator.checkResults(ModelValidator.java:61)
        at org.agnitas.emm.core.validator.ModelValidator.validate(ModelValidator.java:47)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:627)
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:609)
        at org.springframework.aop.aspectj.AspectJMethodBeforeAdvice.before(AspectJMethodBeforeAdvice.java:39)
        at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:49)
        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.sendMailing(Unknown Source)
        at org.agnitas.emm.springws.endpoint.mailing.SendMailingEndpoint.invokeInternal(SendMailingEndpoint.java:35)
        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:103)
        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:861)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:662)
2013-11-28 10:39:55,439: DEBUG [http-8080-2] org.springframework.ws.server.MessageTracing.sent - Sent response [<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Client</faultcode><faultstring xml:lang="en-US">send date is required</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>] for request [<?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><wsse:Username>admin</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">oTIbmFgfdgdfge5345HWBEFffffffNvVY8oKNO55345436gdfgMuqttzzzc988=</wsse:Password><wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">NjfsdfsdfvcvvvvvU5MmU2NGFhfer3d44442ZZZZNTAzZTdddlhNWdUfdfsdfyMTU=</wsse:Nonce><wsu:Created>2013-11-28T10:39:51Z</wsu:Created></wsse:UsernameToken></wsse:Security></SOAP-ENV:Header><SOAP-ENV:Body><ns1:SendMailingRequest/><param1>T</param1><param2>1385636991</param2></SOAP-ENV:Body></SOAP-ENV:Envelope>]
2013-11-28 10:39:55,440: DEBUG [http-8080-2] org.springframework.ws.transport.http.MessageDispatcherServlet - Successfully completed request

maschoff
Site Admin
Posts: 2147
Joined: Thu Aug 03, 2006 10:20 am
Location: Munich, Germany
Contact:

Re: WebService 2.0 SendMailing problem.

Post by maschoff » Fri Nov 29, 2013 10:28 pm

So, what is your problem?
OpenEMM Maintainer

zanuda
Posts: 6
Joined: Mon Mar 03, 2014 12:00 pm

Re: WebService 2.0 SendMailing problem.

Post by zanuda » Fri Sep 26, 2014 3:05 pm

Hello!

I have the same problem. I try to call SendMailing method with 'test' delivery and receive error 'send date is requarted'. I've tried to substitute fixed values of senddate or use the functions like Now(), the result haven't changed. May be I use the wrong format of the date? Or may be it is a bug?

mdoerschmidt
Posts: 19
Joined: Fri Jan 04, 2013 8:55 am

Re: WebService 2.0 SendMailing problem.

Post by mdoerschmidt » Fri Sep 26, 2014 4:12 pm

Hi!

The body of your SOAP request is invalid. It is:

<ns1:SendMailingRequest/>
<param1>T</param1>
<param2>1385636991</param2>


The body should look like:

<ns2:SendMailingRequest xmlns:ns2="http://agnitas.org/ws/schemas">
<ns2:mailingID>12345</ns2:mailingID>
<ns2:recipientsType>world</ns2:recipientsType>
<ns2:sendDate>2014-09-26 18:30:00 CEST</ns2:sendDate>
<ns2:blockSize>0</ns2:blockSize>
<ns2:stepping>0</ns2:stepping>
</ns2:SendMailingRequest>


Best regards,

Markus

zanuda
Posts: 6
Joined: Mon Mar 03, 2014 12:00 pm

Re: WebService 2.0 SendMailing problem.

Post by zanuda » Tue Sep 30, 2014 8:56 am

Hi!

This is my request

<soap:Body><SendMailingRequest xmlns="http://agnitas.org/ws/schemas">
<mailingID>92</mailingID>
<recipientsType>test</recipientsType>
<sendDate>2014-09-29T18:23:30</sendDate>
</SendMailingRequest></soap:Body>

It seems parameters have right names and values, but error still appears.

lemonfriend
Posts: 5
Joined: Wed Oct 22, 2014 3:58 pm

Re: WebService 2.0 SendMailing problem.

Post by lemonfriend » Wed Oct 22, 2014 4:05 pm

Same here.

In Java "xs:dateTime" suggests using the XMLGregorianCalendar class. My use of XMLGregorianCalendar results in a sendDate in this format: <sendDate>2014-10-22T16:40:18.004Z</sendDate>. This is the standard date format and also used by WS 2.0 for authentication, for example,

SendMailing only works if I manually manipulate the date to read <sendDate>2014-10-22 16:51:00 CEST</sendDate>
Since I'm using the JAX-WS generated Java classes, lower level manipulation of date strings isn't really an option.
Last edited by lemonfriend on Wed Oct 22, 2014 4:47 pm, edited 1 time in total.

lemonfriend
Posts: 5
Joined: Wed Oct 22, 2014 3:58 pm

Re: WebService 2.0 SendMailing problem.

Post by lemonfriend » Wed Oct 22, 2014 4:15 pm

What helped is to modify the generated Java classes for the webservice to accept a String argument instead of XMLGregorianCalendar.

Maybe the WSDL should be adapted from
<xs:element name="sendDate" type="xs:dateTime"/>
to
<xs:element name="sendDate" type="xs:string"/>
,too (or get the WS to accept the xs:dateTime date format)

lemonfriend
Posts: 5
Joined: Wed Oct 22, 2014 3:58 pm

Re: WebService 2.0 SendMailing problem.

Post by lemonfriend » Wed Oct 22, 2014 4:42 pm

... and, if you're not in an english-speaking locale, you'd have to use e.g. the US Locale for your date string:

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z", Locale.US); // use US locale; WS won't accept "MESZ" for example.
String date = sdf.format(new Date());
sendMailingRequest.setSendDate(date);

mdoerschmidt
Posts: 19
Joined: Fri Jan 04, 2013 8:55 am

Re: WebService 2.0 SendMailing problem.

Post by mdoerschmidt » Mon Nov 10, 2014 3:38 pm

Hi zanuda,

your request is okay, but there is missing the timezone information in your timestamp. According to the XML schema, timezone in required and the server will reject your request when it is missing.

I'm not sure, if "MESZ" is a valid time zone. Use the English abbreviations instead ("CEST" instead of "MESZ").


Best regards,

Markus

Post Reply