我有一个WCF服务,使用Visual Studio 2010用Visual Basic编写。我想通过SOAP从Java调用这个Web服务。为此,我让jdk中的wsimport完成它的工作。现在我遇到了问题,我的Werbservice的targetNamespace被称为“tempuri.org”,VS的默认命名空间URI。我需要知道的是,如何在Visual Studio中更改它,因为我在尝试连接时遇到错误
Exception in thread "main" javax.xml.ws.WebServiceException: SearchService is not a valid service. Valid services are: {http://tempuri.org/}SearchService
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(Unknown Source)
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(Unknown Source)
at com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(Unknown Source)
at javax.xml.ws.Service.<init>(Unknown Source)
at org.tempuri.SearchService.<init>(SearchService.java:42)
at def.Call.main(Call.java:22)
WSDL看起来像这样:
<wsdl:definitions name="SearchService" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:i0="http://xxx.de/SearchTool" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata">
我希望你们中的一些人能够弄清楚我在这里失踪的东西......
答案 0 :(得分:1)
我不确定错误本身,但我被Visual Studio生成的所有tempuri.org引用所驱使。
This article可能会有所帮助,因为它列出了装饰方法/类所需的属性以及它将如何影响生成的WSDL。