Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 72043

Multi Header Janson attributes to consume in AX through web service

$
0
0

I am trying to consume the Multi header jason file in D365 I have used the multi contact class to to consume the same .But when i am reading the attributes i am getting the error saying child node not declared. I am sharing the sample jason file and error which i am getting.Please help me to resolve.

Jason format
{
"Header":
[{
"Node":
[{
"Mobile": "9000755101"
}]
}]
}

Error Message :

{
"Message": "An exception occured when deserializing a parameters - Exception occurred when parsing and deserializing parameter 'Node' - 'Parameter 'Node' is not found within the request content body.'",
"ExceptionType": "XppServicesDeserializationException",
"ActivityId": "438d0da4-8b55-0007-5fc4-8d43558bd501"
}

Service class

class Pwc_TestMultiNodeService extends SysOperationServiceBase
{
[AifCollectionType('Header', Types::Class, classStr(Pwc_TestMultiHeaderContract)),
AifCollectionType('Node', Types::Class, classStr(Pwc_TestMultiNodeContract))]
public str TestMultiNode(list Header,List Node)
{

str result,jsread;
ListEnumerator lEnum,IEnum1;
List resultSet = new list (Types::String);
List list = new list (Types::Class);
Pwc_TestMultiHeaderContract recordscontract = new Pwc_TestMultiHeaderContract();
Pwc_TestMultiNodeContract recordscontract1 = new Pwc_TestMultiNodeContract();
//ListEnumerator enumerator = Parameters.getEnumerator();

try
{
IEnum1 = Header.getEnumerator();
while (IEnum1.MoveNext())
{
recordscontract = lEnum.current();
}
lEnum = Node.getEnumerator();
while (lEnum.MoveNext())
{
recordscontract1 = lEnum.current();
}
result = "MESSAGE_CODE"+": "+ "1, " + "MESSAGE_DESCRIPTION"+ ": "+"Success, ";

resultSet.addEnd(result);

}
catch(Exception::Error)
{
ttsAbort;
System.Exception ex = CLRInterop::getLastException() as System.Reflection.TargetInvocationException;
warning(ex.InnerException.Message);
}
jsread = FormJsonSerializer::serializeClass(resultSet);
return jsread;

}

}

Contract Class :

[DataContractAttribute]
class Pwc_TestMultiHeaderContract
{

Pwc_TestMultiNodeContract Node;

[DataMemberAttribute]
public Pwc_TestMultiNodeContract recordscontract1(Pwc_TestMultiNodeContract _Node = Node)
{
Node = _Node;
return Node;
}

}

[DataContract]
class Pwc_TestMultiNodeContract
{
CustAccount MOBILE;
Name name;

[DataMember('MOBILE')]
public CustAccount parmCustId(CustAccount _CustID = MOBILE)
{
MOBILE = _CustID;
return MOBILE;
}

}


Viewing all articles
Browse latest Browse all 72043

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>