Add service reference: Use of unassigned out parameter 'XX'

Add service reference: Use of unassigned out parameter 'XX'

This question is answered

Hi there

I'm currently integrating a web service to AX 2009. When I try to add a service reference in AOT, I got some messages saying:

[Drive:\]...\AppData\Local\Temp\DynamicsAxSvcReferences\<MyWebServiceName>\<WebServiceMainCls.cs(36,25) : error CS0269: Use of unassigned out parameter <Parameter>

But when I use Visual Studio, all works fine. I don't know how to fix. Any Ideas:

The service is public, so you can try it too: https://ws.im.post.ch/3.0?wsdl

Thank you for answers.

Verified Answer
  • You might have an unsupported scenario with this webservice. If that is the case, then you need to consider creating a wrapper class for the webservice, and consume the wrapper class within AX.

    Tommy Skaue | Dynamics AX Developer from Norway | http://yetanotherdynamicsaxblog.blogspot.no/ | www.axdata.no

  • Here is what you can try. I can not guarantee it will work, so good luck!

    Add a breakpoint in the method AifServiceReferenceManager.generate()
      

    Now add the reference as normal. 

    When the code hits the breakpoint, head over to the temporary files holding the c# code and remove both "PeekMessage" and "GetMessage" from the source of both PortClient.cs and WcfSoapClient.cs. Use a text editor like notepad for this. Path should be something like
    C:\Users\AOS_SERVICE_ACCOUNT\AppData\Local\Temp\DynamicsAxSvcReferences\NAMESPACE 

    Now let the program continue and it will compile the dll ok and add the reference for you. 

    I tested it just now:
      

    Tommy Skaue | Dynamics AX Developer from Norway | http://yetanotherdynamicsaxblog.blogspot.no/ | www.axdata.no

All Replies
  • You might have an unsupported scenario with this webservice. If that is the case, then you need to consider creating a wrapper class for the webservice, and consume the wrapper class within AX.

    Tommy Skaue | Dynamics AX Developer from Norway | http://yetanotherdynamicsaxblog.blogspot.no/ | www.axdata.no

  • Hmm, and how i find out, if I have such an unsupported scenario?

    I know about the possiblity of a wrapper class, but if possible, of course I don't want solve it inside AX ...

  • I don't think you will be able to use the method "PeekMessage" and "GetMessage" without using a wrapper class. I don't think AX .Net interop support such a scenario at the current version. I remember having issues with using an out variable of a custom type from within AX.

    Tommy Skaue | Dynamics AX Developer from Norway | http://yetanotherdynamicsaxblog.blogspot.no/ | www.axdata.no

  • So, these two operations are the trouble base?

    Well, these two operations I don't need. But is there a way to add the service reference anyway??

  • Here is what you can try. I can not guarantee it will work, so good luck!

    Add a breakpoint in the method AifServiceReferenceManager.generate()
      

    Now add the reference as normal. 

    When the code hits the breakpoint, head over to the temporary files holding the c# code and remove both "PeekMessage" and "GetMessage" from the source of both PortClient.cs and WcfSoapClient.cs. Use a text editor like notepad for this. Path should be something like
    C:\Users\AOS_SERVICE_ACCOUNT\AppData\Local\Temp\DynamicsAxSvcReferences\NAMESPACE 

    Now let the program continue and it will compile the dll ok and add the reference for you. 

    I tested it just now:
      

    Tommy Skaue | Dynamics AX Developer from Norway | http://yetanotherdynamicsaxblog.blogspot.no/ | www.axdata.no

  • Hi Tommy

    Thank you for that Idea - this seems to work. I have now some minor .NET/WCF troubles to solve before I can do serious tests.

    But I will write, if all runs fine or if there are any other issues.

    Thank you again!

  • Good stuff! :-)

    Please remember to mark the answer. ^_^

    Tommy Skaue | Dynamics AX Developer from Norway | http://yetanotherdynamicsaxblog.blogspot.no/ | www.axdata.no

  • Well, that works!