Question

here is the wsdl soap field

<element name="transactionCle" nillable="true" type="xsd:int"/>  

when I call the WS in PHP and I show the soap with __getLastResponse()

I get that for the transactionCle :

<transactionCle href="#id50"/>

here is the ref of the field :

<multiRef xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" id="id50" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="soapenc:int">12708584</multiRef>

I added a new WebReference to a wsdl provided by an Apache Server working with php.
The proxy class generated give me for the field :

private System.Nullable<int> transactionCleField;

/// <remarks/>
        [System.Xml.Serialization.SoapElementAttribute(IsNullable=true)]
        public System.Nullable<int> transactionCle {
            get {
                return this.transactionCleField;
            }
            set {
                this.transactionCleField = value;
            }
        }

Now my Problem :

When I consume the WS in php the value of transactionCle is 12708584
when I consume the WS in C# the value of transactionCle is null

If I modify manualy the proxy class from System.Nullable to int And now C# give me the Good Value (12708584).

but when I update the Webreference I have to modify again the proxy classes.

Here is my question : How can I :
or set transactionCle to int type without modify the proxy class?
or make the serialisation give me the Good Value?

edit : I'm not able to modify the WS php or the wsdl

Was it helpful?

Solution

Add the following attributes to the transactionCle-element in the wsdl

minOccurs="1" maxOccurs="1" 

Then regenerate the proxy. If it helps, then you can do three things:

  1. change the generated proxy by hand (which you already mentioned you won't)
  2. ask the WS-owner to extend the generated wsdl. This will ensure .net compatibility of the webservice
  3. create your own proxy generator by overriding methods of the SchemaImporterExtension. Have a look here: http://msdn.microsoft.com/en-us/library/system.xml.serialization.advanced.schemaimporterextension.aspx . It also has a link to a downloadable sample.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top