Bruce Hunter - 280 - Apr 15, 2014

We currently are not supporting WSDL “SOAP”. However, I’m making sure that I can turn it on and use a tool such as svcutil.exe to generate a proxy class etc.

I’m getting an error pertaining to the namespace.

Cannot import wsdl:binding
There was an error importing a wsdl:portType that the wsdl:binding is dependent on.

I specified the namespace for my services via the HostConfig class

                MetadataTypesConfig = new MetadataTypesConfig(addDefaultXmlNamespace: ServiceSettings.DefaultNamespaceCached),
                WsdlServiceNamespace = ServiceSettings.DefaultNamespaceCached,

I’m setting a value of http://www.site.com/service/types for the DefaultNamespaceCached property.

Also, just to be clear I am using the standard Request and Response object with ResponseStatus to make sure SOAP should work.

Have I missed something or did something wrong?

Bruce Hunter:

SOAP works if not using Authenticate?

For the reasons above, it should also work if you leave the default namespace.

Bruce Hunter:

If I comment out those 2 sets for the WSDL namespace in the HostConfig object, then the namespace http://schemas.servicestack.net/types shows in the error now when generating a proxy.

Bruce Hunter:

This is for clients not having ServiceStack.Client; which I use 100% internally.

Hi Bruce, SOAP support is documented on: 
https://github.com/ServiceStack/ServiceStack/wiki/SOAP-support

If you want your DTOs to use a different namespace it’s best to use assembly contract attributes shown here:
https://github.com/ServiceStack/ServiceStack/wiki/SOAP-support#single-wsdl-namespace

The alternative is to add it on each [DataContract(Namespace=…)].

Bruce Hunter:

if i use the wsdl.exe then I get a smaller error that is more direct.

Unable to import binding ‘WSHttpBinding_ISyncReply’ from namespace ‘http://www.site.com/service/types’.

- Unable to import operation ‘Authenticate’.
- The element ‘http://www.site.com/service/types:Authenticate’ is missing

Bruce Hunter:

I’ll look again. Maybe I missed something.

Bruce Hunter:

I have a feeling my Routes aren’t equal in //In the AppHost’s configure method.

Yeah it you’re going to have a problem if you’re making use of built-in DTO’s since the SOAP supports only 1 single namespace and namespaces for DTOs defined in other DTO’s can’t be changed (DataContract restriction).

Personally I’d leave the default namespace. XML namespaces are a major PITA whose very limited value doesn’t justify the friction they cause.

Bruce Hunter:

yeah, i fixed my problem except now it’s just complaining about Authenticate namespace, which is in it’s own namespace. One which I can’t change.

Bruce Hunter:

Yup, got it to work by adding this to ServiceModel AssemblyInfo
[assembly: ContractNamespace

That was the main issue. It’s not enough to just set the HostConfig WsdlServiceNamespace property.

When I removed the Auth plugin feature the proxy.cs was created fine.

I guess it’s out of the question to set your own namespace for internal classes? Kinda defeats the purpose of namespace if I default back to servicestack.com/types

AFAIK there’s no way to change namespaces of types in an external assembly (a DataContract limitation).

Best I could do is run a string replace on the wsdl output?

Bruce Hunter:

I think that just might work work!
This way , one could define WsdlServiceNamespace and have 1 namespace and SOAP would work regardless.

Bruce Hunter:

To make it work be using your namespace. I had to set it as

http://schemas.datacontract.org/2004/07/ServiceStack

in my ServiceModel.dll AssemblyInfo

and

WsdlServiceNamespace = “http://schemas.datacontract.org/2004/07/ServiceStack”,

ok this commit should do it: 
https://github.com/ServiceStack/ServiceStack/commit/8f04c8940e9b5f31f16bc4aa95ed4dde53ddc6f5

Will push to MyGet after running it through to CI, available in ~30 mins at: 
https://github.com/ServiceStack/ServiceStack/wiki/MyGet

hmmm I should likely replace “http://schemas.datacontract.org/2004/07/ServiceStack” as well

Bruce Hunter:

if I use http://schemas.servicestack.net/types as the value it doesn’t work. have to use “http://schemas.datacontract.org/2004/07/ServiceStack” when falling back.

Bruce Hunter:

Thanks for making a change, i’ll get the pre-release now.

not yet, I’ll let you know when it’s finished deploying.