我无法将 xml 转换为 SOAP
我在使用 Axis 从 Mule 调用 Web 服务时遇到问题。 我创建了一个相当简单的示例,其中 Mule 读取文件中的 xml,然后将其转换为文档并发送到 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 消息,该消息的后面带有
标记,并在之前关闭它标签。 生成的 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 中工作正常,并且从我在 Mule 网站上读到的内容来看,我不知道为什么要插入它。
I'm having a problem calling a webservice from Mule using Axis. I've created a fairly simple example where I have xml in a file being read by Mule, it's then transformed into a Document and sent to the webservice. The relevant code in the mule config looks like this:
<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>
However the call for the webservice fails as the above config is generating a SOAP message with an <value0>
tag just after the tag and closes it just before the tag. The generated SOAP message looks like this:
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>
The webservice works fine in SOAPUI without the <value0>
tag and from what I've read on the Mule website I don't know why it's being inserted.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这个肥皂消息有什么问题,对我来说看起来没问题。 另外,如果您正在尝试使用 mule 与 web 服务,我建议使用 cxf。 它们一起发挥得非常好,在我看来,cxf 的设计考虑到了可扩展性,特别是在 Spring 环境中。 mule 和 cxf 的核心都有内置弹簧。
What is the issue with this soap message, looks okay to me. Also if you are trying out mule with webservices, I would suggest using cxf. They play really well together and cxf in my opinion is well designed for extensibility in mind , especially in a spring environment. Both mule and cxf have spring built into the core.