You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Chris Hyzer <mc...@yahoo.com> on 2011/07/22 01:50:30 UTC

need to not send elements if null

I am doing generic axis java2wsdl then wsdl2java to manage a 
service, and for backward compatibility I would not like to send null on new attributes I add to beans.  For instance, I have a field that is a 
bean, and it sends null.  I would like it to just not send the field for that one.  Is there an annotation or configuration or manual wsdl 
change (would rather not, but its ok if its the only way) to make this 
happen?

Im at axis2 1.4.1.

Here is an example response, and I would like


<ns:wsAttributeAssignDisallowed xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:nil="true" />

to just not be there if it is null...

Sorry if this is simple and its in the docs, having trouble finding it...  if this is not possible, then Im 
not sure how to version new services without doing a lot of work...  
thanks!

<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
  <soapenv:Body>
    <ns:assignPermissionsResponse xmlns:ns="http://soap.ws.grouper.middleware.internet2.edu/xsd">
      <ns:return type="edu.internet2.middleware.grouper.ws.soap.WsAssignPermissionsResults">
        <ns:responseMetadata type="edu.internet2.middleware.grouper.ws.soap.WsResponseMeta">
          <ns:millis>7062</ns:millis>
         
 <ns:resultWarnings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:nil="true" />
          <ns:serverVersion>2.0.0</ns:serverVersion>
        </ns:responseMetadata>
        <ns:resultMetadata type="edu.internet2.middleware.grouper.ws.soap.WsResultMeta">
          <ns:params xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:nil="true" />
          <ns:resultCode>SUCCESS</ns:resultCode>
          <ns:resultCode2
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:nil="true" />
          <ns:resultMessage>, Found 2 results.</ns:resultMessage>
          <ns:success>T</ns:success>
        </ns:resultMetadata>
        <ns:wsAssignPermissionResults
          type="edu.internet2.middleware.grouper.ws.soap.WsAssignPermissionResult">
          <ns:changed>F</ns:changed>
          <ns:deleted>F</ns:deleted>
         
 <ns:wsAttributeAssigns
            type="edu.internet2.middleware.grouper.ws.soap.WsAttributeAssign">
            <ns:attributeAssignActionId>7168780da86a4ae0a310be95b18794a5
            </ns:attributeAssignActionId>
            <ns:attributeAssignActionName>read</ns:attributeAssignActionName>
            <ns:attributeAssignActionType>immediate</ns:attributeAssignActionType>
            <ns:attributeAssignDelegatable>FALSE</ns:attributeAssignDelegatable>
           
 <ns:attributeAssignType>group</ns:attributeAssignType>
            <ns:attributeDefId>cec7bc3d6de4429cb39d223b4ea75532</ns:attributeDefId>
            <ns:attributeDefName>aStem:permissionDef</ns:attributeDefName>
            <ns:attributeDefNameId>7376941c7e2d40a8b97b61d22d777bdb
            </ns:attributeDefNameId>
            <ns:attributeDefNameName>aStem:permissionDefName</ns:attributeDefNameName>
            <ns:createdOn>2011/07/21 17:03:17.922</ns:createdOn>
           
 <ns:disabledTime xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:nil="true" />
            <ns:enabled>T</ns:enabled>
            <ns:enabledTime xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:nil="true" />
            <ns:id>44fc019e6ae542ef91259ab609279840</ns:id>
            <ns:lastUpdated>2011/07/21 17:03:17.922</ns:lastUpdated>
            <ns:notes
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:nil="true" />
            <ns:ownerAttributeAssignId xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:nil="true" />
            <ns:ownerAttributeDefId xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:nil="true" />
            <ns:ownerAttributeDefName xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:nil="true"
 />
            <ns:ownerGroupId>619f58b2f6434c16863bdb5d2dbeae73</ns:ownerGroupId>
            <ns:ownerGroupName>aStem:role</ns:ownerGroupName>
            <ns:ownerMemberId xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:nil="true" />
            <ns:ownerMemberSourceId xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:nil="true" />
            <ns:ownerMemberSubjectId
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:nil="true" />
            <ns:ownerMembershipId xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:nil="true" />
            <ns:ownerStemId xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:nil="true" />
            <ns:ownerStemName xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:nil="true"
 />
            <ns:wsAttributeAssignDisallowed xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:nil="true" />
            <ns:wsAttributeAssignValues xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:nil="true" />
          </ns:wsAttributeAssigns>
        </ns:wsAssignPermissionResults>
        <ns:wsAssignPermissionResults
         
 type="edu.internet2.middleware.grouper.ws.soap.WsAssignPermissionResult">
          <ns:changed>F</ns:changed>
          <ns:deleted>F</ns:deleted>
          <ns:wsAttributeAssigns
            type="edu.internet2.middleware.grouper.ws.soap.WsAttributeAssign">
            <ns:attributeAssignActionId>22f0a793930546ed9a471c42b5111a7c
            </ns:attributeAssignActionId>
            <ns:attributeAssignActionName>write</ns:attributeAssignActionName>
           
 <ns:attributeAssignActionType>immediate</ns:attributeAssignActionType>
            <ns:attributeAssignDelegatable>FALSE</ns:attributeAssignDelegatable>
            <ns:attributeAssignType>group</ns:attributeAssignType>
            <ns:attributeDefId>cec7bc3d6de4429cb39d223b4ea75532</ns:attributeDefId>
            <ns:attributeDefName>aStem:permissionDef</ns:attributeDefName>
            <ns:attributeDefNameId>7376941c7e2d40a8b97b61d22d777bdb
           
 </ns:attributeDefNameId>
            <ns:attributeDefNameName>aStem:permissionDefName</ns:attributeDefNameName>
            <ns:createdOn>2011/07/21 17:44:28.857</ns:createdOn>
            <ns:disabledTime xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:nil="true" />
            <ns:enabled>T</ns:enabled>
            <ns:enabledTime xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:nil="true"
 />
            <ns:id>1746701328e7421dbfc553966d57f207</ns:id>
            <ns:lastUpdated>2011/07/21 17:44:28.857</ns:lastUpdated>
            <ns:notes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:nil="true" />
            <ns:ownerAttributeAssignId xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:nil="true" />
            <ns:ownerAttributeDefId
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:nil="true" />
            <ns:ownerAttributeDefName xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:nil="true" />
            <ns:ownerGroupId>619f58b2f6434c16863bdb5d2dbeae73</ns:ownerGroupId>
            <ns:ownerGroupName>aStem:role</ns:ownerGroupName>
            <ns:ownerMemberId xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:nil="true"
 />
            <ns:ownerMemberSourceId xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:nil="true" />
            <ns:ownerMemberSubjectId xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:nil="true" />
            <ns:ownerMembershipId xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:nil="true" />
            <ns:ownerStemId
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:nil="true" />
            <ns:ownerStemName xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:nil="true" />
            <ns:wsAttributeAssignDisallowed xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:nil="true" />
            <ns:wsAttributeAssignValues xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:nil="true"
 />
          </ns:wsAttributeAssigns>
        </ns:wsAssignPermissionResults>
        <ns:wsAttributeDefNames
          type="edu.internet2.middleware.grouper.ws.soap.WsAttributeDefName">
          <ns:attributeDefId>cec7bc3d6de4429cb39d223b4ea75532</ns:attributeDefId>
          <ns:attributeDefName>aStem:permissionDef</ns:attributeDefName>
          <ns:description xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:nil="true" />
         
 <ns:displayExtension>permissionDefName</ns:displayExtension>
          <ns:displayName>a stem:permissionDefName</ns:displayName>
          <ns:extension>permissionDefName</ns:extension>
          <ns:name>aStem:permissionDefName</ns:name>
          <ns:uuid>7376941c7e2d40a8b97b61d22d777bdb</ns:uuid>
        </ns:wsAttributeDefNames>
        <ns:wsAttributeDefs type="edu.internet2.middleware.grouper.ws.soap.WsAttributeDef">
          <ns:assignableTos
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:nil="true" />
          <ns:attributeDefType>perm</ns:attributeDefType>
          <ns:description xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:nil="true" />
          <ns:extension>permissionDef</ns:extension>
          <ns:multiAssignable>F</ns:multiAssignable>
          <ns:multiValued>F</ns:multiValued>
         
 <ns:name>aStem:permissionDef</ns:name>
          <ns:uuid>cec7bc3d6de4429cb39d223b4ea75532</ns:uuid>
          <ns:valueType>marker</ns:valueType>
        </ns:wsAttributeDefs>
        <ns:wsGroups type="edu.internet2.middleware.grouper.ws.soap.WsGroup">
          <ns:description xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:nil="true" />
          <ns:detail xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:nil="true"
 />
          <ns:displayExtension>role</ns:displayExtension>
          <ns:displayName>a stem:role</ns:displayName>
          <ns:extension>role</ns:extension>
          <ns:name>aStem:role</ns:name>
          <ns:uuid>619f58b2f6434c16863bdb5d2dbeae73</ns:uuid>
        </ns:wsGroups>
      </ns:return>
    </ns:assignPermissionsResponse>
  </soapenv:Body>
</soapenv:Envelope>