使用XSLT将SOAP转换为XML

时间:2015-09-01 06:09:06

标签: xml xslt soap xslt-1.0

我真的很难将SOAP请求转换为可以上传到Filemaker数据库的可用XML文件。我一直在寻找几天,但我找不到有效的解决方案。我已经复制了下面的SOAP请求示例,以及下面的所需输出。任何帮助将不胜感激!!

我到目前为止所做的就是使用以下XSL生成内容:

<xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns ="http://www.somedomainename.com">

<xsl:template match="@*|comment()|processing-instruction()">
    <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
</xsl:template> 
</xsl:stylesheet>

SOAP请求:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
  <ns0:course_application_list xmlns:ns0="http://au.edu.sydney/schemas/studentcoursemanagement/courseppplication/courseapplicationdetails/1.0">
     <ns0:course_application>
        <ns0:application_form_seqno>01</ns0:application_form_seqno>
        <ns0:course_application_seqno>01</ns0:course_application_seqno>
        <ns0:application_course>MAEDUCAT-03</ns0:application_course>
        <ns0:commence_year>2014</ns0:commence_year>
        <ns0:sid>11223344</ns0:sid>
        <ns0:application_type>I</ns0:application_type>
        <ns0:application_status>AF</ns0:application_status>
        <ns0:decision1>U</ns0:decision1>
</ns0:course_application>
  </ns0:course_application_list>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

所需的输出XML:

 <course_application_list>
 <course_application>
    <application_form_seqno>01</application_form_seqno>
    <course_application_seqno>01</course_application_seqno>
    <application_course>MAEDUCAT-03</application_course>
    <commence_year>2014</commence_year>
    <sid>11223344</sid>
    <application_type>I</application_type>
    <application_status>AF</application_status>
    <decision1>U</decision1>
</course_application>
</course_application_list>

1 个答案:

答案 0 :(得分:2)

您需要适当地管理您的命名空间,您可能会这样:

VirtualHost *:80>
    ServerName example.com
    ServerAdmin admin@example.com
    WSGIScriptAlias / /var/www/FlaskApp/flaskapp.wsgi
    <Directory /var/www/FlaskApp/FlaskApp/>
        Order allow,deny
        Allow from all
    </Directory>
    Alias /static /var/www/FlaskApp/FlaskApp/static
    <Directory /var/www/FlaskApp/FlaskApp/static/>
        Order allow,deny
        Allow from all
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

<VirtualHost *:5000>
    ServerName example.com
    <Directory /var/www/FlaskApp/FlaskApp/>
                    Order allow,deny
                    Allow from all
            </Directory>


            SSLEngine on
            SSLCertificateFile /etc/apache2/ssl/STAR_file.crt
            SSLCertificateKeyFile /etc/apache2/ssl/STAR_file.key
            SSLCertificateChainFile /etc/apache2/ssl/STAR_file_bundle.pem
     <Location />
        SSLRequireSSL On
        SSLVerifyClient optional
        SSLVerifyDepth 1
        SSLOptions +StdEnvVars +StrictRequire
    </Location>
    ErrorLog ${APACHE_LOG_DIR}/sslerror.log
            LogLevel warn
            CustomLog ${APACHE_LOG_DIR}/sslaccess.log combined
    <FilesMatch "\.(cgi|shtml|phtml|php)$">
        SSLOptions +StdEnvVars
    </FilesMatch>
    <Directory /usr/lib/cgi-bin>
    SSLOptions +StdEnvVars
    </Directory>

BrowserMatch "MSIE [2-6]" \
    nokeepalive ssl-unclean-shutdown \
    downgrade-1.0 force-response-1.0
# MSIE 7 and newer should be able to use keepalive
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
</VirtualHost>'

到目前为止我获得的结果:

slice