Interaction between Webservice and AX 2012 X++

Hi All,

Thanks in advance.

I need to call a web service method from X++ code, so to do that, I have created a Visual studio project and added the reference to that specific WSDL path (web service path).

After the above step, I added VS project to AOT, once it’s added I accessed the classes and methods which are present in the WSDL path (Web service path).

When I am tring to access a method, I getting the following exception, can any one please guide me how can I resolve this.

Note: I don’t have the web service project’s solution, so I can’t do any thing with web service.

Is there any way to find whether this issue is related to “Webservice” or from “my code”

Below Highlighted details are of Exception Details,

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.InvalidOperationException: There was an error reflecting ‘return’. —> System.InvalidOperationException: The top XML element ‘return’ from namespace ‘’ references distinct types System.Boolean and System.String[]. Use XML attributes to specify another XML name or namespace for the element or types.

at System.Xml.Serialization.XmlReflectionImporter.ReconcileAccessor(Accessor accessor, NameTable accessors)

at System.Xml.Serialization.XmlReflectionImporter.ReconcileLocalAccessor(ElementAccessor accessor, String ns)

at System.Xml.Serialization.XmlReflectionImporter.ImportAccessorMapping(MemberMapping accessor, FieldModel model, XmlAttributes a, String ns, Type choiceIdentifierType, Boolean rpc, Boolean openModel, RecursionLimiter limiter)

at System.Xml.Serialization.XmlReflectionImporter.ImportMemberMapping(XmlReflectionMember xmlReflectionMember, String ns, XmlReflectionMember[] xmlReflectionMembers, Boolean rpc, Boolean openModel, RecursionLimiter limiter)

at System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(XmlReflectionMember[] xmlReflectionMembers, String ns, Boolean hasWrapperElement, Boolean rpc, Boolean openModel, RecursionLimiter limiter)

— End of inner exception stack trace —

at System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(XmlReflectionMember[] xmlReflectionMembers, String ns, Boolean hasWrapperElement, Boolean rpc, Boolean openModel, RecursionLimiter limiter)

at System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(String elementName, String ns, XmlReflectionMember[] members, Boolean hasWrapperElement, Boolean rpc, Boolean openModel, XmlMappingAccess access)

at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.XmlSerializerImporter.ImportMembersMapping(XmlName elementName, String ns, XmlReflectionMember[] members, Boolean hasWrapperElement, Boolean rpc, Boolean isEncoded, String mappingKey)

at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.OperationReflector.ImportMembersMapping(String elementName, String ns, XmlReflectionMember[] members, Boolean hasWrapperElement, Boolean rpc, String mappingKey)

at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.OperationReflector.LoadBodyMapping(MessageDescription message, String mappingKey, MessagePartDescriptionCollection& rpcEncodedTypedMessageBodyParts)

at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.OperationReflector.CreateMessageInfo(MessageDescription message, String key)

at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.OperationReflector.EnsureMessageInfos()

at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.EnsureMessageInfos()

at System.ServiceModel.Description.XmlSerializerOperationBehavior.CreateFormatter()

at System.ServiceModel.Description.XmlSerializerOperationBehavior.System.ServiceModel.Description.IOperationBehavior.ApplyClientBehavior(OperationDescription description, ClientOperation proxy)

at System.ServiceModel.Description.DispatcherBuilder.BindOperations(ContractDescription contract, ClientRuntime proxy, DispatchRuntime dispatch)

at System.ServiceModel.Description.DispatcherBuilder.ApplyClientBehavior(ServiceEndpoint serviceEndpoint, ClientRuntime clientRuntime)

at System.ServiceModel.Description.DispatcherBuilder.BuildProxyBehavior(ServiceEndpoint serviceEndpoint, BindingParameterCollection& parameters)

at System.ServiceModel.Channels.ServiceChannelFactory.BuildChannelFactory(ServiceEndpoint serviceEndpoint, Boolean useActiveAutoClose)

at System.ServiceModel.ChannelFactory.CreateFactory()

at System.ServiceModel.ChannelFactory.OnOpening()

at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)

at System.ServiceModel.ChannelFactory.EnsureOpened()

at System.ServiceModel.ChannelFactory`1.CreateChannel(EndpointAddress address, Uri via)

at System.ServiceModel.ChannelFactory`1.CreateChannel()

at System.ServiceModel.ClientBase`1.CreateChannel()

at System.ServiceModel.ClientBase`1.CreateChannelInternal()

at System.ServiceModel.ClientBase`1.get_Channel()

at CTS_EDIConnection.EDI_ServiceReference.UEBIBrokerInterfacePortTypeClient.TEBIBrokerInterface_PublishWS(String aClientId, String aUser, String aPassword, String aDomain, String aApplication, String aSchema, String aDestination, String aReference, String aMessage, Int32 aMessageFormat, Int32 aDuplicates)

— End of inner exception stack trace —

at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)

at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)

at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

at Microsoft.Dynamics.AX.ManagedInterop.ClrBridgeImpl.InvokeClrInstanceMethod(ClrBridgeImpl* , ObjectWrapper* objectWrapper, Char* pszMethodName, Int32 argsLength, ObjectWrapper** arguments, Boolean* argsAreByRef, Boolean* isException)

All replies are appriciated.