1

我是 Mule 的新手,只是尝试使用 mule 来公开 SOAP Web 服务。我使用了 mule soft http://www.mulesoft.org/documentation/display/current/XML-only+SOAP+Web+Service+Example中的以下示例。当 DataMapper 组件尝试将数据从一个请求映射到另一个请求时,我能够公开 Web 服务但出现错误。附件包含所需的配置。当我使用 Mule Studio 中的预览选项卡在映射器上运行测试 xml 时,它只返回:并说您的 XML 无效。错误:文件过早结束。

请建议。

以下是配置:

    <?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:data-mapper="http://www.mulesoft.org/schema/mule/ee/data-mapper" xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.3.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd 
http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/current/mule-cxf.xsd 
http://www.mulesoft.org/schema/mule/ee/data-mapper http://www.mulesoft.org/schema/mule/ee/data-mapper/current/mule-data-mapper.xsd 
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd 
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd 
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd ">
    <data-mapper:config name="admitToUpsert" transformationGraphPath="admittoupsert.grf" doc:name="DataMapper"/>
    <flow name="admitPatientService" doc:name="admitPatientService">
        <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8080" doc:name="AdmissionService"/>
        <cxf:proxy-service port="AdmissionPort" namespace="http://www.mule-health.com/SOA/service/admission/1.0" service="AdmissionService" payload="body" doc:name="Proxy Service" wsdlLocation="service/AdmissionService.wsdl"/>
        <logger message="First request: #[message.payload]" level="INFO" doc:name="Logger"/>
        <mulexml:dom-to-xml-transformer doc:name="Object to XML" returnClass="java.lang.String"/>
        <logger message="Before hiting transfomer: #[message.payload]" level="INFO" doc:name="Logger"/>
        <data-mapper:transform config-ref="admitToUpsert" doc:name="DataMapper"/>
        <byte-array-to-string-transformer returnClass="java.lang.String" mimeType="text/plain" doc:name="Byte Array to String"/>
        <logger message="Upsert Request is: #[message]" level="INFO" doc:name="Logger"/>
    </flow>
</mule>

以下是测试 xml:

<ns0:admitSubject xmlns:ns0="http://www.mule-health.com/SOA/service/admission/1.0" xmlns:ns1="http://www.mule-health.com/SOA/model/1.0">
     <ns1:Referer>
        <ns1:clientId>7899</ns1:clientId>
     </ns1:Referer>
     <ns1:Referral>
        <ns1:procedure>
           <ns1:code>In-patient</ns1:code>
           <ns1:admission>Elective</ns1:admission>
           <ns1:department>CARDIOLOGY</ns1:department>
        </ns1:procedure>
     </ns1:Referral>
     <ns1:Subject>
        <ns1:nationalId>4657</ns1:nationalId>
        <ns1:firstName>Charles</ns1:firstName>
        <ns1:lastName>Brown</ns1:lastName>
        <ns1:address1>Any Street</ns1:address1>
        <ns1:address2>?</ns1:address2>
        <ns1:address3>?</ns1:address3>
        <ns1:nationality>American</ns1:nationality>
        <ns1:gender>Male</ns1:gender>
        <ns1:dateOfBirth>1987-01-19</ns1:dateOfBirth>
     </ns1:Subject>
  </ns0:admitSubject>

WSDL 和 XSD 可以从https://github.com/mulesoft/Pre-sales-hospital-admission/tree/master/src/main/resources/service中获取。很抱歉没有将其粘贴到此处,因为它会导致页面上出现大量数据,但如果需要,我可以添加它们

4

1 回答 1

0

我能够解决这个问题。在复制粘贴 xml 时,似乎有一些特殊字符出现了。当我在 Mule Studio 中从 XSD 生成 XML 时,它运行良好。

于 2013-07-02T09:44:50.877 回答