'How to change targetNamespace in WSDL generated by Visual Studio 2010
I have a WCF-Service, written in Visual Basic using Visual Studio 2010. I would like to call this Webservice from Java via SOAP. To do this, I let wsimport from the jdk do its job. Now I have the problem, that the targetNamespace of my Werbservice is stated as "tempuri.org", the default namespace URI by VS. What I need to know is, how to change it in Visual Studio, as I get nice errors trying to connect like
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)
the WSDL looks like this:
<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">
I hope some of you can figure out what I am missing here...
Solution 1:[1]
I'm not sure about the errors themselves, but I have been driven crazy by all the tempuri.org references generated by Visual Studio.
This article may help as it lists attributes you need to decorate your methods/classes with and how it will affect the WSDL that is generated.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Cody Gray |
