[Soap-Python] soaplib and .net compatibility

Alexander Kolesnikov rocker.yandex at gmail.com
Mon Sep 20 08:39:19 CEST 2010


Hello Burak!

> hello alexander,
>
> .net interoperability is of course important for soaplib. is it possible
> for you to contribute your .net test case, making sure it is similar to
> the ones in
> http://github.com/arskom/soaplib/tree/master/src/soaplib/test/interop/ ?

I'll write test with pleasure but I want to ask you some questions before.

> a few comments about your patch:
>
> 1) it touches more than just .net interop. can you please:
>
> git reset --soft HEAD~1
>
> and use git gui to separate that big commit into smaller chunks? you'll
> need to do git push --force after you do that.

I'm new in git, so thanks for help with it

>
> 2) your implementation of int type is incomplete. see here:
> http://www.w3.org/TR/xmlschema-2/#int . you must do proper range checks.
> i also don't see why the int type should default to nillable=False.

Yes, it is incomplete. It is possible to specify "nillable=False" in
Integer(...), isn't it? I wrote it before understanding soaplib
architecture.
But I need type with name Int instead of Integer, because .net code
generation tool use String to implement Integer.
Have you plans to include other SOAP types in primitives?

>
> 3) i'm not sure about your intentions in the rest of the patch. can you
> explain how hardcoding a namespace prefix ('emp0') or forcing the
> default namespace (xmlns="...")  to be the target namespace or disabling
> the ns resolution for the array type helps .net interop?

This is my cutted example for soaplib 0.9.4.7 (without my patch):

from soaplib import service
from soaplib.service import rpc
from soaplib.serializers import primitive as soap_types, base as soap_base

class BasicService(service.DefinitionBase):
    __tns__ = 'http://tempuri.org/' # of course can be any but this is
by default in .net

    @rpc(soap_types.String, soap_types.Integer,
_returns=soap_types.Array(soap_types.String))
    def say_hello(self, name, times):
        results = []
        for i in range(0, times):
            results.append('Hello, %s'%name)

        return results

say_hello returns string array.

This is SOAP from my service:

<senv:Envelope
	xmlns:plink="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2003/03/addressing"
xmlns:xop="http://www.w3.org/2004/08/xop/include"
xmlns:senc="http://schemas.xmlsoap.org/soap/encoding/"
	xmlns:s0="http://tempuri.org/"
	xmlns:s12env="http://www.w3.org/2003/05/soap-envelope/"
xmlns:s12enc="http://www.w3.org/2003/05/soap-encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:senv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
	
	<senv:Header></senv:Header>
	<senv:Body>
		<s0:say_helloResponse>
			<s0:say_helloResult>
				<s0:string xsi:type="xs:string">Hello, rocker</s0:string>
				<s0:string xsi:type="xs:string">Hello, rocker</s0:string>
			</s0:say_helloResult>
		</s0:say_helloResponse>
	</senv:Body>
</senv:Envelope>

And this is SOAP from same .net service:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
	<s:Header></s:Header>
	<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
		<say_helloResponse xmlns="http://tempuri.org/">
			<say_helloResult xmlns="">
				<string xmlns="http://tempuri.org/">rocker</string>
				<string xmlns="http://tempuri.org/">rocker</string>
			</say_helloResult>
		</say_helloResponse>
	</s:Body>
</s:Envelope>

We can see defferences in namespace using. We need to fix it.
.net service definition is:
	[ServiceContract]
	public interface IService1
	{
		[OperationContract]
		[XmlSerializerFormat(Style = OperationFormatStyle.Rpc, Use =
OperationFormatUse.Literal)]
		string[] say_hello(string name, int times);
	}

It was the first problem I investigated. Do you know simple way to fix it?

Sorry if my English not so good.

Alexander.



More information about the Soap mailing list