
147 N.W.2d 663 (1966)
Isadore A. RENNER, Plaintiff and Respondent,
v.
J. GRUMAN STEEL COMPANY, Walter Miltenberger, and New Amsterdam Casualty Company, a Corporation, Defendants and Appellants.
Civ. No. 8253.
Supreme Court of North Dakota.
December 9, 1966.
Rehearing Denied January 21, 1967.
*666 Greenwood & Swanson, Dickinson, for plaintiff and respondent.
*667 Duffy & Haugland, Devils Lake, for defendants and appellants J. Gruman Steel Co. and New Amsterdam Casualty Co.
Ziegler & Butz, Rugby, for defendant and appellant Walter Miltenberger.
STRUTZ, Judge (On reassignment).
In September 1960, J. Gruman Steel Company commenced an action in the district court of Pierce County against Isadore A. Renner, a resident of the State of Montana, for the sum of $1,709.70 for goods, wares, and merchandise which the corporation had sold to Renner. Since the debtor was not a resident of the State of North Dakota, personal service could not be made in this State. However, Renner had certain personal property in Rugby, Pierce County, and a warrant of attachment was secured from the clerk of the district court of that county, directed to the sheriff, commanding the sheriff to attach such property. Pursuant to such writ of attachment, the chief of police of Rugby, acting in the absence of the sheriff, on September 7, 1960, seized the property of the said Renner found in Rugby. It appears that the sheriff, who was absent from his office when the writ of attachment was delivered, did not return to work until some weeks later due to illness. The chief of police, acting for the sheriff during such absence, put a padlock on Renner's property but did nothing further. The sheriff returned to his office in the latter part of October 1960 and, on October 25, made and filed an inventory in the attachment proceeding.
Renner did not answer in such action, but his attorney attempted to make a settlement of his account by offering J. Gruman Steel Company a chattel mortgage on the property which it had attached, together with a note which was to be due the following March 29. J. Gruman Steel Company offered to compromise the matter, but a settlement never was reached.
Thereupon J. Gruman Steel Company served on Renner a notice of motion for judgment. Renner countered with a notice of special appearance, contending that the court did not have jurisdiction to enter any judgment against him because a copy of the summons and complaint had not been mailed to him at his Montana residence within ten days after the first publication of summons, as required by statute. On hearing the notice of motion for judgment, the court determined that it did have jurisdiction, and judgment was ordered for J. Gruman Steel Company and against Renner for $1,709.70, and the property which had been attached, or so much as was necessary to set aside such judgment, and costs, was ordered sold by the sheriff. This property was sold by the sheriff on January 12, 1961. The notice of entry of judgment and the judgment were served upon Renner at his residence in Montana, but no appeal was ever taken from such judgment.
Thereafter, when time for appeal in the former action had expired, the present action was commenced by Renner against J. Gruman Steel Company and the New Amsterdam Casualty Company, which had furnished the attachment undertaking, and against Walter Miltenberger, the sheriff of Pierce County, for the conversion of Renner's property by selling the same under the order and judgment of the district court, which Renner alleges to be void. J. Gruman Steel Company made a special appearance in the action started by Renner, claiming that, as a Minnesota corporation, it was not properly served in North Dakota when service was attempted by serving its attorneys in the attachment proceeding and by mailing a copy of the summons and complaint to its Minnesota address by ordinary mail. In its special appearance, J. Gruman Steel Company further sets out that it had commenced the prior action for money due from Renner; that service in that action could not be made on Renner personally because he was not a resident of North Dakota, but that service was made by attaching certain personal property within this State, and by thereafter causing an affidavit of publication to be filed and summons *668 to be published, with copy of such summons mailed to the said Renner at his Montana address, as provided by law; that judgment had been entered against Renner and, pursuant to such judgment, his property had been sold by the sheriff.
Renner, on the other hand, contends that the attachment of his property in the prior action was void because the sheriff did not file an inventory within twenty days after the property had been attached, as required by Section 32-08-09, North Dakota Century Code, and that the sale of his property therefore was made under a void judgment. Renner demanded damages for wrongful sale of such personal property.
This case came on for trial before the Honorable W. C. Lynch, one of the judges of the Fourth Judicial District, sitting at the written request of the Honorable Douglas B. Heen, one of the judges of the Second Judicial District.
The defendant J. Gruman Steel Company having made a special appearance for the purpose of objecting to the jurisdiction of the court in the action brought by Renner, the trial court held that it did have jurisdiction over such defendant. After hearing, it ordered that judgment be entered against the defendant J. Gruman Steel Company, a foreign corporation, and the defendant Walter Miltenberger, as sheriff of Pierce County, and the defendant New Amsterdam Casualty Company, which had furnished the attachment bond in the prior action. Such judgment was ordered entered in favor of the plaintiff, Renner, in the sum of $6,861.50 and costs, but the judgment against the defendant New Amsterdam Casualty Company was for only the sum of $1,709.70, the amount of its attachment bond.
From the judgment so entered on such order, the defendants all have appealed to this court and have demanded a trial de novo.
The first issue to be determined on this appeal is whether the sheriff's sale of the plaintiff's personal property, under the judgment rendered by the court in the prior action against Renner, constituted a conversion of that property. If that sale was valid, the plaintiff, Renner, clearly has no cause of action against the defendant J. Gruman Steel Company or the sheriff or the bonding company which furnished the attachment bond in the former proceeding.
The creditor, J. Gruman Steel Company, attempted to obtain service on the defendant, Renner, in the prior action by publication, as provided by Rule 4(g), North Dakota Rules of Civil Procedure. Before the service of the summons by publication, a verified complaint was filed with the clerk of the district court of Pierce County, together with an affidavit stating that the defendant was a nonresident of the State of North Dakota. The record also shows that a copy of the summons and complaint was mailed after the filing of the affidavit for publication not later than ten days after the first publication of the summons, and that such mailing was to the defendant at the place of his residence in Montana, with postage fully paid.
On receipt of such summons, the defendant appeared specially in the action and objected to the jurisdiction of the court on the ground that the copy of the summons and complaint was not mailed to him within ten days after the first publication of summons. This objection was not valid, because the record conclusively shows that such summons and complaint were mailed within ten days after the first publication of summons.
Thereafter, on November 30, 1960, notice of motion for judgment was mailed to the defendant, notifying him that the plaintiff would move the court, on December 20, 1960, at 2 p. m., at chambers in the court-house in Devils Lake, for a judgment on the plaintiff's complaint in such former action. On the 20th day of December, such motion came on for hearing before the Honorable Douglas B. Heen. It appeared to the court at such hearing that the summons and complaint had been served by *669 publication following the attachment of defendant's property; that the defendant did not appear or answer except by special appearance objecting to the jurisdiction of the court; that the objection was without merit; and the court found that it did have jurisdiction of the defendant and ordered entry of judgment. Notice of entry of judgment was mailed to Renner on December 21, 1960, at his address in Montana, but no appeal was ever taken from such judgment.
We find that the trial court in the present proceeding was correct in finding that the court in the prior attachment proceeding did not have jurisdiction to enter the judgment against the defendant, Renner. This court has held that the failure of a sheriff to file an inventory within twenty days after an attachment renders the entire attachment void. Summerfield v. Paulson, 68 N.D. 161, 278 N.W. 248. See also Dickinson v. First National Bank of Cody, Wyoming, 64 N.D. 273, 252 N.W. 54, 93 A.L.R. 739, in which we held that the statute for the attachment of property must be strictly complied with.
The record discloses that the plaintiff in the attachment proceedings, J. Gruman Steel Company, did not comply with the attachment statute. The inventory of the sheriff was not filed within twenty days, as required by statute, and so the attachment was absolutely void.
Since the attachment was void, was the judgment that was entered in the prior case, in favor of J. Gruman Steel Company, a valid judgment so that the sale held on such judgment was valid? Counsel for J. Gruman Steel Company cite several North Dakota cases which they contend stand for the proposition that a judgment, once entered in a case, is conclusive and can be attacked only by appeal. Among the cases they cite in support of this proposition is the case of Jensen v. Schwartz (N.D.), 90 N.W.2d 716. This case, however, does not stand for the proposition contended for by counsel. In that case, this court said:
"An attack on a former judgment, in a subsequent action, constitutes a collateral attack upon such prior judgment of the court duly entered. Such an attack is ineffective unless the record of the original action shows that the court had no jurisdiction." [Emphasis provided.]
We believe that that is exactly what the record in the prior action of J. Gruman Steel Company v. Renner does show. The jurisdiction of the court was based on a valid attachment of property of the defendant, Renner, within the State. But the attachment became void because no inventory was filed by the sheriff within the twenty days from the date of attachment, as shown by the record in that, the prior case. Counsel for J. Gruman Steel Company says that even if the attachment was invalid, the sheriff's sale was on execution issued on the judgment in the former action, not on the attachment. This prior action, however, was an action in rem. Jurisdiction of the debtor was dependent entirely upon the validity of the attachment. If the attachment was void, as we hold it was, the judgment in the former case was wholly void. And sale held under a void judgment would be a void sale.
The Summerfield and Dickinson cases, cited above, follow the general rule that a proceeding to establish a statutory lien to aid in the collection of a debt must strictly comply with the statute, and any material departure from the requirements of the statute render the proceeding void. If a proceeding is void, then it may be attacked and set aside in a collateral proceeding.
We therefore can come to but one conclusion: The attachment proceeding in the former action was void, and the judgment entered by the trial court in such prior action was invalid.
The next issue to be determined on this appeal is whether the plaintiff, Renner, *670 in the present action had secured jurisdiction over the defendant J. Gruman Steel Company, a foreign corporation. Section 10-22-08, North Dakota Century Code, provides for the appointment of a registered agent for each foreign corporation authorized to transact business within this State. Section 10-22-10, North Dakota Century Code, provides that the registered agent so appointed shall be the agent of such corporation upon whom process may be served. This section has a further provision which reads as follows:
"Whenever a claim shall arise out of business transacted in this state by a foreign corporation transacting business without a certificate of authority, service of process may be made upon any person who shall be found within this state acting as an agent of, or doing business for, such corporation, or by mailing a copy thereof to the defendant corporation by registered or certified mail at its last known post office address."
It is conceded that no registered agent had been appointed by the defendant J. Gruman Steel Company in North Dakota. Whether the court acquired jurisdiction over this defendant depends upon whether the defendant, by hiring the legal firm of Duffy & Haugland to attempt to collect its account from the plaintiff, Renner, and their commencing litigation against Renner in this State and attempting to secure service on him by attachment of personal property in North Dakota belonging to him, constituted the transaction of business within the State by the foreign corporation so that service of process on the attorneys for the defendant was valid service on the defendant.
The record shows that, for a period of about six months, the defendant did have a sales representative in this State who attempted to take orders for it and to collect accounts which were due the defendant company. However, no service was ever made on such sales representative. Neither was a copy of the summons and complaint mailed to the defendant corporation by registered or certified mail at its last-known postoffice address. So the question of whether the court acquired jurisdiction over the J. Gruman Steel Company, a foreign corporation, depends on whether the attempt of such foreign corporation to collect in North Dakota the amount due it from Renner, was transacting business in this State so as to bring the defendant within the provisions of the statute which states, in part:
"Whenever a claim shall arise out of business transacted in this state by a foreign corporation transacting business without a certificate of authority, service of process may be made upon any person who shall be found within this state acting as an agent of, or doing business for, such corporation, * * *" [Sec. 10-22-10, N.D.C.C.]
If the attempted collection of its account against Renner by attachment in North Dakota constituted the transaction of business by the foreign corporation within this State, and its attorneys were acting as agents for the corporation, then the claim of the plaintiff arising out of such business transacted here was a claim, the enforcement of which could be made by service of process on any person found within the State acting as agent of such corporation. The mere fact that this was the only instance of transacting business in the State by such corporation would be immaterial.
The overwhelming majority of jurisdictions hold that the mere bringing of an action in a State to recover an indebtedness or to enforce an obligation is not doing business within that State. 20 C.J.S. Corporations § 1836, p. 52; J. W. Seavey Hop Corp. of Portland v. Pollock, 20 Wash.2d 337, 147 P.2d 310; Trust Co. of Georgia v. Mortgage-Bond Co. of N. Y., 203 Ga. 461, 46 S.E.2d 883; Indian Refining Co. v. Royal Oil Co., 102 Cal.App. 710, 283 P. 856; Iola State Bank v. Kissee (Okl.), 363 P.2d 368; *671 O'Brien v. Lanpar Co. (Tex.Civ.App.), 391 S.W.2d 483.
Thus, if engaging in litigation does not constitute the doing of business within this State, the claim of the plaintiff, Renner, arising out of such litigation is not a claim arising out of "business transacted in this state" by the defendant J. Gruman Steel Company, as a foreign corporation transacting business without a certificate of authority. Thus, under the designated statute, service on the attorneys for such company would not be valid service.
We hold that the bringing of an action in this State to recover an indebtedness does not constitute doing business in this State. The defendant J. Gruman Steel Company having appeared specially, and the court not having jurisdiction over the said defendant, the judgment which was recovered against it must be reversed.
We next consider whether the judgment recovered against the defendant Walter Miltenberger, as sheriff, is valid. He, of course, was personally served and appeared generally in the action, so that nothing we have said heretofore refers to the action against this defendant.
The sheriff was not in his office when the writ of attachment in the prior action was delivered to him for execution. In fact, he did not return to his office for some weeks thereafter. The entire matter was handled by the chief of police of Rugby, acting in the capacity of deputy for the sheriff. By the time the sheriff returned to his office, the time for making and filing an inventory in the attachment proceeding had already elapsed. Acts of his acting deputy, however, are, in our opinion, the acts of the sheriff. As a general rule, a sheriff is liable for the acts, defaults, or misconduct of his deputy committed in the performance of his official duties. 80 C.J.S. Sheriffs and Constables § 55-a(1), p. 232.
The defendant Miltenberger, as sheriff, contends that, in any event, he is not responsible for damages to the plaintiff, Renner, on the ground that the sale of Renner's personal property on January 12, 1961, was invalidif in fact it was invalid because the sheriff had in his possession a lawful order which purported to be valid on its face, based on a judgment entered in the case of J. Gruman Steel Company v. Renner on December 22, 1960, which order and judgment required him to sell the property in question.
Our statutes provide for liability on the part of the sheriff for doing certain acts, and for failure to act, in the line of his duties. Among these is his liability for failure to execute process. Section 11-15-17 provides that:
"If the sheriff to whom a writ of execution or attachment is delivered neglects or refuses to levy upon or sell any property of the party charged in the writ which is liable to be levied upon or sold, after being required to do so by the creditor or his attorney, he is liable to the creditor for the value of the property." [Emphasis provided.]
The failure to make a proper levy or return does not injure the debtor, but injures the creditor. The sheriff is made liable to the creditor, not to the debtor whose property is being attached. In the prior attachment case, Renner was in no way injured by the failure of the sheriff to file an inventory. In fact, had the sheriff done his duty, the attachment and sale of Renner's property would have been valid and he would have no cause of complaint against the sheriff. How, then, was he hurt by the fact that the inventory was not made, returned, and filed? An undertaking had been filed in the attachment proceeding for the amount of Renner's debt. The proceeding was in all things valid on its face, and surely the fact that Renner now may have a claim for the wrongful sale of his property under void attachment does not damage him and is not proof that he was damaged by the failure of the sheriff to file an inventory.
*672 As stated in 80 C.J.S. Sheriffs and Constables § 61-a, page 249
"The liability of a sheriff or constable for failure to execute process ordinarily is limited to the injury actually sustained by the party having the process issued." [Emphasis provided.]
There would be no liability to the party whose property was being proceeded against, which the sheriff failed to properly attach. In fact, he now has a cause of action against his creditor only because the sheriff failed to do his duty. Such failure on the part of the sheriff in no way damaged or injured Renner. So the fact that the defendant Miltenberger failed to make and file an inventory within twenty days, as required by statute, would not create any liability on the part of the sheriff in favor of Renner. It would create a liability only in favor of the party who had the writ of attachment issued.
But the plaintiff, Renner, contends that the judgment entered in favor of J. Gruman Steel Company against him in the prior attachment action was absolutely void because of the failure to make and file an inventory, and that therefore the sheriff is liable for selling his property under a void judgment. We fail to see how the defendant sheriff can be held liable for this sale of Renner's property under the prior judgment, even where that judgment was absolutely void. It is a well-established rule that the process, judgment, or order of a court having apparent jurisdiction, if valid on its face, affords complete protection to a sheriff from liability for any proper or necessary act done in its execution. 80 C.J.S. Sheriffs and Constables § 122-a, p. 330; Gilbertson v. Helle, 69 N.D. 735, 290 N.W. 269.
Thus a sheriff who executes an order or judgment which awarded to the J. Gruman Steel Company the sum of $1,709.70 and costs, and which further adjudged such sum to be a lien on certain personal property and which ordered such personal property sold, cannot be held liable for anything done which is necessary and proper in carrying out the order of the court. A sheriff who executes the order or judgment of the court under such circumstances is protected thereby, regardless of the subsequent action of a court in holding such order and judgment to be invalid. The right of the sheriff to protection in a proper action for acts done in executing an order or process, valid on its face, does not depend on the ultimate success in the action of the party at whose instance the process issued. As was said by the Minnesota Supreme Court in Robinette v. Price, 214 Minn. 521, 8 N.W.2d 800:
"* * * A sheriff is protected and justified for acts done in executing the process and orders of a court having jurisdiction of the subject matter when the process is regular on its face."
We would also point out that, in the former attachment proceeding, the debtor, Renner, could have protected his property by having the writ of attachment released by the filing of an undertaking in the sum of the creditor's claim, as provided in Section 32-08-19, North Dakota Century Code.
The final issue to be considered on this appeal is whether the judgment recovered by Renner against the defendant New Amsterdam Casualty Company, on the undertaking which it had issued in the prior attachment action, should be affirmed. The undertaking which was filed provided, among other things, that if the owner of such property, Renner, "recovers judgment against the said plaintiff or if the seizure be set aside by order of the Court, we, J. Gruman Steel Company, as principal, and New Amsterdam Casualty Company, as surety, UNDERTAKE, PROMISE AND AGREE to and with the said defendant that the said plaintiff shall and will pay all costs that may be awarded to said defendant and all damages he may sustain by reason of the said seizure not exceeding the sum of One Thousand Seven Hundred *673 Nine Dollars and Seventy Cents and interest at the rate of four percent from September 6, 1960."
The seizure of the property was held to be invalid because of failure of the sheriff to file his inventory, as provided by law. The surety thereupon became liable on its undertaking. While, ordinarily, a surety is liable only in the event the principal has been found liable, that is not true of a surety under our attachment laws. Section 32-08-06, North Dakota Century Code, which provides for an undertaking in attachment, specifically gives to the attachment defendant the right to proceed against the surety without first securing a judgment against the plaintiff in the action. This section reads, in part:
"* * * If the attachment is set aside by order of the court, the defendant may bring an action upon such undertaking without first obtaining judgment against the plaintiff in the action in which such undertaking was given."
The surety became liable on its undertaking when the attachment was declared to be void. Thus the judgment against the surety is affirmed even though no judgment was first obtained against the principal on the bond.
For reasons stated herein, the judgment against the defendant J. Gruman Steel Company is reversed; the judgment against the sheriff, Walter Miltenberger, is reversed; and the judgment against the defendant New Amsterdam Casualty Company is affirmed.
TEIGEN, C. J., and ERICKSTAD and KNUDSON, JJ., concur.
MURRAY, J., not being a member of the Court at the time of submission of this case, did not participate.

