我想要使用soap webservice,只有他基本上有身份验证。当我尝试访问时返回:
服务器返回HTTP响应代码:401为URL:
尝试将用户名和密码放在网址中,但它有效: username:password @ localhost:port
如何在网络服务中进行身份验证?
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:ws="http://www.mulesoft.org/schema/mule/ws" xmlns:http="http://www.mulesoft.org/schema/mule/http"
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.5.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mule-ss="http://www.mulesoft.org/schema/mule/spring-security"
xmlns:ss="http://www.springframework.org/schema/security"
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/ws http://www.mulesoft.org/schema/mule/ws/current/mule-ws.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/spring-security
http://www.mulesoft.org/schema/mule/spring-security/3.1/mule-spring-security.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.0.xsd">
<spring:beans>
<ss:authentication-manager alias="authenticationManager">
<ss:authentication-provider>
<ss:user-service id="userService">
<ss:user name="username" password="password" authorities="ROLE_ADMIN" />
</ss:user-service>
</ss:authentication-provider>
</ss:authentication-manager>
</spring:beans>
<mule-ss:security-manager>
<mule-ss:delegate-security-provider
name="memory-dao" delegate-ref="authenticationManager" />
</mule-ss:security-manager>
<ws:consumer-config name="Web_Service_Consumer"
wsdlLocation="host wsdls"
service="BAPI_VENDOR_FINDService" port="BAPI_VENDOR_FINDPortType"
serviceAddress="host service"
doc:name="Web Service Consumer" />
<flow name="sapFlow1" doc:name="sapFlow1">
<http:inbound-endpoint exchange-pattern="request-response"
host="localhost" port="8081" doc:name="HTTP" />
<http:outbound-endpoint exchange-pattern="request-response"
host="hostname to webservice"
port="8000">
<mule-ss:http-security-filter realm="mule"/>
</http:outbound-endpoint>
<ws:consumer config-ref="Web_Service_Consumer" operation="BAPI_VENDOR_FIND"
doc:name="Web Service Consumer" />
</flow>
</mule>
更新流程:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:ws="http://www.mulesoft.org/schema/mule/ws" xmlns:http="http://www.mulesoft.org/schema/mule/http" 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.5.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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/ws http://www.mulesoft.org/schema/mule/ws/current/mule-ws.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
<ws:consumer-config name="Web_Service_Consumer" wsdlLocation="http://username:password@host:8000/sap/bc/soap/wsdl11?services=BAPI_VENDOR_FIND" service="BAPI_VENDOR_FINDService" port="BAPI_VENDOR_FINDPortType" serviceAddress="http://username:password@host:8000/sap/bc/soap/rfc" doc:name="Web Service Consumer"/>
<flow name="sapFlow1" doc:name="sapFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP"/>
<logger message="#[message]" level="INFO" doc:name="Logger"/>
<ws:consumer config-ref="Web_Service_Consumer" doc:name="Web Service Consumer" operation="BAPI_VENDOR_FIND"/>
<logger message="#[message]" level="INFO" doc:name="Logger"/>
</flow>
</mule>
日志:
log4j: Trying to find [log4j.xml] using context classloader sun.misc.Launcher$AppClassLoader@6a7be687.
log4j: Trying to find [log4j.xml] using sun.misc.Launcher$AppClassLoader@6a7be687 class loader.
log4j: Trying to find [log4j.xml] using ClassLoader.getSystemResource().
log4j: Trying to find [log4j.properties] using context classloader sun.misc.Launcher$AppClassLoader@6a7be687.
log4j: Using URL [jar:file:/C:/AnypointStudio/plugins/org.mule.tooling.server.3.5.0.ee_3.5.0.201403072147/mule/tooling/tooling-support-3.5.0-M4.jar!/log4j.properties] for automatic log4j configuration.
log4j: Reading configuration from URL jar:file:/C:/AnypointStudio/plugins/org.mule.tooling.server.3.5.0.ee_3.5.0.201403072147/mule/tooling/tooling-support-3.5.0-M4.jar!/log4j.properties
log4j: Parsing for [root] with value=[INFO, console].
log4j: Level token is [INFO].
log4j: Category root set to INFO
log4j: Parsing appender named "console".
log4j: Parsing layout options for "console".
log4j: Setting property [conversionPattern] to [%-5p %d [%t] %c: %m%n].
log4j: End of parsing for "console".
log4j: Parsed "console" options.
log4j: Parsing for [com.mycompany] with value=[DEBUG].
log4j: Level token is [DEBUG].
log4j: Category com.mycompany set to DEBUG
log4j: Handling log4j.additivity.com.mycompany=[null]
log4j: Parsing for [org.springframework.beans.factory] with value=[WARN].
log4j: Level token is [WARN].
log4j: Category org.springframework.beans.factory set to WARN
log4j: Handling log4j.additivity.org.springframework.beans.factory=[null]
log4j: Parsing for [org.apache] with value=[WARN].
log4j: Level token is [WARN].
log4j: Category org.apache set to WARN
log4j: Handling log4j.additivity.org.apache=[null]
log4j: Parsing for [Tracking] with value=[WARN].
log4j: Level token is [WARN].
log4j: Category Tracking set to WARN
log4j: Handling log4j.additivity.Tracking=[null]
log4j: Parsing for [org.jetel] with value=[WARN].
log4j: Level token is [WARN].
log4j: Category org.jetel set to WARN
log4j: Handling log4j.additivity.org.jetel=[null]
log4j: Parsing for [org.mule] with value=[INFO].
log4j: Level token is [INFO].
log4j: Category org.mule set to INFO
log4j: Handling log4j.additivity.org.mule=[null]
log4j: Parsing for [com.mulesoft] with value=[INFO].
log4j: Level token is [INFO].
log4j: Category com.mulesoft set to INFO
log4j: Handling log4j.additivity.com.mulesoft=[null]
log4j: Parsing for [org.hibernate.engine.StatefulPersistenceContext.ProxyWarnLog] with value=[ERROR].
log4j: Level token is [ERROR].
log4j: Category org.hibernate.engine.StatefulPersistenceContext.ProxyWarnLog set to ERROR
log4j: Handling log4j.additivity.org.hibernate.engine.StatefulPersistenceContext.ProxyWarnLog=[null]
log4j: Finished configuring.
Deploying application: sap
Reading plugins from: C:/AnypointStudio/plugins/org.mule.tooling.server.3.5.0.ee_3.5.0.201403072147/mule/plugins
INFO 2014-04-29 12:57:00,828 [main] com.mulesoft.mule.plugin.manager.MulePluginManager: Registering plugin: anypoint-plugin-5.0.2.GA
INFO 2014-04-29 12:57:00,841 [main] com.mulesoft.mule.plugin.manager.MulePluginManager: Registering plugin: mule-plugin-debugger-3.5.0-M4
INFO 2014-04-29 12:57:01,038 [main] com.mulesoft.habitat.agent.AnypointAgentUtils: Anypoint Service Registry Agent is DISABLED. Property anypoint.agent.token is missing or empty.
INFO 2014-04-29 12:57:01,101 [main] org.mule.module.launcher.ArchiveDeployer: ================== New Exploded Artifact: sap
INFO 2014-04-29 12:57:01,247 [main] org.mule.module.launcher.application.DefaultMuleApplication:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ New app 'sap' +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
INFO 2014-04-29 12:57:01,257 [main] org.mule.module.launcher.application.DefaultMuleApplication:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Initializing app 'sap' +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
INFO 2014-04-29 12:57:02,432 [main] org.mule.lifecycle.AbstractLifecycleManager: Initialising RegistryBroker
INFO 2014-04-29 12:57:02,893 [main] org.mule.config.spring.MuleArtifactContext: Refreshing org.mule.config.spring.MuleArtifactContext@cb6c1e9: startup date [Tue Apr 29 12:57:02 GMT-03:00 2014]; root of context hierarchy
INFO 2014-04-29 12:57:07,563 [main] org.mule.lifecycle.AbstractLifecycleManager: Initialising model: _muleSystemModel
WARN 2014-04-29 12:57:07,663 [main] org.springframework.beans.GenericTypeAwarePropertyDescriptor: Invalid JavaBean property 'port' being accessed! Ambiguous write methods found next to actually used [public void org.mule.endpoint.URIBuilder.setPort(java.lang.String)]: [public void org.mule.endpoint.URIBuilder.setPort(int)]
INFO 2014-04-29 12:57:07,998 [main] org.mule.lifecycle.AbstractLifecycleManager: Initialising connector: connector.http.mule.default
Retrieving document at 'http://username:password@host:8000/sap/bc/soap/wsdl11?services=BAPI_VENDOR_FIND'.
INFO 2014-04-29 12:57:08,304 [main] org.mule.lifecycle.AbstractLifecycleManager: Disposing model: _muleSystemModel
INFO 2014-04-29 12:57:08,306 [main] org.mule.lifecycle.AbstractLifecycleManager: Disposing RegistryBroker
INFO 2014-04-29 12:57:08,315 [main] org.mule.lifecycle.AbstractLifecycleManager: Disposing connector: connector.http.mule.default
INFO 2014-04-29 12:57:08,316 [main] org.mule.util.monitor.ExpiryMonitor: disposing monitor
ERROR 2014-04-29 12:57:08,430 [main] org.mule.module.launcher.application.DefaultMuleApplication: null
java.io.IOException: Server returned HTTP response code: 401 for URL: http://username:password@host:8000/sap/bc/soap/wsdl11?services=BAPI_VENDOR_FIND
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.URL.openStream(Unknown Source)
at com.ibm.wsdl.util.StringUtils.getContentAsInputStream(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at org.mule.module.ws.consumer.WSConsumer.parseWsdl(WSConsumer.java:263)
at org.mule.module.ws.consumer.WSConsumer.initialise(WSConsumer.java:77)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1612)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1553)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1483)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:524)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:271)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:126)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:353)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:154)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1391)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1132)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:522)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:626)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
at org.mule.config.spring.SpringRegistry.doInitialise(SpringRegistry.java:86)
at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:105)
at org.mule.config.spring.SpringXmlConfigurationBuilder.createSpringRegistry(SpringXmlConfigurationBuilder.java:133)
at org.mule.config.spring.SpringXmlConfigurationBuilder.doConfigure(SpringXmlConfigurationBuilder.java:88)
at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:43)
at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:69)
at org.mule.config.builders.AutoConfigurationBuilder.autoConfigure(AutoConfigurationBuilder.java:101)
at org.mule.config.builders.AutoConfigurationBuilder.doConfigure(AutoConfigurationBuilder.java:52)
at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:43)
at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:69)
at org.mule.context.DefaultMuleContextFactory$1.configure(DefaultMuleContextFactory.java:84)
at org.mule.context.DefaultMuleContextFactory.doCreateMuleContext(DefaultMuleContextFactory.java:217)
at org.mule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:76)
at org.mule.module.launcher.application.DefaultMuleApplication.init(DefaultMuleApplication.java:170)
at org.mule.module.launcher.artifact.ArtifactWrapper$2.execute(ArtifactWrapper.java:62)
at org.mule.module.launcher.artifact.ArtifactWrapper.executeWithinArtifactClassLoader(ArtifactWrapper.java:129)
at org.mule.module.launcher.artifact.ArtifactWrapper.init(ArtifactWrapper.java:57)
at org.mule.module.launcher.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:25)
at org.mule.module.launcher.ArchiveDeployer.guardedDeploy(ArchiveDeployer.java:269)
at org.mule.module.launcher.ArchiveDeployer.deployArtifact(ArchiveDeployer.java:290)
at org.mule.module.launcher.ArchiveDeployer.deployExplodedApp(ArchiveDeployer.java:257)
at org.mule.module.launcher.ArchiveDeployer.deployExplodedArtifact(ArchiveDeployer.java:110)
at org.mule.module.launcher.DeploymentDirectoryWatcher.deployExplodedApps(DeploymentDirectoryWatcher.java:275)
at org.mule.module.launcher.DeploymentDirectoryWatcher.start(DeploymentDirectoryWatcher.java:144)
at org.mule.tooling.server.application.ApplicationDeployer.main(ApplicationDeployer.java:128)
INFO 2014-04-29 12:57:08,436 [main] org.mule.module.launcher.application.DefaultMuleApplication: App 'sap' never started, nothing to dispose of
ERROR 2014-04-29 12:57:08,568 [main] org.mule.module.launcher.ArchiveDeployer:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Failed to deploy artifact 'sap', see below +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
org.mule.module.launcher.DeploymentInitException: IOException: Server returned HTTP response code: 401 for URL: http://username:password@host:8000/sap/bc/soap/wsdl11?services=BAPI_VENDOR_FIND
at org.mule.module.launcher.application.DefaultMuleApplication.init(DefaultMuleApplication.java:177)
at org.mule.module.launcher.artifact.ArtifactWrapper$2.execute(ArtifactWrapper.java:62)
at org.mule.module.launcher.artifact.ArtifactWrapper.executeWithinArtifactClassLoader(ArtifactWrapper.java:129)
at org.mule.module.launcher.artifact.ArtifactWrapper.init(ArtifactWrapper.java:57)
at org.mule.module.launcher.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:25)
at org.mule.module.launcher.ArchiveDeployer.guardedDeploy(ArchiveDeployer.java:269)
at org.mule.module.launcher.ArchiveDeployer.deployArtifact(ArchiveDeployer.java:290)
at org.mule.module.launcher.ArchiveDeployer.deployExplodedApp(ArchiveDeployer.java:257)
at org.mule.module.launcher.ArchiveDeployer.deployExplodedArtifact(ArchiveDeployer.java:110)
at org.mule.module.launcher.DeploymentDirectoryWatcher.deployExplodedApps(DeploymentDirectoryWatcher.java:275)
at org.mule.module.launcher.DeploymentDirectoryWatcher.start(DeploymentDirectoryWatcher.java:144)
at org.mule.tooling.server.application.ApplicationDeployer.main(ApplicationDeployer.java:128)
Caused by: org.mule.api.config.ConfigurationException: Error creating bean with name 'sapFlow1': Cannot create inner bean '(inner bean)' of type [org.mule.module.ws.consumer.WSConsumer] while setting bean property 'messageProcessors' with key [1]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Invocation of init method failed; nested exception is org.mule.api.lifecycle.InitialisationException: WSDLException: faultCode=OTHER_ERROR: Unable to resolve imported document at 'http://username:password@host:8000/sap/bc/soap/wsdl11?services=BAPI_VENDOR_FIND'.: java.io.IOException: Server returned HTTP response code: 401 for URL: http://username:password@host:8000/sap/bc/soap/wsdl11?services=BAPI_VENDOR_FIND (org.mule.api.lifecycle.InitialisationException) (org.mule.api.config.ConfigurationException)
at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:49)
at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:69)
at org.mule.context.DefaultMuleContextFactory$1.configure(DefaultMuleContextFactory.java:84)
at org.mule.context.DefaultMuleContextFactory.doCreateMuleContext(DefaultMuleContextFactory.java:217)
at org.mule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:76)
at org.mule.module.launcher.application.DefaultMuleApplication.init(DefaultMuleApplication.java:170)
... 11 more
Caused by: org.mule.api.config.ConfigurationException: Error creating bean with name 'sapFlow1': Cannot create inner bean '(inner bean)' of type [org.mule.module.ws.consumer.WSConsumer] while setting bean property 'messageProcessors' with key [1]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Invocation of init method failed; nested exception is org.mule.api.lifecycle.InitialisationException: WSDLException: faultCode=OTHER_ERROR: Unable to resolve imported document at 'http://username:password@host:8000/sap/bc/soap/wsdl11?services=BAPI_VENDOR_FIND'.: java.io.IOException: Server returned HTTP response code: 401 for URL: http://username:password@host:8000/sap/bc/soap/wsdl11?services=BAPI_VENDOR_FIND (org.mule.api.lifecycle.InitialisationException)
at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:49)
at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:69)
at org.mule.config.builders.AutoConfigurationBuilder.autoConfigure(AutoConfigurationBuilder.java:101)
at org.mule.config.builders.AutoConfigurationBuilder.doConfigure(AutoConfigurationBuilder.java:52)
at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:43)
... 16 more
Caused by: org.mule.api.lifecycle.InitialisationException: Error creating bean with name 'sapFlow1': Cannot create inner bean '(inner bean)' of type [org.mule.module.ws.consumer.WSConsumer] while setting bean property 'messageProcessors' with key [1]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Invocation of init method failed; nested exception is org.mule.api.lifecycle.InitialisationException: WSDLException: faultCode=OTHER_ERROR: Unable to resolve imported document at 'http://username:password@host:8000/sap/bc/soap/wsdl11?services=BAPI_VENDOR_FIND'.: java.io.IOException: Server returned HTTP response code: 401 for URL: http://username:password@host:8000/sap/bc/soap/wsdl11?services=BAPI_VENDOR_FIND
at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:113)
at org.mule.config.spring.SpringXmlConfigurationBuilder.createSpringRegistry(SpringXmlConfigurationBuilder.java:133)
at org.mule.config.spring.SpringXmlConfigurationBuilder.doConfigure(SpringXmlConfigurationBuilder.java:88)
at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:43)
... 20 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sapFlow1': Cannot create inner bean '(inner bean)' of type [org.mule.module.ws.consumer.WSConsumer] while setting bean property 'messageProcessors' with key [1]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Invocation of init method failed; nested exception is org.mule.api.lifecycle.InitialisationException: WSDLException: faultCode=OTHER_ERROR: Unable to resolve imported document at 'http://username:password@host:8000/sap/bc/soap/wsdl11?services=BAPI_VENDOR_FIND'.: java.io.IOException: Server returned HTTP response code: 401 for URL: http://username:password@host:8000/sap/bc/soap/wsdl11?services=BAPI_VENDOR_FIND
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:282)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:126)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:353)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:154)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1391)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1132)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:522)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:626)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
at org.mule.config.spring.SpringRegistry.doInitialise(SpringRegistry.java:86)
at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:105)
... 23 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Invocation of init method failed; nested exception is org.mule.api.lifecycle.InitialisationException: WSDLException: faultCode=OTHER_ERROR: Unable to resolve imported document at 'http://username:password@host:8000/sap/bc/soap/wsdl11?services=BAPI_VENDOR_FIND'.: java.io.IOException: Server returned HTTP response code: 401 for URL: http://username:password@host:8000/sap/bc/soap/wsdl11?services=BAPI_VENDOR_FIND
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1486)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:524)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:271)
... 39 more
Caused by: org.mule.api.lifecycle.InitialisationException: WSDLException: faultCode=OTHER_ERROR: Unable to resolve imported document at 'http://username:password@host:8000/sap/bc/soap/wsdl11?services=BAPI_VENDOR_FIND'.: java.io.IOException: Server returned HTTP response code: 401 for URL: http://username:password@host:8000/sap/bc/soap/wsdl11?services=BAPI_VENDOR_FIND
at org.mule.module.ws.consumer.WSConsumer.parseWsdl(WSConsumer.java:267)
at org.mule.module.ws.consumer.WSConsumer.initialise(WSConsumer.java:77)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1612)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1553)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1483)
... 42 more
Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=OTHER_ERROR: Unable to resolve imported document at 'http://username:password@host:8000/sap/bc/soap/wsdl11?services=BAPI_VENDOR_FIND'.: java.io.IOException: Server returned HTTP response code: 401 for URL: http://username:password@host:8000/sap/bc/soap/wsdl11?services=BAPI_VENDOR_FIND
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at org.mule.module.ws.consumer.WSConsumer.parseWsdl(WSConsumer.java:263)
... 50 more
Caused by: java.io.IOException: Server returned HTTP response code: 401 for URL: http://username:password@host:8000/sap/bc/soap/wsdl11?services=BAPI_VENDOR_FIND
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.URL.openStream(Unknown Source)
at com.ibm.wsdl.util.StringUtils.getContentAsInputStream(Unknown Source)
... 53 more
INFO 2014-04-29 12:57:08,581 [main] org.mule.module.launcher.DeploymentDirectoryWatcher:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Mule is up and kicking (every 5000ms) +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
答案 0 :(得分:0)
您可以为基本身份验证配置您的ws:consumer-config:
serviceAddress="http://username:password@address"
要验证这是否有效,您可以使用http-inbound创建另一个流,将serviceAddress地址部分设置为该地址,并使用<logger message="#[message]" level="INFO" doc:name="Logger"/>
打印Basic auth和其他标头。当你运行它时,你会看到类似Authorization=Basic
...的东西。
我在配置中不了解的是带有安全过滤器的http:outbound-endpoint
。也许这就是问题?你究竟想用它做什么?安全过滤器用于 http-inbound ,以便通过身份验证保护它,并且您不需要额外的http-outbound来使用ws使用者。
答案 1 :(得分:0)
或者,您可以编写可以为您执行基本身份验证的Component类。