2
SOAP 웹 서비스에 객체를 보낼 수 없습니다 : 내가이 개체를 변환하는 방법 내부나는 방법과 비누 웹 서비스가
string startReaction(object reaction);
을 실제 유형입니다 :
Reaction reactionObj = (Reaction)reaction;
...
내가 가지고있는 동일한 Reaction
클래스를 양식 프로젝트 (이 창은이 ws를 호출해야합니다)에 있습니다. 여기서 Reaction 객체 인스턴스를 만들고 데이터로 채우고 웹 서비스로 보내려고합니다.
string data = webserviceReference1.startReaction(reaction);
가 나는 또한 시도 :
string data = webserviceReference1.startReaction(reaction as object);
하지만 아무것도. 는 그럼 난 반응 클래스에이 특성을 추가하려고 :
[XmlInclude(typeof(object))]
public class Reaction{...
하지만 아무것도. 내가 할 오류 :
[WebMethod]
[XmlInclude(typeof(Reaction))]
[XmlInclude(typeof(Foo))]
[XmlInclude(typeof(Bar))]
// ... the list goes on with all possible types that you might want to pass to this method
// since you used object as argument you need to explicitly say which types are allowed here
public string startReaction(object reaction)
{
...
}
당신은에 같은 클래스를 재정의해서는 안 : 클라이언트가 그것에 대해 알 수 있도록
이There was an error generating the XML document. :: System.InvalidOperationException: The type Demo.Form1+Reaction was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically.
왜 안 되죠? string startReaction (반응 반응); '? –