On petition for rehearing.
STRUTZ, Judge.
The respondent has filed a petition for rehearing in which he raises two issues:
First, did this court properly apply the law in determining that bringing an action for the collection of a debt in North Dakota did not constitute the doing of business in this State within the statutory provisions permitting service of process on a foreign corporation which was doing business in the State without a certificate of authority?
Second, did this court erroneously construe the liability of the sheriff in the attachment proceedings for failure to file an inventory in such proceedings within the twenty-day limitation?

Issue No. 1
Counsel for Renner argues that the enormous growth of corporate business throughout the United States has brought with it the recognition by the courts of the need to afford protection to local residents in dealings with nonresident corporations, citing Section 10-22-01 of the North Dakota Century Code. This section provides that no foreign corporation shall have the right to transact business within the State until it shall have secured a certificate of authority to do so.
However, we do not believe that coming into the State to collect a claim which a foreign corporation might have against a resident of Montana constitutes "doing business" in this State. The claim upon which the foreign corporation brought such suit did not arise out of business done within the State. The suit was brought in North Dakota only because the nonresident debtor had property in this State, which the creditor attempted to attach.
Service in the case of Renner v. J. Gruman Steel Company was attempted by filing an affidavit for publication alleging that the defendant foreign corporation had *674 property in the State. But no property was, in fact, found or, in any event, proceeded against. The judgment which was recovered was a personal judgment against the corporation itself. The plaintiff argues that the defendant was doing business within the State and that service was made under the provisions of Section 10-22-10, North Dakota Century Code. That section provides that, whenever a claim shall arise out of "business transacted" in this State by a foreign corporation which is transacting business without a certificate of authority, service of process may be made in the following manner:
By serving any person who shall be found in this State acting as an agent of or doing business for such corporation; or
By mailing a copy of such process to the defendant corporation by registered or certified mail, addressed to it at its last-known postoffice address.
When service in this case was attempted by serving the attorneys for the defendant corporation in the attachment suit, presumably such attorneys were served as agents of the defendant nonresident corporation. Service was further attempted by serving the defendant corporation by ordinary mail. There is no showing that such service was by registered or certified mail, as required by Section 10-22-10, North Dakota Century Code.
We hold that neither attempted service was good. An attorney who brings a lawsuit under the circumstances found in the attachment suit brought against Renner for a foreign corporation which is not authorized to do business in this State is not an agent of such corporation or doing business for such foreign corporation so that service of process may be made upon him. Counsel says that J. Gruman Steel Company had been doing business in this State for some time. But no service was attempted upon any person found in the State acting as agent of or doing business for such corporation.

Issue No. 2
The second issue raised on the petition for rehearing is the liability of the sheriff to the attachment debtor for failure to file an inventory in the attachment proceedings within the twenty-day limitation fixed by statute. This matter is, we believe, fully covered in our original opinion. We would only point out that, prior to the entry of the judgment in the attachment proceedings against Renner, which judgment was later declared to be void for failure of the sheriff to file an inventory within the period fixed by statute, the trial court specifically held that it did have jurisdiction to enter such judgment. In view of this fact, the sheriff would not be required to determine, contrary to the decision of the trial court, that the trial court was in error and therefore refuse to comply with the court's order. Where the court specifically states that it has jurisdiction and enters an order which the sheriff enforces, the sheriff will not be held liable if the court is in error in such determination.
The petition for rehearing is denied.
ERICKSTAD and KNUDSON, JJ., concur.
