Click here to Skip to main content
15,895,746 members
Home / Discussions / C#
   

C#

 
GeneralRe: Adding a variable to a variable name Pin
Dave Kreskowiak13-Jun-12 9:18
mveDave Kreskowiak13-Jun-12 9:18 
AnswerRe: Adding a variable to a variable name Pin
BobJanova14-Jun-12 2:06
BobJanova14-Jun-12 2:06 
GeneralRe: Adding a variable to a variable name Pin
MichCl14-Jun-12 6:37
MichCl14-Jun-12 6:37 
GeneralRe: Adding a variable to a variable name Pin
Pete O'Hanlon14-Jun-12 7:05
mvePete O'Hanlon14-Jun-12 7:05 
QuestionIWebBrowser2 NewWindow3 doesn't track target frame name Pin
vwmberry9513-Jun-12 7:11
vwmberry9513-Jun-12 7:11 
QuestionPHP web service requires array but how to send correct array with C#? Pin
JD8613-Jun-12 7:01
JD8613-Jun-12 7:01 
AnswerMessage Closed Pin
13-Jun-12 8:51
WebMaster13-Jun-12 8:51 
GeneralRe: PHP web service requires array but how to send correct array with C#? Pin
JD8613-Jun-12 12:42
JD8613-Jun-12 12:42 
I tried your suggestions:

Custom Class:
C#
class MCInfo
    {
        public string username { get; set; }
        public string password { get; set; }
        public string supportname { get; set; }
    }


Linq:
C#
List<MCInfo> info = new List<MCInfo>();
                info.Add(
                    new MCInfo()
                    {
                        username = "administrator",
                        password = "testing",
                        supportname = "BLAH BLAH"
                    });

                var results = (from n in info
                               select new
                               {
                                   username = n.username,
                                   password = n.password,
                                   supportname = n.supportname
                               }).ToArray();


Invoke:
C#
object[] blah = soap.domainEdit("blah.com", results);


Unfortunately it doesn't look like the other end is able to process it:


System.InvalidOperationException: There was an error generating the XML document
. ---> System.InvalidOperationException: <>f__AnonymousType0`3[System.String,Sys
tem.String,System.String] cannot be serialized because it does not have a parame
terless constructor.
at System.Xml.Serialization.TypeDesc.CheckSupported()
at System.Xml.Serialization.TypeScope.GetTypeDesc(Type type, MemberInfo sourc
e, Boolean directReference, Boolean throwOnError)
at System.Xml.Serialization.XmlSerializationWriter.CreateUnknownTypeException
(Type type)
at System.Xml.Serialization.XmlSerializationWriter.GetPrimitiveTypeName(Type
type, Boolean throwIfUnknown)
at System.Xml.Serialization.XmlSerializationWriter.WriteArray(String name, St
ring ns, Object o, Type type)
at System.Xml.Serialization.XmlSerializationWriter.WriteReferencedElement(Str
ing name, String ns, Object o, Type ambientType)
at System.Xml.Serialization.XmlSerializationWriter.WriteReferencedElements()
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterApi_Mo
del_SoapInterfaceService.Write31_domainEdit(Object[] p)
at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer61.Se
rialize(Object objectToSerialize, XmlSerializationWriter writer)
at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Obje
ct o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Obje
ct o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Obje
ct o, XmlSerializerNamespaces namespaces, String encodingStyle)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Serialize(SoapClientM
essage message)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodN
ame, Object[] parameters)
at **********.com.domain.mta1_ar1.Api_Model_SoapInterfaceService.d
omainEdit(String domain_name, Object[] params) in C:\Users\*****\Dropbox\C
ompsys\****\*****t\Web References\com.*****.mta1-ar1\
Reference.cs:line 226
at *****.Program.Main(String[] args) in C:\Users\*******\Dropbo
x\*****\******\******\Program.cs:line 107



I haven't worked with XML or soap calls much. Shucks | :-\
AnswerRe: PHP web service requires array but how to send correct array with C#? Pin
BobJanova14-Jun-12 2:08
BobJanova14-Jun-12 2:08 
GeneralRe: PHP web service requires array but how to send correct array with C#? Pin
JD8614-Jun-12 2:57
JD8614-Jun-12 2:57 
GeneralRe: PHP web service requires array but how to send correct array with C#? Pin
BobJanova14-Jun-12 3:51
BobJanova14-Jun-12 3:51 
GeneralRe: PHP web service requires array but how to send correct array with C#? Pin
JD8614-Jun-12 3:56
JD8614-Jun-12 3:56 
GeneralRe: PHP web service requires array but how to send correct array with C#? Pin
BobJanova14-Jun-12 5:54
BobJanova14-Jun-12 5:54 
GeneralRe: PHP web service requires array but how to send correct array with C#? Pin
JD8614-Jun-12 5:57
JD8614-Jun-12 5:57 
QuestionException has been thrown by the target of an invocation. Pin
MichCl13-Jun-12 6:01
MichCl13-Jun-12 6:01 
AnswerRe: Exception has been thrown by the target of an invocation. Pin
Pete O'Hanlon13-Jun-12 6:10
mvePete O'Hanlon13-Jun-12 6:10 
GeneralRe: Exception has been thrown by the target of an invocation. Pin
MichCl13-Jun-12 7:12
MichCl13-Jun-12 7:12 
Questioncheck if record already exists in database table Pin
Saidrex13-Jun-12 4:44
Saidrex13-Jun-12 4:44 
AnswerRe: check if record already exists in database table Pin
Eddy Vluggen13-Jun-12 4:53
professionalEddy Vluggen13-Jun-12 4:53 
GeneralRe: check if record already exists in database table Pin
Saidrex13-Jun-12 5:16
Saidrex13-Jun-12 5:16 
AnswerRe: check if record already exists in database table Pin
Pete O'Hanlon13-Jun-12 4:55
mvePete O'Hanlon13-Jun-12 4:55 
GeneralRe: check if record already exists in database table Pin
Saidrex13-Jun-12 5:17
Saidrex13-Jun-12 5:17 
Questionif BindingSource.Filter doesn't have results do... Pin
Saidrex13-Jun-12 3:29
Saidrex13-Jun-12 3:29 
AnswerRe: if BindingSource.Filter doesn't have results do... Pin
Eddy Vluggen13-Jun-12 4:52
professionalEddy Vluggen13-Jun-12 4:52 
GeneralRe: if BindingSource.Filter doesn't have results do... Pin
Saidrex13-Jun-12 5:01
Saidrex13-Jun-12 5:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.