consuming web service: Value of 1-dimensionnal array of 1-dimensional array of MyObj
Hi I wanna consume a web service that returns this kind of data:
The web method returns an array of another array of let's say:
MyObject
I want to use this:
Dim xRoot As XmlElement
Dim ws As New myWebService
xRoot = ws.GetContractsByMyArgument(MyArgument) Dim nt As New NameTable
Dim nsmgr As New XmlNamespaceManager(nt)
But the probelem is that I can't even compile:
I get is this in the VS 2005:
Value of 1-dimensionnal array of 1-dimensional array of MyObject can not be converted to xmlelement.
So I am not sure how I can fill the xroot variable from the returned value of the web method.
Thanks a lot.
Re: consuming web service: Value of 1-dimensionnal array of 1-dimensional array of MyObj
How is the sub/function that is in the webservice declared? Can you post that whole thing (as is unaltered)?
Thanks, :wave:
D
Re: consuming web service: Value of 1-dimensionnal array of 1-dimensional array of MyObj
If you re asking about the way I call that web method, here s the way I call it:
dim myServ as New submitWS.submitMyObjectService
private sub callWebMethod
dim cntr as new submitWS.CtrDetailsByCtrNumber
Cntr.ctrNumber = "number to look for"
myServ.getCtrDetailsByctrNumber(cntr)
End Sub
If I try to inspect the method in reference.vb that VS2005 creates when I add the web service reference, I find this:
<System.Web.Services.Protocols.SoapDocumentMethodAttribute("", Use:=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Bare)> _
Public Function getCtrDetailsByCtrNumber(<System.Xml.Serialization.XmlElementAttribute([Namespace]:="http://Company.ca/tmMy/submit")> ByVal CtrDetailsByCtrNumber As CtrDetailsByCtrNumber) As <System.Xml.Serialization.XmlArrayAttribute("MyOBJECTResponse", [Namespace]:="http://Company.ca/tmMy/submit"), System.Xml.Serialization.XmlArrayItemAttribute("MyResponseObject", Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=false), System.Xml.Serialization.XmlArrayItemAttribute("MyResponseNV", Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=false, NestingLevel:=1)> MyResponse()()
Dim results() As Object = Me.Invoke("getCtrDetailsByCtrNumber", New Object() {CtrDetailsByCtrNumber})
Return CType(results(0),MyResponse()())
End Function
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.1433"), _
System.SerializableAttribute(), _
System.Diagnostics.DebuggerStepThroughAttribute(), _
System.ComponentModel.DesignerCategoryAttribute("code"), _
System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=true, [Namespace]:="http://Company.ca/tmMy/submit")> _
Partial Public Class CtrDetailsByCtrNumber
Private CtrNumberField As String
.....
.....
.....
etc
End Class
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.1433"), _
System.SerializableAttribute(), _
System.Diagnostics.DebuggerStepThroughAttribute(), _
System.ComponentModel.DesignerCategoryAttribute("code"), _
System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://Company.ca/tmMy/submit")> _
Partial Public Class MyResponse
.....
.....
.....
etc
End Class
Pls let me know if u were asking about something else.
Thanks a lot.