OTTAWA -- Prime Minister Stephen Harper heads to China this week amid serious divisions in the Conservative ranks over Canada's relationship with its No. 2 trading partner.

Harper held an upbeat photo-op with the Chinese ambassador in his Langevin Block office late last week to announce his third visit to the country following a long-standing invitation from President Xi Jinping.

But the warm encounter was in stark contrast to months of chilly relations between the two countries that almost iced the visit entirely, an expert on Chinese-Canadian relations says.

"I think the invitation has been on the table for a year and a half, and there was no decision until very recently; it was on-again, off-again," said Paul Evans, author of "Engaging China" and an international relations professor at the University of British Columbia.

"It's extraordinary that there seems to have been no decision until very recently."

Since Harper's last visit to China in 2012, the Conservatives restricted state-owned Chinese investment in Alberta's oilsands and have yet to respond to an invitation to negotiate a free-trade agreement with China.

The government also dragged its heels on ratifying a Foreign Investment Promotion and Protection Agreement with the Chinese.

Tensions reached a fever pitch in recent months after Harper accused the Chinese of a cyberattack on the National Research Council; the Chinese, meanwhile, have accused a Canadian couple living in China of spying.

Still, Evans said, those recent irritants could have -- and likely should have -- been handled via diplomatic efforts. That Harper publicly went loud and large on the espionage accusations is indicative of just how conflicted the Conservatives remain about China.

Employment Minister Jason Kenney, for example, expressed misgivings about forging closer ties with China as recently as this spring.

Several cabinet ministers, including Kenney, feel China "is a godless totalitarian country with nuclear weapons aimed at us," Evans said.

"China is difficult for any government anywhere; it's really complicated and high-stakes terrain. But in Canada, you have a significant portion of cabinet, caucus and the Conservative base itself that is very negative about China."

A government source, speaking on condition of anonymity, said Harper intends to raise human rights concerns in a "frank dialogue" with the Chinese leadership -- an issue the source described as a "delicate balance."

Even though Harper is pursuing an economic agenda to build trade and investment with the Chinese, he won't shy away from raising concerns about the rule of law, good governance and democracy, said the source, saying the prime minister would represent "values that define us as Canadians."

Canadians at large appear to have misgivings about China. In its annual national poll, the Asia Pacific Foundation of Canada found that a declining number of Canadians believe that China is highly important to Canada's prosperity.

Perhaps due to the prickly nature of the Canada-China relationship, Harper's visit has a heavy focus on trade and economics, with the prime minister leading a Canadian business delegation to the industrial city of Hangzhou on Friday and Saturday before heading to the capital, Beijing, for two more days of meetings.

He'll also be on hand for the first day of APEC meetings before travelling back to Canada for Remembrance Day ceremonies on Parliament Hill.

John Manley, head of the Canadian Council of Chief Executives, said Canada can continue to have a dialogue with China on human rights, regional security and cyberspying while promoting stronger economic ties at the same time.

He points out that New Zealand -- a country that places a high value on human rights, rule of law and democracy, as Canada does -- has benefited enormously under a free-trade agreement with China. Australia, meantime, is negotiating a free-trade pact.

Harper is visiting both countries next week; China is expected to be a topic of conversation.

"You have to be able to do both things at the same time in a complex bilateral relationship," Manley said.

The China visit could bear fruit for Harper, Manley said, particularly if there's an agreement with Beijing that would foster far easier trade between the Canadian dollar and China's currency. Canadian business leaders are expecting a deal to build a settlement hub for the yuan, also called the renminbi, any day now.

"That would be a great thing for Canada ... I don't know if they've landed this, but it's potentially a very big deal."