Discussion:
Consum web service in Ax 2009
(too old to reply)
Tam
2010-09-02 11:30:03 UTC
Permalink
Hi everyone
I want to use an external web service in Dynamics Ax 2009 but got this
exceptions:

Message --> Exception has been thrown by the target of an invocation.
Source --> mscorlib
Stack --> at System.RuntimeMethodHandle._InvokeMethodFast(Object target,
Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes,
RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target,
Object[] arguments, Signature sig, MethodAttributes methodAttributes,
RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
culture)
at ClrBridgeImpl.InvokeClrInstanceMethod(ClrBridgeImpl* ,
ObjectWrapper* objectWrapper, Char* pszMethodName, Int32 argsLength,
ObjectWrapper** arguments, Boolean* argsAreByRef, Boolean* isException)
Message --> Type 'System.ServiceModel.Channels.ReceivedFault' in assembly
'System.ServiceModel, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' is not marked as serializable.
Source --> Microsoft.Dynamics.IntegrationFramework
Stack --> at
Microsoft.Dynamics.IntegrationFramework.WebService.AppDomainRemotingProxy.ExecuteMethod(String methodName, Object[] args)
at
Samh.Webservice.SamWebServicePortClient.setQuarterlySale(String strAccessKey,
Int32 intSupplierCVR, Int32 intMemberCVR, Int32 intYear, Int32 intQuarter,
Single dblAmount)

I followed the White Paper Consuming Web Services in Microsoft Dynamics AX
2009
and restarted the AOS service after the Web Reference was created, still
errors.

My colleague called the web service by his .Net application it works fine.

Any idea to solve this issue? Any help will be appreciated.

Regards
Tam
Huzaifa Gain
2010-09-02 14:04:03 UTC
Permalink
See if Biz connector is working fine or not ..
Post by Tam
Hi everyone
I want to use an external web service in Dynamics Ax 2009 but got this
Message --> Exception has been thrown by the target of an invocation.
Source --> mscorlib
Stack --> at System.RuntimeMethodHandle._InvokeMethodFast(Object target,
Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes,
RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target,
Object[] arguments, Signature sig, MethodAttributes methodAttributes,
RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
culture)
at ClrBridgeImpl.InvokeClrInstanceMethod(ClrBridgeImpl* ,
ObjectWrapper* objectWrapper, Char* pszMethodName, Int32 argsLength,
ObjectWrapper** arguments, Boolean* argsAreByRef, Boolean* isException)
Message --> Type 'System.ServiceModel.Channels.ReceivedFault' in assembly
'System.ServiceModel, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' is not marked as serializable.
Source --> Microsoft.Dynamics.IntegrationFramework
Stack --> at
Microsoft.Dynamics.IntegrationFramework.WebService.AppDomainRemotingProxy.ExecuteMethod(String methodName, Object[] args)
at
Samh.Webservice.SamWebServicePortClient.setQuarterlySale(String strAccessKey,
Int32 intSupplierCVR, Int32 intMemberCVR, Int32 intYear, Int32 intQuarter,
Single dblAmount)
I followed the White Paper Consuming Web Services in Microsoft Dynamics AX
2009
and restarted the AOS service after the Web Reference was created, still
errors.
My colleague called the web service by his .Net application it works fine.
Any idea to solve this issue? Any help will be appreciated.
Regards
Tam
Tam
2010-09-03 13:14:03 UTC
Permalink
I think Biz Connector doesn't need to be available when you're using web ref.

I tried to create a new web ref to microsoft
http://terraserver-usa.com/TerraServices2.asmx web service. It worked fine.
The method I invoked returned a string.

