我在使用 Axis 从 Mule 调用 Web 服务时遇到问题。我创建了一个相当简单的示例,其中我在 Mule 读取的文件中有 xml,然后将其转换为 Document 并发送到 Web 服务。mule 配置中的相关代码如下所示:
<inbound>
<file:inbound-endpoint path="./files/initial" transformer-refs="FileToString xmlToDom" connector-ref="fileConnector" />
</inbound>
<outbound>
<pass-through-router>
<axis:outbound-endpoint address="http://localhost:8081/holidayService?method=echoXXXX" synchronous="true" style="DOCUMENT" use="LITERAL" />
</pass-through-router>
</outbound>
但是,对 web 服务的调用失败,因为上面的配置正在生成一个 SOAP 消息,该消息在<value0>
标签之后带有一个标签,并在该标签之前关闭它。生成的 SOAP 消息如下所示:
POST /holidayService?method=echoXXXX HTTP/1.1
Content-Type: text/xml
X-MULE_ENDPOINT: http://localhost:8081/holidayService?method=echoXXXX
SOAPAction: http://localhost:8081/holidayService?method=echoXXXX
directory: D:\bea\weblogic92\samples\domains\wl_server\files\processed
filename: HolidayRequest.xml
method: echoXXXX
originalFilename: HolidayRequest.xml
style: document
use: literal
User-Agent: Jakarta Commons-HttpClient/3.1
Host: 127.0.0.1:8081
Content-Length: 1183
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<mule:header soapenv:actor="http://www.muleumo.org/providers/soap/1.0" soapenv:mustUnderstand="0" xmlns:mule="http://www.muleumo.org/providers/soap/1.0">
<mule:MULE_CORRELATION_ID>D:\bea\weblogic92\samples\domains\wl_server\files\processed\HolidayRequest.xml</mule:MULE_CORRELATION_ID>
<mule:MULE_CORRELATION_GROUP_SIZE>-1</mule:MULE_CORRELATION_GROUP_SIZE>
<mule:MULE_CORRELATION_SEQUENCE>-1</mule:MULE_CORRELATION_SEQUENCE>
</mule:header>
</soapenv:Header>
<soapenv:Body>
<value0 xsi:type="ns1:DocumentImpl" xmlns="" xmlns:ns1="http://dom.internal.xerces.apache.org.sun.com">
<sch:HolidayRequest xmlns:sch="http://mycompany.com/hr/schemas">
<sch:Holiday>
<sch:StartDate>2009-08-13</sch:StartDate>
<sch:EndDate>1988-12-12</sch:EndDate>
</sch:Holiday>
<sch:Employee>
<sch:Number>3434</sch:Number>
<sch:FirstName>John</sch:FirstName>
<sch:LastName>Smith</sch:LastName>
</sch:Employee>
</sch:HolidayRequest>
</value0>
</soapenv:Body>
</soapenv:Envelope>
该网络服务在没有标签的 SOAPUI 中运行良好,<value0>
从我在 Mule 网站上阅读的内容来看,我不知道为什么要插入它。