Your question is specific to US Army and Marine personnel, as you reference "solider" in the question. While the information below is specific to the US Army, it translates to all branches, soldiers, sailors, and airmen alike.
I have to confess, however, the question is confusing. Here's why:
The US Army Code of Conduct (mirrored by the other branches of US Military) reads:
- I am an American, fighting in the forces which guard my country and our way of life. I am prepared to give my life in their defense.
- I will never surrender of my own free will. If in command, I will never surrender the members of my command while they still have the means to resist.
- If I am captured I will continue to resist by all means available. I will make every effort to escape and to aid others to escape. I will accept neither parole nor special favors from the enemy.
- If I become a prisoner of war, I will keep faith with my fellow prisoners. I will give no information or take part in any action which might be harmful to my comrades. If I am senior, I will take command. If not, I will obey the lawful orders of those appointed over me and will back them up in every way.
- When questioned, should I become a prisoner of war, I am required to give name, rank, service number, and date of birth. I will evade answering further questions to the utmost of my ability. I will make no oral or written statements disloyal to my country and its allies or harmful to their cause.
- I will never forget that I am an American, fighting for freedom, responsible for my actions, and dedicated to the principles which made my country free. I will trust in my God and in the United States of America.
The COC carries the weight of orders to all US Army service members. It is drilled into the brain of every Basic Training recruit. It is a point of honor and pride.
Here is the important part, see number five; US Service Members are required to give only their name, rank, service number, and date of birth and nothing more. US Service Members are not required by any US or International law to "comply" with captors in any way. They are required by standing orders to resist, evade, and attempt escape in the event they are captured.