The one that throws exception return an array. Could that be the reason?
Post by Huzaifa Gain
See if Biz connector is working fine or not ..
Post by Tam
Hi everyone
I want to use an external web service in Dynamics Ax 2009 but got this
Message --> Exception has been thrown by the target of an invocation.
Source --> mscorlib
Stack --> at System.RuntimeMethodHandle._InvokeMethodFast(Object target,
Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes,
RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target,
Object[] arguments, Signature sig, MethodAttributes methodAttributes,
RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
culture)
at ClrBridgeImpl.InvokeClrInstanceMethod(ClrBridgeImpl* ,
ObjectWrapper* objectWrapper, Char* pszMethodName, Int32 argsLength,
ObjectWrapper** arguments, Boolean* argsAreByRef, Boolean* isException)
Message --> Type 'System.ServiceModel.Channels.ReceivedFault' in assembly
'System.ServiceModel, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' is not marked as serializable.
Source --> Microsoft.Dynamics.IntegrationFramework
Stack --> at
Microsoft.Dynamics.IntegrationFramework.WebService.AppDomainRemotingProxy.ExecuteMethod(String methodName, Object[] args)
at
Samh.Webservice.SamWebServicePortClient.setQuarterlySale(String strAccessKey,
Int32 intSupplierCVR, Int32 intMemberCVR, Int32 intYear, Int32 intQuarter,
Single dblAmount)
I followed the White Paper Consuming Web Services in Microsoft Dynamics AX
2009
and restarted the AOS service after the Web Reference was created, still
errors.
My colleague called the web service by his .Net application it works fine.
Any idea to solve this issue? Any help will be appreciated.
Regards
Tam
Axel Kühn
2010-09-06 09:56:03 UTC
Permalink
Hi Tam,

there are some limitations for webservice used as service references in
Dynamics AX 2009.

Please see this article:
http://floditt.blogspot.com/2010/07/limitations-of-dynamics-ax-service.html

Somethines it is better to write a nes .net assembly which handles the
webservice calls and exposes a working "interface" for AX. This is also
described in the article.

But if you are working with an array as result, this could also be the
problem.
There are some differnces in the usage of .net arrays and x++ arrays.

Please take a look at this discussion, where you can find an example on how
to use .net arrays as result form a webservice call
http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?&lang=&cr=&guid=&sloc=en-us&dg=microsoft.public.axapta.programming&p=1&tid=a5106c60-9c14-4e88-b269-9c5bed8027b8

Hope this helps you.
--
Sincerely yours
Axel Kühn (visit my Dynamics AX blog at: http://blog.ak-home.net)
Post by Tam
I think Biz Connector doesn't need to be available when you're using web ref.
I tried to create a new web ref to microsoft
http://terraserver-usa.com/TerraServices2.asmx web service. It worked fine.
The method I invoked returned a string.
The one that throws exception return an array. Could that be the reason?
Post by Huzaifa Gain
See if Biz connector is working fine or not ..
Post by Tam
Hi everyone
I want to use an external web service in Dynamics Ax 2009 but got this
Message --> Exception has been thrown by the target of an invocation.
Source --> mscorlib
Stack --> at System.RuntimeMethodHandle._InvokeMethodFast(Object target,
Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes,
RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target,
Object[] arguments, Signature sig, MethodAttributes methodAttributes,
RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
culture)
at ClrBridgeImpl.InvokeClrInstanceMethod(ClrBridgeImpl* ,
ObjectWrapper* objectWrapper, Char* pszMethodName, Int32 argsLength,
ObjectWrapper** arguments, Boolean* argsAreByRef, Boolean* isException)
Message --> Type 'System.ServiceModel.Channels.ReceivedFault' in assembly
'System.ServiceModel, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' is not marked as serializable.
Source --> Microsoft.Dynamics.IntegrationFramework
Stack --> at
Microsoft.Dynamics.IntegrationFramework.WebService.AppDomainRemotingProxy.ExecuteMethod(String methodName, Object[] args)
at
Samh.Webservice.SamWebServicePortClient.setQuarterlySale(String strAccessKey,
Int32 intSupplierCVR, Int32 intMemberCVR, Int32 intYear, Int32 intQuarter,
Single dblAmount)
I followed the White Paper Consuming Web Services in Microsoft Dynamics AX
2009
and restarted the AOS service after the Web Reference was created, still
errors.
My colleague called the web service by his .Net application it works fine.
Any idea to solve this issue? Any help will be appreciated.
Regards
Tam
Loading...