Click here to Skip to main content
15,885,537 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I'm writing a WCF client (that will be in a COM component) so I can't use Service References.
I've had to take the WSDL generated classes and alter them so that the right SOAP format is passed.

I've got the sending working, but I'm not able to process the response properly.

I think its because the response can contain 0 or more repeated elements and my classes don't have the right attributes set.

So the response I'm receiving (determined using Fiddler):
XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:oug="http://ougwebcomponent.components.oug.osgi.scorex.com/">
   <soapenv:Header/>
   <soapenv:Body>
      <oug:ougWSResponse>
         <data_flux>
            <item>wf_rc</item>
            <item>999</item>
         </data_flux>
         <data_flux>
            <item>wf_rc_desc</item>
            <item>Component execution complete but an unexpected Exception occurred</item>
         </data_flux>
         <data_flux>
            <item>wf_component</item>
            <item>xslt</item>
         </data_flux>
      </oug:ougWSResponse>
   </soapenv:Body>
</soapenv:Envelope>


So as you can see the data_flux is repeated.

The response method and data_flux is defined in my code as:
C#
[MessageContractAttribute(WrapperName = "ougWSResponse", WrapperNamespace = "http://ougwebcomponent.components.oug.osgi.scorex.com/", IsWrapped = true)]
    public partial class ougWSResponse
    {

        [MessageBodyMemberAttribute(Namespace = "http://ougwebcomponent.components.oug.osgi.scorex.com/", Order = 0)]
        [XmlElementAttribute("data_flux", Form = System.Xml.Schema.XmlSchemaForm.None)]
        public stringArray[] data_flux;

        public ougWSResponse() { }
        public ougWSResponse(stringArray[] data_flux)
        {
            this.data_flux = data_flux;
        }
    }
    [SerializableAttribute()]
    [XmlTypeAttribute(Namespace = "http://jaxb.dev.java.net/array", IncludeInSchema=false)]
    public partial class stringArray : object, INotifyPropertyChanged
    {

        private string[] itemField;

        [XmlElementAttribute("item", Form = System.Xml.Schema.XmlSchemaForm.None, Order = 0)]
        public string[] item
        {
            get
            {
                return this.itemField;
            }
            set
            {
                this.itemField = value;
                this.RaisePropertyChanged("item");
            }
        }
        
        //...snipped INPC stuff
    }


I think its either the attributes or the ougWSResponse class definition that's wrong.

Any pointers or articles to check would be great. I do find attributes to have the most useless documentation (that concentrates on their definition and not what most people want their usage!)
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900