2016-11-21 7 views
0

내가 WSDL에 정의 된이 TestList 방법에 내 요청을 보내려고하고 Xml.Serialization.XmlArrayItemAttribute :소모 웹 서비스는

<System.ServiceModel.MessageBodyMemberAttribute([Namespace]:="[service url here]", Order:=8), _ 
System.Xml.Serialization.XmlArrayItemAttribute("TestItem", IsNullable:=false)> 
Public TestList() As myref.TestItem_Type 

내가 TestItem_Type로 내 목록 만들었습니다, 나는 모든 클라이언트 데이터가 이 객체의 내용 :

Dim MyList As New myref.TestItem_Type 
MyList.sNumber = 1 
MyList.bdentifier = 21 

WSDLCall.SendList = MyList 

이 시점에서 MyList에 문제가 있습니다.

"값 유형 'myref.TestItem_Type'로 변환 할 수 없습니다 '의 1 차원 배열 myref.TestItem_Type'

내가 웹 서비스 개요는 System.Xml.Serialization을 사용하는 주어진 목록에는 직렬화해야합니까 .XmlArrayItemAttribute? 난 배열하지만 행운으로 myList를 선언 노력했다.

답변

1

당신은 배열로 TestList을 선언 한

Public TestList() As myref.TestItem_Type 

그런 다음리스트로에서 표기에도 불구하고 (단일 항목을 사용하여 전화)

Dim MyList As New myref.TestItem_Type 
MyList.sNumber = 1 
MyList.bdentifier = 21 
WSDLCall.SendList = MyList 

그래서 배열 전달이 그것을 고정

WSDLCall.SendList = {MyList} 
+0

(버전을 가정하면이 구문을 지원) : {myList에} - 감사합니다! – levis84