如何在通过Talend Open Studio访问的Web服务中配置http basic auth?

时间:2013-10-18 12:32:37

标签: web-services http-authentication talend

例如,我有一个关于Web服务,只有方法getVersion返回应用程序版本。

我可以通过SoapUI轻松调用它:

enter image description here

但是,通过Talend中的Job访问它似乎是不可能的。

我尝试过最简单的一个:

enter image description here

已配置身份验证,admin / ****为用户/密码。

但是,每次我运行我的作业时,都会以下列错误结束

Démarrage du job About a 14:04 18/10/2013.

[statistics] connecting to socket on port 4025
[statistics] connected
Exception in component tWebService_1
org.apache.ws.commons.schema.XmlSchemaException: Server returned HTTP response code: 401 for URL: http://localhost:8080/digital-express-soap/AboutService?xsd=1
    at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:710)
    at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:706)
    at org.apache.ws.commons.schema.SchemaBuilder.handleImport(SchemaBuilder.java:538)
    at org.apache.ws.commons.schema.SchemaBuilder.handleSchemaElementChild(SchemaBuilder.java:1513)
    at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:659)
    at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:540)
    at org.talend.webservice.helper.ServiceDiscoveryHelper.getSchemaCollection(ServiceDiscoveryHelper.java:363)
    at org.talend.webservice.helper.ServiceDiscoveryHelper.init(ServiceDiscoveryHelper.java:130)
    at org.talend.webservice.helper.ServiceDiscoveryHelper.<init>(ServiceDiscoveryHelper.java:90)
    at org.talend.webservice.helper.ServiceInvokerHelper.<init>(ServiceInvokerHelper.java:98)
    at test_lct.about_0_1.About.tWebService_1Process(About.java:300)
    at test_lct.about_0_1.About.runJobInTOS(About.java:559)
    at test_lct.about_0_1.About.main(About.java:425)
Caused by: java.io.IOException: Server returned HTTP response code: 401 for URL: http://localhost:8080/digital-express-soap/AboutService?xsd=1
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1436)
    at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:677)
    at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:186)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:772)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
    at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:235)
    at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
    at org.apache.ws.commons.schema.XmlSchemaCollection$2.run(XmlSchemaCollection.java:738)
    at org.apache.ws.commons.schema.XmlSchemaCollection$2.run(XmlSchemaCollection.java:737)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.apache.ws.commons.schema.XmlSchemaCollection.parseDoPriv(XmlSchemaCollection.java:736)
    at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:705)
    ... 12 more
[statistics] disconnected

所以看来我的服务器不接受提供的身份验证。真是奇怪,因为调试我的领域会发现一些经过身份验证的调用。但是,似乎最后一次通话也是未经授权的。为什么?

修改

我通过在Glassfish中启用HTTP日志记录进行了一些测试,然后为每个工具执行一次测试。

使用soapui,我得到了

"127.0.0.1" "NULL-AUTH-USER" "07/Nov/2013:10:45:51 +0100" "POST /digital-express-soap/AboutService HTTP/1.1" 401 1069 
"127.0.0.1" "admin" "07/Nov/2013:10:45:51 +0100" "POST /digital-express-soap/AboutService HTTP/1.1" 200 247 

使用Talend Open Studio for Data Integration 5.3.1,我得到了

"127.0.0.1" "NULL-AUTH-USER" "07/Nov/2013:11:03:27 +0100" "POST /digital-express-soap/AboutService HTTP/1.1" 401 1069 
"127.0.0.1" "admin" "07/Nov/2013:11:03:27 +0100" "POST /digital-express-soap/AboutService HTTP/1.1" 200 247 

据我所知,完全相同。因此,对我的服务器进行查询的顺序是相同的,但客户端解释它的方式会发生变化。

因此,我的问题现在可以更改为“为什么Talend无法正确解释当服务器401返回时soapui可以,考虑两者都基于类似的开源Web服务堆栈?”

0 个答案:

没有答案