例如,我有一个 About web 服务,它只有 getVersion 方法返回应用程序版本。
我可以通过 SoapUI 轻松调用它:
但是,通过 Talend 中的 Job 访问它似乎是不可能的。
我尝试了最简单的一个:
配置为已检查身份验证并将 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 服务堆栈?”