按照网上的例子:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns="http://www.mulesoft.org/schema/mule/core" version="EE-3.4.1" xsi:schemaLocation="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/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
<!--配置方式1:--> <flow name="local2remote-ws"> <http:inbound-endpoint keep-alive="false" address="http://localhost:65000" encoding="UTF-8" disableTransportTransformer="false" exchange-pattern="request-response" /> <http:outbound-endpoint method="GET" keep-alive="false" address="http://webservice.webxml.com.cn#[header:INBOUND:http.request]" responseTimeout="10000" encoding="UTF-8" disableTransportTransformer="false" followRedirects="false" exchange-pattern="request-response" /> </flow>
<!--
<!--配置方式2:--> <pattern:web-service-proxy name="ws-proxy-pattern" inboundAddress="http://localhost:65081/services/getRegionDataset" outboundAddress="http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx?op=getRegionDataset"> </pattern:web-service-proxy>
<!--配置方式3:--> <ws:proxy name="mule-Ws-Proxy" inboundAddress="http://localhost:8080/services/WeatherWS" outboundAddress="http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx" /> -->
</mule>
结果只有第一种方式启动没有异常,但是无法访问;而第二、三两种方式,启动都有异常,分别如下:
ERROR 2014-03-12 15:17:08,635 [main] org.mule.module.launcher.application.DefaultMuleApplication: null org.xml.sax.SAXParseException: The prefix "pattern" for element "pattern:web-service-proxy" is not bound. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174) at org.mule.config.spring.MuleApplicationContext.loadBeanDefinitions(MuleApplicationContext.java:113) at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130) at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:537) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:451) at org.mule.config.spring.SpringRegistry.doInitialise(SpringRegistry.java:89) at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:109) at org.mule.config.spring.SpringXmlConfigurationBuilder.createSpringRegistry(SpringXmlConfigurationBuilder.java:119) at org.mule.config.spring.SpringXmlConfigurationBuilder.doConfigure(SpringXmlConfigurationBuilder.java:73) at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:46) at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78) at org.mule.config.builders.AutoConfigurationBuilder.autoConfigure(AutoConfigurationBuilder.java:101) at org.mule.config.builders.AutoConfigurationBuilder.doConfigure(AutoConfigurationBuilder.java:57) at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:46) at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78) at org.mule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:84) at org.mule.module.launcher.application.DefaultMuleApplication.init(DefaultMuleApplication.java:207) at org.mule.module.launcher.application.ApplicationWrapper.init(ApplicationWrapper.java:64) at org.mule.module.launcher.DefaultMuleDeployer.deploy(DefaultMuleDeployer.java:47) at org.mule.tooling.server.application.ApplicationDeployer.main(ApplicationDeployer.java:127) INFO 2014-03-12 15:17:08,638 [main] org.mule.module.launcher.application.DefaultMuleApplication: App 'mulehelloworld' never started, nothing to dispose of Exception in thread "main" org.mule.module.launcher.DeploymentInitException: SAXParseException: The prefix "pattern" for element "pattern:web-service-proxy" is not bound. at org.mule.module.launcher.application.DefaultMuleApplication.init(DefaultMuleApplication.java:219) at org.mule.module.launcher.application.ApplicationWrapper.init(ApplicationWrapper.java:64) at org.mule.module.launcher.DefaultMuleDeployer.deploy(DefaultMuleDeployer.java:47) at org.mule.tooling.server.application.ApplicationDeployer.main(ApplicationDeployer.java:127) Caused by: org.mule.api.config.ConfigurationException: Line 27 in XML document from URL [file:/F:/WorkSpace/MuleESB/.mule/apps/mulehelloworld/mulehelloworld.xml] is invalid; nested exception is org.xml.sax.SAXParseException: The prefix "pattern" for element "pattern:web-service-proxy" is not bound. (org.mule.api.lifecycle.InitialisationException) (org.mule.api.config.ConfigurationException) at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:52) at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78) at org.mule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:84) at org.mule.module.launcher.application.DefaultMuleApplication.init(DefaultMuleApplication.java:207) ... 3 more Caused by: org.mule.api.config.ConfigurationException: Line 27 in XML document from URL [file:/F:/WorkSpace/MuleESB/.mule/apps/mulehelloworld/mulehelloworld.xml] is invalid; nested exception is org.xml.sax.SAXParseException: The prefix "pattern" for element "pattern:web-service-proxy" is not bound. (org.mule.api.lifecycle.InitialisationException) at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:52)
ERROR 2014-03-12 15:18:42,927 [main] org.mule.module.launcher.application.DefaultMuleApplication: null org.xml.sax.SAXParseException: The prefix "ws" for element "ws:proxy" is not bound. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174) at org.mule.config.spring.MuleApplicationContext.loadBeanDefinitions(MuleApplicationContext.java:113) at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130) at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:537) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:451) at org.mule.config.spring.SpringRegistry.doInitialise(SpringRegistry.java:89) at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:109) at org.mule.config.spring.SpringXmlConfigurationBuilder.createSpringRegistry(SpringXmlConfigurationBuilder.java:119) at org.mule.config.spring.SpringXmlConfigurationBuilder.doConfigure(SpringXmlConfigurationBuilder.java:73) at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:46) at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78) at org.mule.config.builders.AutoConfigurationBuilder.autoConfigure(AutoConfigurationBuilder.java:101) at org.mule.config.builders.AutoConfigurationBuilder.doConfigure(AutoConfigurationBuilder.java:57) at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:46) at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78) at org.mule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:84) at org.mule.module.launcher.application.DefaultMuleApplication.init(DefaultMuleApplication.java:207) at org.mule.module.launcher.application.ApplicationWrapper.init(ApplicationWrapper.java:64) at org.mule.module.launcher.DefaultMuleDeployer.deploy(DefaultMuleDeployer.java:47) at org.mule.tooling.server.application.ApplicationDeployer.main(ApplicationDeployer.java:127) INFO 2014-03-12 15:18:42,931 [main] org.mule.module.launcher.application.DefaultMuleApplication: App 'mulehelloworld' never started, nothing to dispose of Exception in thread "main" org.mule.module.launcher.DeploymentInitException: SAXParseException: The prefix "ws" for element "ws:proxy" is not bound. at org.mule.module.launcher.application.DefaultMuleApplication.init(DefaultMuleApplication.java:219) at org.mule.module.launcher.application.ApplicationWrapper.init(ApplicationWrapper.java:64)
说明一下:我的WebService服务是采用Axis的,非CXF的。
哪位兄台帮忙解答一下,谢谢!
另外,希望大家推荐一下MuleESB配置WebService服务相关资料,谢谢。
补充一下,第一种配置方式(即HTTP-HTTP)启动后,在IE中输入“http://localhost:65000/*?wsdl”时,其实后台已经通过Mule的代理去访问了WebService,只是Mule去访问WebService服务时,服务端出现异常:
org.apache.cxf.binding.soap.SoapFault: Error reading XMLStreamReader. at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:230) at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:60) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:110) at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:312) at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:276) at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:943) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) ###### 第三种方式:
前面换成:
<?xml version="1.0" encoding="UTF-8"?> <mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:vm="http://www.mulesoft.org/schema/mule/vm" xmlns:ws="http://www.mulesoft.org/schema/mule/ws" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.1/mule.xsd http://www.mulesoft.org/schema/mule/ws http://www.mulesoft.org/schema/mule/ws/3.1/mule-ws.xsd http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/3.1/mule-http.xsd http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/3.1/mule-vm.xsd"> ###### 第二种:
<?xml version="1.0"encoding="UTF-8"?> <mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pattern="http://www.mulesoft.org/schema/mule/pattern" xsi:schemaLocation=" http://www.mulesoft.org/schema/mule/pattern http://www.mulesoft.org/schema/mule/pattern/3.1/mule-pattern.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.1/mule.xsd">######第一个看起来没问题######第一种方式配置和启动都没有问题,就是无法通过Mule代理访问WebService服务,出现的问题如我上面补充中的说明。
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。