简体   繁体   English

“ javax.xml.ws.WebServiceException:不是有效的服务。”代理问题?

[英]“javax.xml.ws.WebServiceException: is not a valid service.” proxy issue?

As a premise, I am not very experienced yet, but I have tried to read and search everything I possibly could, related to this topic, and still no luck. 作为前提,我还没有很丰富的经验,但是我已经尝试阅读和搜索与该主题相关的一切内容,但仍然没有运气。

I was given a simple client to call a webservice but once it was fully setup (which included the use of a certificate and a couple more properties to set) I got the error mentioned in the title: 我得到了一个简单的客户端来调用Web服务,但是一旦它被完全设置(包括使用证书和其他几个要设置的属性),我就会得到标题中提到的错误:

javax.xml.ws.WebServiceException: {http://http://cert.controller.portaapplicativa.ictechnology.it//}MyService is not a valid service. Valid services are: 
    at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:187)
    at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:159)
    at com.sun.xml.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:82)
    at javax.xml.ws.Service.<init>(Service.java:56)
    at package.client.wsimport.MyService..<init>(MyService.java:46)
    at package.client.Client.doRicercaDEN(Client.java:55)
    at package.client.Client.main(Client.java:36)

I tried generating the client again with JAX-WS: 我尝试再次使用JAX-WS生成客户端:

java -classpath C:\Programmi\Java\jdk1.6.0_38\lib\tools.jar com.sun.tools.internal.ws.WsImport -verbose C:\WsdlFile.wsdl -p package.client.wsimport -s C:\tmp\ws\

And I get the same issue. 我也遇到同样的问题。 I am using a local copy of the wsdl because wsimport doesn't seem to like the certificate I'm trying to set in the properties (I'm most likely doing something wrong, but I opted for the simple workaround, given I have more pressing issues). 我正在使用wsdl的本地副本,因为wsimport似乎不喜欢我尝试在属性中设置的证书(我很可能做错了事,但是我选择了简单的解决方法,因为我有更多的选择紧迫的问题)。

Trying to use SoapUI to test the service, everything works fine, though I need to set the preferences for the proxy to "None". 尝试使用SoapUI来测试服务,尽管我需要将代理的首选项设置为“无”,但一切工作正常。

So I tried to make sure the connection doesn't use any proxy in my client as well: 因此,我试图确保连接也不会在客户端中使用任何代理:

(...)
systemSettings.remove("http.proxyHost");
systemSettings.remove("http.proxyPort");
systemSettings.remove("https.proxyHost");
systemSettings.remove("https.proxyPort");
System.setProperty("http.nonProxyHosts","*");
System.setProperty("https.nonProxyHosts","*");

(BTW, before "*", which as I understand it should work as a wildcard for "every domain", I have tried specifying the specific domains as well) Anyway, the result is always the same. (顺便说一句,在“ *”之前,据我所知它应该用作“每个域”的通配符,我也尝试过指定特定域)。无论如何,结果始终是相同的。

Is there something I am doing wrong, something left to try? 我在做错什么吗,还有什么可以尝试的?

I doubt this is a proxy issue. 我怀疑这是一个代理问题。 If you can share the code you are using to create the Service object it might help. 如果可以共享用于创建Service对象的代码,则可能会有所帮助。
As a kick start try reading the below thread 首先,尝试阅读以下主题
Is not a valid service exception in JAX-WS 在JAX-WS中不是有效的服务异常
What I think is that the QName you have provided when creating the Service is not proper. 我认为您在创建服务时提供的QName不正确。 To get the correct QName you might try to open the generated stub. 为了获得正确的QName,您可以尝试打开生成的存根。

As it turns out, what I was missing was importing the certificate in my local truststore (or better, when I first tried doing so, I thought I was using the correct truststore, but I wasn't). 事实证明,我所缺少的是在本地信任库中导入证书(或者更好的是,当我第一次尝试这样做时,我以为我使用的是正确的信任库,但是没有)。

For anyone who may need it, here is an explanation of how to do that using keytool: http://javarevisited.blogspot.it/2012/03/add-list-certficates-java-keystore.html 对于可能需要它的任何人,以下是如何使用keytool进行说明: http : //javarevisited.blogspot.it/2012/03/add-list-certficates-java-keystore.html

Another option is to use specific GUI like Portecle. 另一种选择是使用特定的GUI,例如Portecle。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 javax.xml.ws.WebServiceException:不是有效的端口 - javax.xml.ws.WebServiceException: is not a valid port 调用 WSDL 服务时出现 javax.xml.ws.WebServiceException - javax.xml.ws.WebServiceException when invoking WSDL service javax.xml.ws.WebServiceException:找不到以wsdl命名的服务 - javax.xml.ws.WebServiceException: Could not find service named in wsdl 无法创建服务异常javax.xml.ws.WebServiceException: - Failed to create service exception javax.xml.ws.WebServiceException: javax.xml.ws.WebServiceException:找不到名为的服务 - javax.xml.ws.WebServiceException: Could not find service named javax.xml.ws.WebServiceException "X 不是有效端口。有效端口是:Y - javax.xml.ws.WebServiceException "X is not a valid port. Valid ports are: Y 出现CXF错误:javax.xml.ws.WebServiceException:WSDL元数据不可用于创建代理 - Getting CXF error: javax.xml.ws.WebServiceException: WSDL Metadata not available to create the proxy javax.xml.ws.WebServiceException:org.apache.cxf.service.factory.ServiceConstructionException:创建服务失败 - javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service javax.xml.ws.WebServiceException:类在Web服务中返回HashMap时没有名称为return的属性 - javax.xml.ws.WebServiceException: class do not have a property of the name return when returning HashMap in web service javax.xml.ws.WebServiceException: 无法访问 WSDL - javax.xml.ws.WebServiceException: Failed to access the WSDL
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM