You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Dennis Sosnoski (JIRA)" <ax...@ws.apache.org> on 2005/06/01 23:05:52 UTC

[jira] Commented: (AXIS-1996) Axis fails processing request message with empty body

     [ http://issues.apache.org/jira/browse/AXIS-1996?page=comments#action_66785 ]
     
Dennis Sosnoski commented on AXIS-1996:
---------------------------------------

Yes, I mean that the SOAP Body element may be empty. This doesn't really have a WSDL equivalent as far as I know, since in WSDL the message parts are never optional, but in practical terms it can be very useful for the user to just define a message-style service with only one operation so that a single method is called no matter what is present in the SOAP Body. The whole point of message-style is that you get a DOM in and a DOM out, after all, so there's often no reason to define multiple operations.

The JavaServiceDesc.getOperationsByQName() already handles this case, but the MsgProvider.processMessage() code bombs out before the call to JavaServiceDesc.getOperationsByQName()

For my client's needs we ended up using a handler to set the operation during the inbound message processing. That way MsgProvider.processMessage() doesn't try digging into the child element of the Body. It's a kludge, though.

> Axis fails processing request message with empty body
> -----------------------------------------------------
>
>          Key: AXIS-1996
>          URL: http://issues.apache.org/jira/browse/AXIS-1996
>      Project: Axis
>         Type: Bug
>   Components: Basic Architecture
>     Versions: 1.2
>     Reporter: Dennis Sosnoski

>
> org.apache.axis.providers.java.MsgProvider.processMessage() starts by checking if the operation has already been set in the message context, and if not tries to determine it based on the first body element. If there is no child element of the SOAP Body it then fails with a Fault response:
>         
>         if (operation == null) {
>             Vector bodyElements = reqEnv.getBodyElements();
>             if(bodyElements.size() > 0) {
>                 MessageElement element = (MessageElement) bodyElements.get(0);
>                 if (element != null) {
>                     opQName = new QName(element.getNamespaceURI(),
>                             element.getLocalName());
>                     operation = serviceDesc.getOperationByElementQName(opQName);
>                 }
>             }
>         }
>         if (operation == null) {
>             throw new AxisFault(Messages.getMessage("noOperationForQName",
>                                 opQName == null ? "null" : opQName.toString()));
>         }
> It should be legal to define a message-style service with only one operation, in which the body is optional. To do this, the code only needs to be changed so that the element == null case just gets the single operation defined. This is implemented in org.apache.axis.description.JavaServiceDesc.getOperationsByQName(), which returns the single operation for any supplied element name, but it doesn't get called unless a child element of the body is present. The MsgProvider.processMessage() code should either substitute a dummy element (such as one with an empty name and namespace) or use another means to look up the single operation when no body element is present.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira