SOAP SendMsgRequest results in "missing required attribute: name"

Have a great idea for extending Zimbra? Share ideas, ask questions, contribute, and get feedback.
Post Reply
DaveSmash
Posts: 10
Joined: Tue Mar 06, 2018 1:44 am

SOAP SendMsgRequest results in "missing required attribute: name"

Post by DaveSmash »

I am trying to allow users to send messages from an intranet site without authenticating separately to Zimbra or using the Zimbra web portal. Since I don't store the user's password, I need to use delegate access.

First, I use <AuthRequest xmlns="urn:zimbraAdmin"></AuthRequest> to get an admin token. Then I use <DelegateAuthRequest duration="86400" xmlns="urn:zimbraAdmin"></DelegateAuthRequest> to get a delegate token for the user who is logged into the intranet (delegate tokens are cached until they expire). Both of these requests use the soap admin endpoint and port 7071. I know the delegate token is working because I can use it for REST API requests.

Next I am trying to use the delegate token and the normal endpoint on port 443 to send a message on behalf of the user, but I get a 500 internal server error. mailbox.log indicates I am missing a required attribute (name). Looking at the API reference (https://files.zimbra.com/docs/soap_api/ ... index.html) the only required name attributes I see are part of the <inv> (invite information) (/m/inv/comp/at/xparam@name and /m/inv/comp/alarm/xprop@name are required, all other properties called "name" are optional). I don't even have an <inv> tag, though, since I don't currently need to support invitations, and m/inv is optional. Here is the xml I am sending:

Code: Select all

<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
	<soap:Header>
		<context xmlns="urn:zimbra">
			<authToken>0_0e7ec35...30363b</authToken>
			<session/>
			<account by="name">jreynolds@mydomain.com</account>
			<userAgent name="zclient" version="8.8.6_GA_1906"/>
		</context>
	</soap:Header>
	<soap:Body>
		<SendMsgRequest xmlns="urn:zimbraMail">
			<m su="Test">
				<header></header>
				<content><p>Testing</p></content>
				<e a="jreynolds@mydomain.com" t="f" p="Jimmy Reynolds" />
				<e a="joepublic@gmail.com" t="t" p="Joe Public" />
			</m>
		</SendMsgRequest>
	</soap:Body>
</soap:Envelope>
And here is the relevant part of the mailbox.log:

Code: Select all

2018-04-10 13:34:15,131 INFO  [qtp1595953398-424:https:https://mail.mydomain.com:7071/service/admin/soap] [name=zimbra;ip=10.57.24.1;port=63934;] soap - AuthRequest elapsed=10
2018-04-10 13:34:15,244 INFO  [qtp1595953398-424:https:https://mail.mydomain.com:7071/service/admin/soap] [name=zimbra;ip=10.57.24.1;port=63935;] misc - delegated access: doc=DelegateAuth, authenticated account=zimbra, target account=jreynolds@mydomain.com
2018-04-10 13:34:15,250 INFO  [qtp1595953398-424:https:https://mail.mydomain.com:7071/service/admin/soap] [name=zimbra;ip=10.57.24.1;port=63935;] soap - DelegateAuthRequest elapsed=6
2018-04-10 13:34:15,377 INFO  [qtp1595953398-400:https:https://mail.mydomain.com/service/soap] [name=jreynolds@mydomain.com;aname=zimbra;mid=10;ip=10.57.24.4;port=56540;ua=zclient/8.8.6_GA_1906;] misc - delegated access: doc=SendMsg, delegating account=zimbra, authenticated account=jreynolds@mydomain.com, target account=jreynolds@mydomain.com
2018-04-10 13:34:15,380 WARN  [qtp1595953398-400:https:https://mail.mydomain.com/service/soap] [name=jreynolds@mydomain.com;aname=zimbra;mid=10;ip=10.57.24.4;port=56540;ua=zclient/8.8.6_GA_1906;] SoapEngine - handler exception
com.zimbra.common.service.ServiceException: invalid request: missing required attribute: name
ExceptionId:qtp1595953398-400:https:https://mail.mydomain.com/service/soap:1523381655380:da2da7b9edab24ed
Code:service.INVALID_REQUEST
        at com.zimbra.common.service.ServiceException.INVALID_REQUEST(ServiceException.java:295)
        at com.zimbra.common.soap.Element.checkNull(Element.java:406)
        at com.zimbra.common.soap.Element.getAttribute(Element.java:341)
        at com.zimbra.cs.service.mail.ParseMimeMessage.parseMimeMsgSoap(ParseMimeMessage.java:410)
        at com.zimbra.cs.service.mail.ParseMimeMessage.parseMimeMsgSoap(ParseMimeMessage.java:206)
        at com.zimbra.cs.service.mail.SendMsg.handle(SendMsg.java:178)
        at com.zimbra.cs.service.mail.SendMsg.handle(SendMsg.java:107)
        at com.zimbra.soap.SoapEngine.dispatchRequest(SoapEngine.java:607)
        at com.zimbra.soap.SoapEngine.dispatch(SoapEngine.java:460)
        at com.zimbra.soap.SoapEngine.dispatch(SoapEngine.java:273)
        at com.zimbra.soap.SoapServlet.doWork(SoapServlet.java:303)
        at com.zimbra.soap.SoapServlet.doPost(SoapServlet.java:213)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
        at com.zimbra.cs.servlet.ZimbraServlet.service(ZimbraServlet.java:206)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:821)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1685)
        at com.zimbra.cs.servlet.CsrfFilter.doFilter(CsrfFilter.java:169)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1668)
        at com.zimbra.cs.servlet.RequestStringFilter.doFilter(RequestStringFilter.java:54)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1668)
        at com.zimbra.cs.servlet.SetHeaderFilter.doFilter(SetHeaderFilter.java:59)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1668)
        at com.zimbra.cs.servlet.ETagHeaderFilter.doFilter(ETagHeaderFilter.java:47)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1668)
        at com.zimbra.cs.servlet.ContextPathBasedThreadPoolBalancerFilter.doFilter(ContextPathBasedThreadPoolBalancerFilter.java:107)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1668)
        at com.zimbra.cs.servlet.ZimbraQoSFilter.doFilter(ZimbraQoSFilter.java:107)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1668)
        at com.zimbra.cs.servlet.ZimbraInvalidLoginFilter.doFilter(ZimbraInvalidLoginFilter.java:117)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1668)
        at org.eclipse.jetty.servlets.DoSFilter.doFilterChain(DoSFilter.java:473)
        at org.eclipse.jetty.servlets.DoSFilter.doFilter(DoSFilter.java:318)
        at org.eclipse.jetty.servlets.DoSFilter.doFilter(DoSFilter.java:288)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1668)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:581)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1158)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1090)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
        at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)
        at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:109)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:119)
        at org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:318)
        at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:437)
        at org.eclipse.jetty.server.handler.DebugHandler.handle(DebugHandler.java:84)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:119)
        at org.eclipse.jetty.server.Server.handle(Server.java:517)
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:306)
        at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:242)
        at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:261)
        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
        at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:192)
        at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:261)
        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
        at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:75)
        at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:213)
        at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:147)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)
        at java.lang.Thread.run(Thread.java:748)
2018-04-10 13:34:15,388 INFO  [qtp1595953398-400:https:https://mail.mydomain.com/service/soap] [name=jreynolds@mydomain.com;aname=zimbra;mid=10;ip=10.57.24.4;port=56540;ua=zclient/8.8.6_GA_1906;] soap - SendMsgRequest elapsed=20
Can anybody help me figure out what is going on? Thanks in advance!
DaveSmash
Posts: 10
Joined: Tue Mar 06, 2018 1:44 am

Re: SOAP SendMsgRequest results in "missing required attribute: name"

Post by DaveSmash »

Removing the empty <header></header> tag inside the <m> tag seems to have resolved the issue. According to the documentation, /m/header@name is optional, but apparently it is not...
Post Reply