web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

External web service returns an error - Clr Interop Marshal: Unsupported type.

(0) ShareShare
ReportReport
Posted on by

I have an external web service hooking pickling lists into a 3PL web service that has been running for about 18 months without an issue.  The 3PL has recently changed thier IO address and now the calls to the external web service have stopped working.  They swear that they have chaged nothing except the IP address but the .exe it hooks into is also different.

When I call the web service the exception string returned says "...  incorrect address or SOAP action. See InnerException, if present, for more details. ..." and more details.  So I added the inner expection to the infolog that shows when an error is caught.  This inner exception simply says 

Clr Interop Marshal: Unsupported type.

When I define the webservice type it is loaded from their system and this hasn't changed in my code. 

I do this with

clientType = CLRInterop::getType("3pl.WebClient");   

webService = AifUtil::CreateServiceClient(clientType);

If I look at the visual studio definition of the webClient base type is system object which has worked in the past.  

How can I determine what type it is or how can I map anytype to intiialize the web client?  Or is this not really my issue and I should be looking somewhere else?

Many thanks for any help.

Regards,Paulina 

thanks

Paulina

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Mea_ Profile Picture
    60,284 on at

    Hi Paulina,

    3pl.WebClient could be generated based on WSDL file and if it has been changed you have to regenerate it.  Please follow this msdn article https://technet.microsoft.com/en-us/library/hh500185.aspx

  • Community Member Profile Picture
    on at

    Thanks Ivegen,

    I have read that article and it is what I followed when I originally created the service a couple of years ago. I have refreshed the service via the vs project and then compiled, cleared caches, restarted AOS and loged out of the user and back in to refresh everything and to ensure it is accessing the new reference. I know this can be quite tricky ensuring it replaces the dll in the client and server.  Any other ideas?

    Thanks

    Paulina

  • Martin Dráb Profile Picture
    237,882 Most Valuable Professional on at

    Which line of code is throwing the error?

    Assuming it's "webService = AifUtil::CreateServiceClient(clientType)", what's the declared type of webService variable and what's the actual type returned by CreateServiceClient()?

  • Community Member Profile Picture
    on at

    Hi Martin,  Good question - It errors on the first line referencing the service

    webservice.importOrder(string)

    rather than the actual service definition line  AifUtil::createserviceclient(clientType)

    P.

  • Mea_ Profile Picture
    60,284 on at

    Obvious question, what does webservice.importOrder() accept  and what is the type of "string" ?

  • Community Member Profile Picture
    on at

    The string is an XML document. - I'm not aware of any changes to the XML document format that the service requires.

    P.

  • Martin Dráb Profile Picture
    237,882 Most Valuable Professional on at

    Unfortunately it doesn't answer either of the questions.

    What's the type of the string variable? Is it XmlDocument (X++ class), System.Xml.XmlDocument, str, System.String or something else?

    And what's the type expected by importOrder()?

    But I would also review call stacks included in exceptions; I think the actual error is thrown at a lower level than here.

  • Community Member Profile Picture
    on at

    It's an xml file that is produced via the AIF outbound picklist service.  It is transformed during the outbound service to the XML schema that was supplied by the 3pl warehouse.  I create a list of the files created in the transport address folder and process them to the service.

       xmlDoc = new XmlDocument();

       file = _file;                                            // passed to the method from a directory folder search

       new FileIoPermission(file,'rw').assert();

       xmlDoc.load(file);

       string = xmlDoc.toString();

    I have replaced the URL and IP adress but the full exception.(tostring) obtained from the catch is:-

    System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at **WEBCLientURL** that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A socket operation was attempted to an unreachable network **NetworkIP**   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)

      at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)

      --- End of inner exception stack trace ---

      at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)

      at System.Net.HttpWebRequest.GetRequestStream()

      at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream()

      --- End of inner exception stack trace ---

    Server stack trace:

      at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream()

      at System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout)

      at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.SendRequest(Message message, TimeSpan timeout)

      at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)

      at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)

      at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)

      at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)

      at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

    Exception rethrown at [0]:

      at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)

      at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

      at webservice.ImportOrders(ImportOrdersRequest request)

      at webservice.ImportOrders(ImportOrdersRequest request)

      at webservice.ImportOrders(String Orders)

      --- 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)

    I then put the exception.get_innerException() into the infolog with gave me the Marshal:unsupported type message.

    Do you need actual addresses and ports?  They are locked to our IP address but I email them to you rather than on a public forum?

    Thanks

    Paulina

  • Verified answer
    Martin Dráb Profile Picture
    237,882 Most Valuable Professional on at

    From the fact that you assign the result of xmlDoc.toString() to the string variable we can derive that the type is either str or System.String (not XmlDocument).

    The call stacks proves that webservice.ImportOrders() was successfully called; the exception is thrown from inside the method and that's what you should focus on, instead of playing with X++.

    And the inner exception is also telling you what's wrong: "an unreachable network **NetworkIP**". Check if it's the right address and it is, look at why it can't be reached.

  • Community Member Profile Picture
    on at

    Hi Martin, I'm not 100% sure what you're asking for with the declared type of the webservice.  The webservice was created in VS and the method declares it as

    private void importWebService(Filename    _file)

    {

      #define.AppId("webService")

       // variable for service client

       ClrObject           clientType;

       // variable for service client type

       webservice.WebClient                WebService;

    Does that answer your question?

    Regards,

    Paulina

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans