我已经配置了HTTPServiceTransport服务以在后期发送XML。
一切都很好,但是即使没有数据导致API提供者端的验证错误,它也会生成标记。
有没有一种方法可以将条件放入映射中,如果不满足条件则不生成标签?
下面突出显示的是多余的标签
<b:LICENSE_DETAIL>
<b:LicenseAuthorityLevelType>Private
</b:LicenseAuthorityLevelType>
<b:LicenseIdentifier>1304152</b:LicenseIdentifier>
<b:LicenseIssuingAuthorityName>NMLS
</b:LicenseIssuingAuthorityName>
<!-- want to exclude below null tags-->
<b:LicenseIssueDate />
<b:LicenseExpirationDate />
<b:LicenseIssuingAuthorityStateCode />
<b:EXTENSION>
<b:OTHER>
<a:LicensingDataID />
</b:OTHER>
</b:EXTENSION>
</b:LICENSE_DETAIL>
当前服务映射xml
<?xml version="1.0" encoding="utf-8"?>
<serviceDescription>
<id>License-Services-Update</id>
<defaultLocale>en-us</defaultLocale>
<transportId>HTTPServiceTransport</transportId>
<name>License-Services-Update by NMLS.</name>
<description>This service is to update for a NMLS ID.</description>
<inbound>
<parameters>
<parameter>
<id>lo-name</id>
<name>Full Name</name>
<description>Full Name of Loan Officer</description>
<type>STRING</type>
</parameter>
<parameter>
<id>lo-fname</id>
<name>First Name</name>
<description>First Name of Loan Officer</description>
<type>STRING</type>
</parameter>
<parameter>
<id>lo-lname</id>
<name>Last Name</name>
<description>Last Name of Loan Officer</description>
<type>STRING</type>
</parameter>
<parameter>
<id>lo-nmlsid</id>
<name>NMLS ID</name>
<description>NMLS ID of Loan Officer</description>
<type>STRING</type>
</parameter>
<parameter>
<id>roles</id>
<name>List of Roles</name>
<description>All Roles of Loan Officer</description>
<type>LIST</type>
<parameters>
<parameter>
<id>PartyRoleType</id>
<name>PartyRoleType</name>
<description>PartyRoleType</description>
<type>STRING</type>
</parameter>
<parameter>
<id>PartyRoleTypeOtherDescription</id>
<name>PartyRoleTypeOtherDescription</name>
<description>PartyRoleTypeOtherDescription</description>
<type>STRING</type>
</parameter>
<parameter>
<id>PartyRoleIdentifierCertificationStatusDate</id>
<name>PartyRoleIdentifierCertificationStatusDate</name>
<description>PartyRoleIdentifierCertificationStatusDate</description>
<type>DATE</type>
</parameter>
<parameter>
<id>LICENSES</id>
<name>List of LICENSES</name>
<description>All LICENSES of Loan Officer in this role</description>
<type>LIST</type>
<parameters>
<parameter>
<id>LicenseAuthorityLevelType</id>
<name>LicenseAuthorityLevelType</name>
<description>LicenseAuthorityLevelType</description>
<type>STRING</type>
</parameter>
<parameter>
<id>LicenseIdentifier</id>
<name>LicenseIdentifier</name>
<description>LicenseIdentifier</description>
<type>STRING</type>
</parameter>
<parameter>
<id>LicenseIssuingAuthorityName</id>
<name>LicenseIssuingAuthorityName</name>
<description>LicenseIssuingAuthorityName</description>
<type>STRING</type>
</parameter>
<parameter>
<id>LicenseIssueDate</id>
<name>LicenseIssueDate</name>
<description>LicenseIssueDate</description>
<type>DATE</type>
</parameter>
<parameter>
<id>LicenseExpirationDate</id>
<name>LicenseExpirationDate</name>
<description>LicenseExpirationDate</description>
<type>DATE</type>
</parameter>
<parameter>
<id>LicenseIssuingAuthorityStateCode</id>
<name>LicenseIssuingAuthorityStateCode</name>
<description>LicenseIssuingAuthorityStateCode</description>
<type>STRING</type>
</parameter>
<parameter>
<id>LicensingDataID</id>
<name>LicensingDataID</name>
<description>LicensingDataID</description>
<type>STRING</type>
</parameter>
</parameters>
</parameter>
</parameters>
</parameter>
</parameters>
<serviceMapping xmlns:b="http://www.mismo.org/residential/2009/schemas" xmlns:a="http://intg.com/schema">
<constants>
<constant>
<id>request-url</id>
<value>http://intsrvdev5.local/license-services/api/v1/licenses/nmls/</value>
</constant>
<constant>
<id>AUTH_TOKEN</id>
<value>Basic aW50Z0VuZ2FnZTpRUUtrMlQ2SFVoOEZXRUhV</value>
</constant>
<constant>
<id>CONTENT_TYPE</id>
<value>application/xml</value>
</constant>
<constant>
<id>request-method</id>
<value>POST</value>
</constant>
<constant>
<id>ignore_empty</id>
<value>true</value>
</constant>
<constant>
<id>return_type</id>
<value>xml</value>
</constant>
<constant>
<id>post-template</id>
<value><![CDATA[<b:MESSAGE xmlns:a="http://intg.com/schema" xmlns:b="http://www.mismo.org/residential/2009/schemas">
<b:DEAL_SETS>
<b:PARTIES>
<b:PARTY>
<b:INDIVIDUAL>
<b:NAME>
<b:FirstName></b:FirstName>
<b:FullName></b:FullName>
<b:LastName></b:LastName>
</b:NAME>
</b:INDIVIDUAL>
<b:ROLES>
<b:ROLE>
<b:LICENSES>
<b:LICENSE>
<b:LICENSE_DETAIL>
<b:LicenseAuthorityLevelType></b:LicenseAuthorityLevelType>
<b:LicenseExpirationDate></b:LicenseExpirationDate>
<b:LicenseIdentifier></b:LicenseIdentifier>
<b:LicenseIssueDate></b:LicenseIssueDate>
<b:LicenseIssuingAuthorityStateCode></b:LicenseIssuingAuthorityStateCode>
<b:LicenseIssuingAuthorityName></b:LicenseIssuingAuthorityName>
<b:EXTENSION>
<b:OTHER>
<a:LicensingDataID></a:LicensingDataID>
</b:OTHER>
</b:EXTENSION>
</b:LICENSE_DETAIL>
</b:LICENSE>
</b:LICENSES>
<b:ROLE_DETAIL>
<b:PartyRoleType></b:PartyRoleType>
<b:PartyRoleTypeOtherDescription></b:PartyRoleTypeOtherDescription>
</b:ROLE_DETAIL>
<b:PARTY_ROLE_IDENTIFIERS>
<b:PARTY_ROLE_IDENTIFIER>
<b:PartyRoleIdentifierCertificationStatusDate></b:PartyRoleIdentifierCertificationStatusDate>
</b:PARTY_ROLE_IDENTIFIER>
</b:PARTY_ROLE_IDENTIFIERS>
</b:ROLE>
</b:ROLES>
</b:PARTY>
</b:PARTIES>
</b:DEAL_SETS>
</b:MESSAGE>]]></value>
</constant>
</constants>
<mapping>
<mapping target="transport:request-url" source="constant:request-url" />
<mapping target="transport:request-method" source="constant:request-method" />
<mapping target="transport:request-ignore-empty-query" source="constant:ignore_empty" sourceType="STRING" targetType="STRING" />
<mapping target="transport:request-header-Authorization" source="constant:AUTH_TOKEN" />
<!--
<mapping target="transport:request-header-Content-Type" source="constant:CONTENT_TYPE" />
-->
<!-- QUERY PARAMS -->
<mapping target="transport:request-url-postfix" source="parameter:lo-nmlsid" />
<!-- Submitted Data -->
<mapping target="transport:request-entity" targetType="XML" sourceType="NOOP" source="constant:post-template" />
<mapping sourceType="NOOP" target="transport:request-entity" targetType="xml">
<mapping source="parameter:lo-name" sourceType="STRING" targetRef="b:MESSAGE/b:DEAL_SETS/b:PARTIES/b:PARTY/b:INDIVIDUAL/b:NAME/b:FullName" />
<mapping source="parameter:lo-fname" sourceType="STRING" targetRef="b:MESSAGE/b:DEAL_SETS/b:PARTIES/b:PARTY/b:INDIVIDUAL/b:NAME/b:FirstName" />
<mapping source="parameter:lo-lname" sourceType="STRING" targetRef="b:MESSAGE/b:DEAL_SETS/b:PARTIES/b:PARTY/b:INDIVIDUAL/b:NAME/b:LastName" />
<mapping source="parameter:roles" targetRef="b:MESSAGE/b:DEAL_SETS/b:PARTIES/b:PARTY/b:ROLES/b:ROLE" >
<mapping source="parameter:PartyRoleType" sourceType="STRING" targetRef="b:ROLE_DETAIL/b:PartyRoleType"/>
<mapping source="parameter:PartyRoleTypeOtherDescription" sourceType="STRING" targetRef="b:ROLE_DETAIL/b:PartyRoleTypeOtherDescription"/>
<mapping source="parameter:PartyRoleIdentifierCertificationStatusDate" sourceType="STRING" targetRef="b:PARTY_ROLE_IDENTIFIERS/b:PARTY_ROLE_IDENTIFIER/b:PartyRoleIdentifierCertificationStatusDate" />
<mapping source="parameter:LICENSES" targetRef="b:LICENSES/b:LICENSE/b:LICENSE_DETAIL" >
<mapping source="parameter:LicenseAuthorityLevelType" sourceType="STRING" targetRef="b:LicenseAuthorityLevelType"/>
<mapping source="parameter:LicenseIdentifier" sourceType="STRING" targetRef="b:LicenseIdentifier"/>
<mapping source="parameter:LicenseIssuingAuthorityName" sourceType="STRING" targetRef="b:LicenseIssuingAuthorityName"/>
<mapping source="parameter:LicenseIssueDate" sourceType="STRING" targetRef="b:LicenseIssueDate"/>
<mapping source="parameter:LicenseExpirationDate" sourceType="STRING" targetRef="b:LicenseExpirationDate"/>
<mapping source="parameter:LicenseIssuingAuthorityStateCode" sourceType="STRING" targetRef="b:LicenseIssuingAuthorityStateCode"/>
<mapping source="parameter:LicensingDataID" sourceType="STRING" targetRef="b:EXTENSION/b:OTHER/a:LicensingDataID"/>
</mapping>
</mapping>
</mapping>
</mapping>
</serviceMapping>
</inbound>
<outbound>
<parameters>
<parameter>
<id>response-entity</id>
<name>Response</name>
<description>Response returned by making a request to the configured URL.</description>
<mandatory>false</mandatory>
<type>STRING</type>
</parameter>
<parameter>
<id>error-msg</id>
<name>Error Messages</name>
<description>Error Messages from service</description>
<mandatory>false</mandatory>
<type>STRING</type>
</parameter>
</parameters>
<serviceMapping xmlns:b="http://www.mismo.org/residential/2009/schemas" MISMOReferenceModelIdentifier="3.4" xmlns:a="http://intg.com/schema">
<mapping>
<mapping source="transport:response-entity" target="parameter:response-entity" sourceType="XML" targetType="STRING" />
<mapping source="transport:response-entity" sourceRef="b:MESSAGE/b:DEAL_SETS/b:DEAL_SET/b:Deal/b:SERVICES/b:SERVICE/b:ERRORS/b:ERROR/b:ERROR_MESSAGES/b:ERROR_MESSAGE/b:ErrorMessageText" target="parameter:error-msg" sourceType="XML" targetType="STRING" />
</mapping>
</serviceMapping>
</outbound>
</serviceDescription>