2009-01-06 68 views
2

我遇到了使用Axis从Mule调用web服务的问题。我创建了一个非常简单的例子,其中,我在一个被Mule读取的文件中创建了xml,然后将其转换为Document并发送到webservice。在骡子配置相关的代码如下所示:我未能将xml转换为SOAP

<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> 

然而,由于上述配置的产生只用标签后<value0>标签的SOAP消息,并呼吁web服务失败的标记之前关闭它。生成的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> 

的Web服务在SOAPUI工作正常,没有<value0>标签,并从我的骡子网站上阅读我不知道为什么它被插入。

回答

0

这条肥皂信息有什么问题,对我来说看起来还好。另外,如果你尝试使用webservices的mule,我会建议使用cxf。他们在一起玩的非常好,我认为cxf在设计时考虑到了可扩展性,尤其是在春天的环境中。骡子和cxf都有弹簧嵌入核心。