If my memory, such as it is, serves, the first encounter between the nations of China and Japan, such as they were, was around the 3rd century AD. The encounter is recorded in Chinese histories from the period as emissaries from the Kingdom of Wa coming to offer tribute and the servitude of their distant nation, because, of course, China is the center of the world (hence “The Middle Kingdom”) and who doesn't want to come and pay tribute? The encounter isn't recorded in Japanese histories from the period at all, mostly because the Japanese hadn't imported writing from China yet, but probably also because they were too polite to correct the Chinese.
(We will skip an early Japanese invasion of Korea, as the Japanese undoubtedly wish they had.)
Over the next nine centuries, the Japanese didn't pay any further tribute, but rather acquired Chinese writing, Buddhism, Confucianism, poetry, architecture, etc., etc., etc., which I think is their comment on who was serving whom. In the 1200s, the Chinese invented accounting, got their books straightened out and figured out the Kingdom of Wa hadn't been paying taxes for about 900 years. They turned the matter over to their collection agent, Kubilai Khan, who decided to repossess Japan (it's the interest that gets you, don't you know). Two different invasion fleets attempted to carry this policy out, but both were destroyed by storms. These storms were dubbed Mitsubishi Zeroes by the Japanese in an attempt to show how much tax they felt they owed China.
Fast forward through three centuries of war, upheaval, flea-bitten Dutch sailors living in filth, English pirates having affairs with samurai wives, and Japanese pilots swaggering around singing "Yo-ho-ho and a bottle of sake" at the local karaoke boxes.
The Japanese decided not only did they not owe China any taxes, but China owed them. They invaded Korea in the late 1500s, but were informed the Khans had moved and the Chinese hadn't invented postal forwarding services yet. The Koreans very vigorously helped the Japanese pack up and leave. The Japanese, who were unfamiliar with the custom, did not tip them, which caused resentment among the Koreans.
Just after 1600, the Portuguese took up karaoke, which a few years later caused the son and second successor of the former shogun Toranaga to decide he didn't want anything at all to do with most of the rest of the world. He closed all of Japan's ports except one, Nagasaki. Only Chinese and Dutch traders were allowed there because, hey, the Chinese were useful nerds who invented things like spaghetti, the printing press, and gunpowder, and the Dutch could sing. The off-key Portuguese and randy Brits were kicked right out, and those arrogant upstarts, the Americans, who were so backward they didn't even have a country yet, were banned as well just to show the shogun (who had forgotten everything America will do for Japan) meant business. Or rather, meant no business.
Around 1750, after a century and a half of peace, the ruling military class of Japan went through an identity crisis. They looked for the answer, among other places, in Neo-Confucianism and its attendant focus on loyalty to the emperor. Of course, China had gotten significantly weaker in the intervening years, and the Japanese Neo-Confucian philosophers had to explain that. So they claimed, as the nation is held together by the emperor's mandate from heaven, and China had rather fallen apart, that the true Mandate of Heaven had passed to the Japanese Emperor, making Japan the Middle Kingdom, and yet still the Kingdom of Wa. The identity crisis continued.
In 1854, the US Navy (which finally had a country) steamed into Edo Bay, where it was met with anti-foreigner protestors (who had forgotten everything the US will do for Japan), and forced the Japanese government to open some ports to American trading ships and whalers. As an afterthought, the US Navy also demanded exemption from Japanese laws for all US citizens in Japan, and the right to send John Wayne to open a consulate. Other European nations, competing with each other to exploit the rest of Asia, followed the US lead in Japan, all the while deriding the Americans for their unilateralist lack of diplomacy.
In the 1860's, upset at the number and influence of foreigners coming into Japan, two rebel Japanese fiefdoms hired British mercenaries to help them train their peasantry for war. As the British had been recently fighting for their right to sell opium in China, there were plenty of arms in the area, so these rebel fiefs forked over the gold to British gunrunners and helped themselves. Afraid of losing control to the rapidly modernizing forces of these fiefs, the Japanese government bought French weapons and hired French mercenaries to train their troops. Quite naturally, the government lost, and in 1868 the rebels took over Japan. In the name of restoring tradition and following the code of bushido, the rebels abolished the traditional class system, including the samurai class1, imported thousands of foreigners to help them modernize, and began their long love-fear relationship with the English language by establishing the JET program.
Well, that brings us to the end of this period of Sino-Japanese relations. I hope you've all taken good notes for the test. Next class we'll cover the eventful years 1868 to 1945, as well as Formosa, Taiwan, and the Republic of China.
1Strangely, despite having good-quality British training and years of combat experience in defeating the previous government's armies and then rooting out and destroying a number of insurgent samurai armies, and despite being officered almost entirely, from lieutenants to generals, by ex-samurai, the new Japanese army had to hire US cavalry officer Tom Cruise to teach them basic infantry skills, bring them to an understanding of samurai-style warfare, and lead them against the last deadender samurai army in 1877 (although he defected instead of doing this last). The not-terribly-astute nature of this hiring has led some historians to suggest that this was merely a government program to boost the sagging economy, and that it was later replaced by a series of transportation infrastructure expansion programs that built superhighways to rural villages in New Zealand.