Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# WCF C#4.0 SOAP
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):
<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:
    
[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 21-Feb-13 3:21am
cjb1104K

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

  Print Answers RSS
0 BillWoodruff 330
1 Mathew Soji 309
2 Maciej Los 295
3 Afzaal Ahmad Zeeshan 257
4 DamithSL 225
0 OriginalGriff 6,369
1 Sergey Alexandrovich Kryukov 5,973
2 DamithSL 5,183
3 Manas Bhardwaj 4,673
4 Maciej Los 4,045


Advertise | Privacy | Mobile
Web01 | 2.8.1411019.1 | Last Updated 21 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100