2

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

1 Answer 1

1
+150

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.
Sign up to request clarification or add additional context in comments.

4 Comments

sorry I edited My question I cannot modify the WS my modification must be C# side
I wondered if you had a chance to test the modified wsdl with the minOccurs and maxOccurs.
unfortunately the webservice I'm calling is in production and is from another company so I cannot modify it
I was hopping a best solution, but I wonder there is not. Thank you, I will wait a little bit for the bounty maybe someone else will give me another clue. but +1 Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.