I am populating a simple WCF contract string parameter with a string from infolog.text()
If I test the service call in AX the parameter is populated.
When I consume the net.tcp web service in a C# console app to test it, the parameter is empty.
If I hard code the parameter it IS returned in the console app.
What gives? Is infolog.text() encoded differently?
Please help me!
I’ve tried to convert the string:
- strFmt
- TextBuffer
- System.Text.StringBuilder
- System.Text.NormalizationForm
[DataContractAttribute]
public class InfoContract
{
str errorMessage;
}
[DataMemberAttribute]
public str ErrorMessage(str _errorMessage = errorMessage)
{
errorMessage = _errorMessage;
return errorMessage;
}
You already prove (by hard-coding the value) that the service returns string without any problem, therefore the problem must be in how you fill the value. Unfortunately that’s exactly the piece of code that you didn’t show.
I don’t know how you tested it, but I don’t think you actually debugged the CIL session of the service call. I assume that you’re trying to use something that isn’t filled in your situation.
If you’re not aware of it, you can debug your service and see what exactly is going on there. You have to use the debugger in Visual Studio and attach it to AX AOS server (ax32Serv.exe).
Thank you very much for recommending I attach to the AOS in visual studio. I hadn’t done that before. When I run the testing console app, I can step right into the web service logic!
When I step to the line of code that populates our error message parameter with infolog.text(), a watch on infolog says: “The name ‘infolog’ does not exist in the current context”
I’m looking into a better way to populate this value, instead of from the infolog.
That said, is this something you were aware of or know a work around to?
You’ll have to explain what you’re trying to achieve. I can’t tell you how to populate “this value” without knowing what “this value” should be.
Ignor that first line… must have been on the clipboard…
Yes, I already knew what’s the wrong code. What I still don’t know is what you’re trying to achieve. Please forget code for a while and explain the behaviour you want.