Page 1 of 1

WebService 2.0 SendMailing problem.

Posted: Thu Nov 28, 2013 12:01 pm
by ninjaemm
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

Re: WebService 2.0 SendMailing problem.

Posted: Fri Nov 29, 2013 10:28 pm
by maschoff
So, what is your problem?

Re: WebService 2.0 SendMailing problem.

Posted: Fri Sep 26, 2014 3:05 pm
by zanuda
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?

Re: WebService 2.0 SendMailing problem.

Posted: Fri Sep 26, 2014 4:12 pm
by mdoerschmidt
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

Re: WebService 2.0 SendMailing problem.

Posted: Tue Sep 30, 2014 8:56 am
by zanuda
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.

Re: WebService 2.0 SendMailing problem.

Posted: Wed Oct 22, 2014 4:05 pm
by lemonfriend
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.

Re: WebService 2.0 SendMailing problem.

Posted: Wed Oct 22, 2014 4:15 pm
by lemonfriend
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)

Re: WebService 2.0 SendMailing problem.

Posted: Wed Oct 22, 2014 4:42 pm
by lemonfriend
... 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);

Re: WebService 2.0 SendMailing problem.

Posted: Mon Nov 10, 2014 3:38 pm
by mdoerschmidt
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