Question Status

Verified
Luigi77 asked a question on 21 Apr 2013 11:50 PM

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.

Reply
Verified Answer
Tommy Skaue responded on 22 Apr 2013 2:06 AM

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.

Reply
Luigi77 responded on 22 Apr 2013 8:07 AM

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

Reply
Tommy Skaue responded on 22 Apr 2013 8:37 AM

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.

Reply
Luigi77 responded on 22 Apr 2013 9:10 AM

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

Reply
Verified Answer
Tommy Skaue responded on 22 Apr 2013 9:45 AM

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:
  

Reply
Luigi77 responded on 22 Apr 2013 11:54 PM

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!

Reply
Tommy Skaue responded on 22 Apr 2013 11:57 PM

Good stuff! :-)

Please remember to mark the answer. ^_^

Reply
Luigi77 responded on 23 Apr 2013 5:13 AM

Well, that works!

Reply
Verified Answer
Tommy Skaue responded on 22 Apr 2013 2:06 AM

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.

Reply
Verified Answer
Tommy Skaue responded on 22 Apr 2013 9:45 AM

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:
  

Reply