Issue with populating Header object for the Currency webservice

I need help in calling the GetLatestCrossRate method on the Currency Webservice. I need help in populating the Header of this method in Dynamics AX. I do not have any issue calling a different open source currency webservice provided by a different provider.

Following is a summary of my code where I call the Xignite Currency webservice -

Code;

ExchRate conversionrate;

// Webservice Name is = daeNetCurrencyService1 (Please see attached document for more details)

daeNetCurrencyService1.XigniteCurrenciesSoapClient soapClient;

// Initialize Object

soapClient = new
daeNetCurrencyService1.XigniteCurrenciesSoapClient(“XigniteCurrenciesSoap”);

// Call the method to get the Latest Exchange rate for Currency

conversionrate = soapClient.GetLatestCrossRate(( header, “EUR”, “USD”);

Please Note: - The 3rd party vendor provides the following code to populate the header in C#. I just need someone to help me show how the header object with the member variables can be populated for this web service in Dynamics AX.

Xignite Code for C# to populate the Header

///RemoteQuotes is the web reference to the XigniteQuotes service
///objRemoteQuote is an instance of the service proxy
RemoteQuotes.XigniteQuotes objRemoteQuote = new RemoteQuotes.XigniteQuotes();
///create an instance of the header
RemoteQuotes.Header objHeader = new RemoteQuotes.Header();
///assign your username
objHeader.Username = “me@myfirm.com”;
///assign the header to the service proxy
objRemoteQuote.HeaderValue = objHeader;
///you can then call any method
RemoteQuotes.ExtendedQuote objExtendedQuote = objRemoteQuote.GetQuote(“msft”);

Issue: I just need to to get the Xignite Call working for the above method by passing in the Header object using Dynamics AX

Thanks,

Kumar

Does anyone have any suggestions to make?

Guys,

We were able to call the Xignite webservice with the following code -

We were able to set the Header methods, and call the Xignite webservice. Following is the code -

[webservice_Name].Header myHeader;

myHeader = new [webservice_Name]…Header();

myHeader.set_Username(“username”);

myHeader.set_Password(“password”);

soapClient = new daeNetCurrencyService1.XigniteCurrenciesSoapClient(“XigniteCurrenciesSoap”);

// invoke the service and return result in the proper object type

myCrossRate = soapClient.GetLatestCrossRate(myHeader,_fromCurrency,_toCurrency);

Regards,

Kumar

Thanks for letting us know the solution to this issue. I am sure it will be of use to someone some day.

Kumar,

Do you think you could provide more information on how you created the webservice? I’m currently working to implement this same service. Any info you could provide on the service setup would be greatly appreciated.

Thanks,
Mike

Hi Mike,

If you use the steps provided in the PDF document "Consuming external web services in Microsoft Dynamics AX 2009 you should be able to create this without a problem. The detailed steps are in this document.

You can google for this document, and it appears on the first link.

Kumar